ashram 1-1 10 Posted October 10, 2013 Sorry if this question is already answered before somewhere, any search with "setPos" turns up a lot of results. I have done a fair bit of research and hope to have found a solution but advice would be gratefully received. According to the reference, setPos is now "global for every object" https://community.bistudio.com/wiki/setPos However this does not seem to apply when using setPos in init.sqf to move a named unit which is a player. Indeed, this seems a reasonable exception considering that "The player's unit is always local to its client" https://community.bistudio.com/wiki/Locality_in_Multiplayer It was unexpected that my colleague Mr. Milewski would be malingering back at the airstrip when he should have been dumped with me next to a crashed chopper in a semi-random location 5km behind enemy lines with no working GPS and extended map info disabled. Yes, I am clearly both a sadist, and a masochist. :) When this happened I thought fair enough, i hadn't properly considered the impact of locality for this mission, it wouldn't be the first time. I was initially confused by the contradiction above but it has sunk in now and hopefully i just need to force the setPos command to be run on his client. I have investigated some new commands and think this might be a solution Will this work, maybe i'm missing the point and this is not necessary and there a simpler / more elegant way of relocating a player's unit? It's not easy for me to test this stuff; I tried creating a dedicated server and then connecting to it on the same PC, but it just hangs after selecting the mission. I don't want to get my mate online to only waste his time again . (in init.sqf, after loadouts and a 10 second fade from black to conceal the teleportation): if (!isServer) then { "MNS_crashpos" addPublicVariableEventHandler { player setPos ([_this select 1, (random 5) + 5, random 360]call BIS_fnc_relPos); }; } else { // some code here to determine position of crash site, assign to variable _pos missionNamespace setVariable ["MNS_crashpos",_pos]; _clientID = owner Milewski; _clientID publicVariableClient "MNS_crashpos"; }; Thanks in advance. Sam Share this post Link to post Share on other sites
kylania 568 Posted October 10, 2013 SHK_startingPositionRandomizer Share this post Link to post Share on other sites
cuel 25 Posted October 10, 2013 setPos does not have to be executed locally, using it on the server should cause no problems. IIRC you have to wait until the mission is "started". Try this // code to determine crash site waitUntil {time > 0} // mission is live Milewski setPos _crashSite; Share this post Link to post Share on other sites
ashram 1-1 10 Posted October 10, 2013 Ahah, simple as that. I needlessly complicated things as usual. Still, learnt some cool stuff about the eventhandlers and variables. Thanks both of you for the quick replies. I'll try it out in the next couple of days, and we'll see if we can make it home in one piece. :) Share this post Link to post Share on other sites