Jump to content
Sign in to follow this  
CaptainBravo

Attach trigger to group leader

Recommended Posts

Hey everyone,

Although I know how to attach a trigger to a unit I am not sure how to attach to a group leader. So if group leader dies, trigger attaches to next in command.

Thank you for your help

Share this post


Link to post
Share on other sites

while {({alive _x} count (units _grp)) != 0} do {
  _leader = leader _grp;
  waitUntil {_leader != (leader _grp)};
  trigger setTriggerActivation ["LEADER", "PRESENT", true];
};

http://community.bistudio.com/wiki/setTriggerActivation

or in a seperate repeating trigger:

cond:

!alive (leader groupname) AND ({alive _x} count (units groupname)) != 0

on act:

{if (!alive (leader groupname) AND alive _x) then {groupname selectLeader _x}} foreach units groupname; triggername setTriggerActivation ["LEADER", "PRESENT", true];

Edited by Demonized

Share this post


Link to post
Share on other sites

Thanks Demonized for your help. Speaking of group leader, how to get a group leader to say a voice command. I know how say works for indivdual units but unsure for group leader (looking to attach a trigger to group leader so group leader can say things when certain conditions met in trigger and if he dies, next grp leader says same thing).

Share this post


Link to post
Share on other sites

Thanks Shuko for the link. MP is always a bit iffy. What other ways of achieving same objective without using a trigger? (example group leader say command)

Share this post


Link to post
Share on other sites

If anything, triggers simplify things in MP. A trigger placed in the editor will exist on every client, and anything executed in a trigger will therefore be executed on every client. Simple.

To make a group leader say something when you aren't sure exactly who the leader will be (since the original one may have died), simply use leader <groupname>.

Share this post


Link to post
Share on other sites

Thanks ST_Dux for your help, that is what I was looking for. I also agree trigger make things a lot easier. I use them all the time in MP missions and they seem to work fine.

There are situations where dedicated might require a bit more "tweaking"

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  

×