Jump to content
stigern

Spawning unit in my group

Recommended Posts

Hi

 

I'm using this script in a radio trigger to spawn a new groupmember to me. But in MP all players gets a new group member.

Is there a way to only apply this to the player triggering the radio command?

 

unit = group player createUnit ["B_Soldier_F", getPos player, [], 0, "FORM"];

This also goes for this script which spawn a helicopter, but spawns on next to each player.. and not only the one triggering the radio:

_veh = "B_Heli_Attack_01_dynamicLoadout_F" createVehicle position player;

 

Share this post


Link to post
Share on other sites

Let's see... Is it the group leader who can call such a trigger? And obviously the code is executed on all machines. So what about:


if (leader group player == player) then {

...

};

  • Like 1

Share this post


Link to post
Share on other sites

the radio trigger is specific:

- it doesn't return thisList (there is no unit mentioned as the "operator" of the radio).

- you need to script it , using the local syntax (no way by editor) to fire on the right PC. The edited one can't give you the operator.

 

Remove your edited trigger,

Run instead in init.sqf, or initPlayerLocal:

(must run on each client and hosted)
 

_trg = createTrigger ["EmptyDetector", [0,0,0],false];
_trg setTriggerActivation ["ALPHA", "PRESENT", true];
_trg setTriggerStatements ["this", "_unit = group player createUnit ['B_Soldier_F', getPos player, [], 0, 'FORM']", ""];

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Yes. If you have more than one group (i.e. not a simple COOP mission) you will need to go with pierremgi's solution.

  • Like 1

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

×