Gloopy 0 Posted February 10, 2008 Hi Guys, My script (which is a modified version of one posted in this thread) is kind of working. It will spawn me on one of the markers as well as spawn the AI on one of the markers but it won't spawn any human controlled players when playing a multiplayer game. they always spawn where they are set in the editor. Hope someone knows why and can advise! Thanks -Gloopy <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> Alpha1 = _this select 0; _allpos = [getMarkerPos "spawn1",getMarkerPos "spawn2",getMarkerPos "spawn3",getMarkerPos "spawn4"]; _pos = _allpos select (random (count _allpos - 1)); Alpha1 setpos _pos; Alpha2 setPos (getPos Alpha1); Alpha3 setPos (getPos Alpha1); Alpha4 setPos (getPos Alpha1); p.s I have tried using "Alpha2 setPos _pos"; as well and it doesn't work. If for example Alpha 2 is a human player, he won't spawn at alpha1's location but Alpha 3 & 4 (AI Players) will. Share this post Link to post Share on other sites
charliereddog 9 Posted February 10, 2008 I take it you are running this from the init.sqf/sqs? I think you're problem is locality, you need to ensure that it's the server running the script. Share this post Link to post Share on other sites
sickboy 13 Posted February 11, 2008 Doesn't work because the setPos command must be executed on all computers. Because it only moves the unit/object if the object is local where the command is executed. (Check the MP EditorGuide link in my sig) Why don't you just use the marker Method described in the thread you linked? If you just want to start the mission on different places Anyway; Solution, v1.09b: init.sqf: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">// Create function T_fMove T_fMove = { private ["_pos"]; _pos = _this select 1; {_x setPos _pos} forEach (_this select 0) }; // Add EventHandler on publicVariable "T_MOVE" "T_MOVE" addPublicVariableEventHandler {(_this select 1) call T_fMove}; script you made:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">private ["_allPos","_pos"]; Alpha1 = _this select 0; _allPos = [getMarkerPos "spawn1",getMarkerPos "spawn2",getMarkerPos "spawn3",getMarkerPos "spawn4"]; _pos = _allPos select (random (count _allPos - 1)); // Update T_Move variable T_MOVE = [[Alpha1,alpha2,alpha3,alpha4], _pos]; // Send it over the network to other computers so it's executed by the eventHandler publicVariable "T_MOVE"; // Execute the T_fMove function also on this computer. As publicVariableEventHandler will only execute on the other computers T_MOVE call T_fMove; Solution for v1.08; im just hoping you got v1.09beta :P Share this post Link to post Share on other sites
Gloopy 0 Posted February 11, 2008 Thanks Charliereddog & Sickboy, I don't have 1.09b and neither do the guys I play with at the minute. Charliereddog - I wasn't executing this from init.sqs but now I have put it into init.sqs it doesn't appear to work at all :/ init.sqs; <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ; **************************************************************** ; Initialization script for Armed Assault ; This is a special INIT script file that runs before the ; mission briefing is displayed. ; **************************************************************** "2" objStatus "HIDDEN" Alpha1 = _this select 0; _allpos = [getMarkerPos "spawn1",getMarkerPos "spawn2",getMarkerPos "spawn3",getMarkerPos "spawn4"]; _pos = _allpos select (random (count _allpos - 1)); Alpha1 setpos _pos; Alpha2 setPos (getPos Alpha1); Alpha3 setPos (getPos Alpha1); Alpha4 setPos (getPos Alpha1); exit Sickboy - Thanks for such a detailed response however I'm a little confused, will the script you've written there work only for 1.09b? and what's the best way to execute it, from the init.sqs or from a trigger/init field in the editor? Thanks -Gloopy Share this post Link to post Share on other sites