Jump to content
Sign in to follow this  

Recommended Posts

Trying to understand a little better!

If I have a addaction on a non playable unit i.e civi :-

this addAction ["Rescue Him!", "spawnstuff.sqf"]

then in spawnstuff.sqf

bla blar
_spawnScud1 = [_spawnplace, 0, "MAZ_543_SCUD_TK_EP1", EAST] call BIS_fnc_spawnVehicle;
blar blar

If i am playing on a hosted server, and say I have 15 players would it spawn 15 Scud's or just 1 ? do i need to wrap it with isserver then { my code}; round it all ?

Thanks

Edited by psvialli

Share this post


Link to post
Share on other sites

When select an action ingame only you run the script. So it would only spawn 1 SCUD. However, you need to remove the action from the unit again for everybody. Otherwise someone else might perform the action too.

One solution is to have a trigger to remove the action.

Where you add the action:

CivScudActionId = this addAction ["Rescue Him!", "spawnstuff.sqf"];

This will remember the id of the action locally for every machine. The id might not be the same on different machines.

When you run the script through the action (spawnstuff.sqf):

RemScudAction = true; publicVariable "RemScudAction";
//.....
//Here you create the SCUD.

That will make the trigger activate on everybodys machines.

The trigger (assuming you named your civ: scudCiv):

Condition: RemScudAction
On Act: scudCiv removeAction CivScudActionId;

That should do it.

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  

×