Fenris 0 Posted November 17, 2002 I want a trigger that detects whether there is anyone left alive from a squad. I'm sure this has been done to death, but I searched and couldn't find anything (often difficult to know what to search for). I could do it the long winded way (i.e. name each unit, and check each status individually) but I think I can assign them to a group or something and there is a way of checking to see if anyone is still alive in that group. If anyone could do a brief step by step I'd be appreciative. P.S. Sorry about the vagueness, but I had very heavy night last night, still haven't slept and am on a come-down. Please be gentle!! Share this post Link to post Share on other sites
bn880 5 Posted November 17, 2002 How about the condition: count (units Group) <= 0 Share this post Link to post Share on other sites
ralphwiggum 6 Posted November 17, 2002 first, in the beginning of the mission, make an array of the units. for example something like this. grparray = units group <name of a soldier in the squad> then ,make a trigger with condition "!alive _x" count grparray == 0 Share this post Link to post Share on other sites
Chris Death 0 Posted November 17, 2002 Ralph, check your condition again and have a laugh yourself You've checked, for the whole squad to be alive. detail: if zero men of grparray are not alive, the condition will be activated. Now zero men not alive is the same as all men alive But basically you've been right. correct condition: "alive _x" count (units grparray) == 0 bn880 - your suggestion doesn't work (trust me - that was one of the first ways, i've tried out). The count command requires the _x variable in this case. Consider it to be the equivalent to the foreach when executing some commands for a whole group. ~S~ CD Share this post Link to post Share on other sites
Chris Death 0 Posted November 17, 2002 Fenris, just after reading your question again; do you want to check at a specific point in the mission, wether there is still somebody of the group alive (if so, excuse me Ralph ) OR do you want to check instantly, for the whole group being killed? method 1 would be: "alive _x" count (units grparray) > 0 :note - this condition would be true, from the start of the mission, so you need to add any other condition to it. e.g: go AND "alive _x" count (units grparray) > 0 "go" is a boolean, which you could use this way: initialize it by using the players init field: go = false now at the point of the mission, where you want the check to become hot, just use: go = true somewhere in a script or activation field (trigger,waypoint). method 2 Just use the condition i wrote one post above, in combination with that: grparray = group this, Ralph posted above. ~S~ CD Share this post Link to post Share on other sites
Fenris 0 Posted November 17, 2002 I'm a little lost (must just be me being dense, will read through again). What I want is a trigger that checks if anyone from a unit is alive. When all units are dead is displays a message saying something like "Charlie Platoon has been wiped out". Share this post Link to post Share on other sites
Fenris 0 Posted November 17, 2002 I think I need this method: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">"alive _x" count (units grparray) > 0<span id='postcolor'> but I'm not really sure about assigning units to an array. Haven't done it before! Share this post Link to post Share on other sites
RED 0 Posted November 17, 2002 You don't need to just use this: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">(count units nameofgroup) > 0<span id='postcolor'> RED Share this post Link to post Share on other sites
Fenris 0 Posted November 17, 2002 Cheers RED, you're always helpful! Last question then (showing how thick I really am! ), how do I name the group? Share this post Link to post Share on other sites
RED 0 Posted November 17, 2002 Put this in the group leaders init field: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">bobsgroup = group this<span id='postcolor'> RED Share this post Link to post Share on other sites
Fenris 0 Posted November 17, 2002 Okay got it working like this: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">aplatoon = units group T55Crew1;<span id='postcolor'> in leader's init field, and: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">"alive _x" count aplatoon == 0;<span id='postcolor'> in the trigger condition field. Cheers boys! Â Share this post Link to post Share on other sites