Jump to content
Sign in to follow this  
L.Trale

How to check if group is dead

Recommended Posts

I want it so that when the group is killed, it will execute a new script. Here is the script:

sleep 5;
playsound "Start";
hint "Be advised Enemy Infantry spotted in your area";
GroupOne_X = Creategroup EAST; "O_diver_F" createUnit [getMarkerPos "spawn1",GroupOne_X,"GroupOne_X move position player",random 1, "Private"]; "O_diver_F" createUnit [getMarkerPos "spawn2",GroupOne_X,"GroupOne_X move position player",random 1, "Private"];

Thanks

Share this post


Link to post
Share on other sites

Go to google type in check if group is dead. Search before posting.

{ alive _x } count units _grp == 0

Share this post


Link to post
Share on other sites

Thanks, I did search but I didn't understand it.

---------- Post added at 20:29 ---------- Previous post was at 20:16 ----------

Any way to make it "If { alive _x } count units _grp == 0 "then" execVM "Waves\Wave2.sqf";

Share this post


Link to post
Share on other sites

if ({alive _x} count units GroupOne_X < 1) then { [] execvm "Waves\Wave2.sqf"; };

Share this post


Link to post
Share on other sites

Thanks, but it doesn't seem to be working.

Share this post


Link to post
Share on other sites

If you are doing it in a trigger:

condition: { alive _x } count units grpName == 0

on activation: 0 = [] execVM "Waves\Wave2.sqf"

grpName is the name of your group, so in the init of your groups leader you should have grpName = group this; or whatever name you want.

Share this post


Link to post
Share on other sites

I'm executing it from a script, not a trigger.

---------- Post added at 20:54 ---------- Previous post was at 20:46 ----------

Maybe use the "waitUntil" command?

Share this post


Link to post
Share on other sites

if (({alive _x} count units groupname) < 1) then {nul = [] execVM "Waves\Wave2.sqf";);

Dirty Haz

Share this post


Link to post
Share on other sites

Not working, thanks though.

waitUntil {{ alive _x } count units _grp == 0; execVM "Waves\Wave2.sqf"; ;}

This works, but for some reason it doesn't count the dead units in the group. If I kill just one of them, it preforms the action.

Share this post


Link to post
Share on other sites

waitUntil {({alive _x} count units groupname) < 1;};
nul = [] execVM "Waves\Wave2.sqf";

Dirty Haz

Edit/Update:

Make sure you replace "groupname" with the actual group's name. :)

EXAMPLE MISSION.

Dirty Haz

Edited by Dirty Haz
Edit/Update

Share this post


Link to post
Share on other sites

No problem, glad you got it working! :)

Dirty Haz

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  

×