Home   Help Search Login Register  

Author Topic: group dead?? (possibly dumb question!)  (Read 539 times)

0 Members and 1 Guest are viewing this topic.

pangzi

  • Guest
group dead?? (possibly dumb question!)
« on: 19 Dec 2002, 00:55:03 »
How do you check if a whole group is dead when you don't know how many units are in that group or how they are called.
You only know the group's name.
Probably there is an obvious solution, but i can'T find it. ???

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:group dead?? (possibly dumb question!)
« Reply #1 on: 19 Dec 2002, 18:47:39 »
Let's pretend your group is named squad1.  Your code would be the following if in a script:

Code: [Select]
? ("alive _x" count units squad1 < 1) : Do_Something
This code says that if there are fewer than 1 units alive (i.e., 0) in squad1, then do whatever code you specify.

Of course, Sui would interject :P that the count command counts units that are not yet registered as dead by the leader, so you can also use the following code:

Code: [Select]
? (west countSide units squad1 < 1) : Do_Something
Replace west with the side to which your group belongs.  The end result is pretty much the same in this case, though.

This code counts how many units exist on the specified side that are in squad1.  If a unit is dead, it does not exist on that side, and thus it will not be counted.

If you are using this code in a trigger, simply remove the ? and the code following the :, including removing the :, and place the remaining code in the trigger's Condition field.
« Last Edit: 19 Dec 2002, 18:49:05 by Ranger »
Ranger

pangzi

  • Guest
Re:group dead?? (possibly dumb question!)
« Reply #2 on: 20 Dec 2002, 17:17:46 »
Great! Just what i was looking for. Now my project is really making progress. Thanx! ;D