Nephris 0 Posted November 23, 2012 Hi folks, I am still a noob in scripting but i am useless in MP scripting conditions. So since OFP i am suffering to decide if sth has to be local or global. Each time I ve to rethink again. Right now I want to execute just a simple call within the init.sqf, but I ve no clue what condition it has to be ,if the map would run on a dedicated. So maybe you can give me hint. call compile format [" pad2 setpos [(getmarkerpos ""mkpos%1"" select 0),(getmarkerpos ""mkpos%1"" select 1),0] ",ceil(random 5)]; A simple object shall be moved by chance. So global or local? Share this post Link to post Share on other sites
seba1976 98 Posted November 23, 2012 You can leave it like that and it will work. It will execute on both clients and server, but it will only take effect where pad2 is local. It will have no effect anywhere else. Share this post Link to post Share on other sites
Muzzleflash 111 Posted November 23, 2012 Actually the argument to setPos can be global, so I would not do that if you want it to work with join in progress. Some later joiner could cause the object to be moved to an entirely different location. You should wrap that in isServer. Also you don't need the call compile: if (isServer) then { _somePos = getMarkerPos (format ["mkpos%1", ceil (random 5)]); pad2 setPos [_somePos select 0, _somePos select 1, 0]; }; random 5, gives a number from 0<--->4.9999999. ceil 0 = 0, so I would recommend you use: (floor (random 5)) + 1 instead, otherwise you could get unlucky and it would try the 0'th marker. Share this post Link to post Share on other sites
seba1976 98 Posted November 23, 2012 Right, forgot the JIP. I always play LAN games. Share this post Link to post Share on other sites
Nephris 0 Posted November 24, 2012 Thx for your advices ! Share this post Link to post Share on other sites