Jump to content
Sign in to follow this  
fatty86

setMarkerPos Locality

Recommended Posts

If setMarkerPos is executed within some server-side code, will it update the marker position for all clients? Here is an example of what I want to do:

if (isServer) then {
townlist = town getvariable "houselist";
townselect = floor (random (town getvariable "housecount"));
towndest = townlist select townselect;

_pos = 0;
while { format ["%1", towndest buildingPos _pos] != "[0,0,0]" } do {_pos = _pos + 1};
_pos = _pos - 1; 
vip setpos (towndest buildingpos (round (random _pos)));
"mkrTask1" setmarkerpos (getpos vip);
};

This is from init.sqf. In this example, a hostage is hidden in a random building. If I leave the setmarkerpos command outside the isServer code, the clients execute the setmarkerpos command prematurely and the marker is moved for them before the hostage is moved.

I tried a "sleep 1," like so:

if (isServer) then {
townlist = town getvariable "houselist";
townselect = floor (random (town getvariable "housecount"));
towndest = townlist select townselect;

_pos = 0;
while { format ["%1", towndest buildingPos _pos] != "[0,0,0]" } do {_pos = _pos + 1};
_pos = _pos - 1; 
vip setpos (towndest buildingpos (round (random _pos)));
};

sleep 1;
"mkrTask1" setmarkerpos (getpos vip);

But this results in other problems, namely the briefing which is executed later in the same file not loading properly.

So I think my first script would be an ideal solution, but I'd like to know if it'll work, or if anyone has any other ideas.

Edited by fatty86

Share this post


Link to post
Share on other sites

What exactly is the problem with the first example? It should work fine.

Share this post


Link to post
Share on other sites

As long as in a if (isServer) it will update marker pos on all connected players on dedi server, i did it on a clan mission a few weeks ago, were i moved an intel marker on map for all to new pos when they found object..

Top one should work ok.

Edit: didnt notice any problem with JIP as described in sbsmac link in above post, but could just have gone unnoticed by players..

Share this post


Link to post
Share on other sites

Thanks for the tips, all. So it looks like the first example would work, but there might be some JIP problems. I wonder if this would then work for players that JIP?

if (isServer) then { 
   blah blah blah blah
   "mkrTask1" setmarkerpos (getpos vip); 
}; 

if (time > 10) then {"mkrTask1" setmarkerpos (getpos vip)};

Share this post


Link to post
Share on other sites

why should there be a JIP problem?

when player joins server after mission start, any command executed on server will be transferred to the JIP.

Your latest code will move marker on server, then again movemarker on every client, i dont see how this is needed.

Optional: movemarkers with a trigger placed in editor to be totally sure that marker gets moved.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×