Home   Help Search Login Register  

Author Topic: Detecting if all units in a group are dead  (Read 1213 times)

0 Members and 1 Guest are viewing this topic.

Ahbenshaut

  • Guest
Detecting if all units in a group are dead
« on: 15 Jan 2003, 02:06:39 »
How can you tell if all units in a group are dead? I have created two triggers, one for each of the groups that creates varEast1 and 2 and gives both variables the value of 0. In the third trigger, on the condition line, I tried putting "varEast1 and varEast2 = 0. However I keep getting an error stating that there is an invalid operator. Please help...

McDoom

  • Guest
Re:Detecting if all units in a group are dead
« Reply #1 on: 15 Jan 2003, 12:56:59 »
condition needs to be "==0", or you could use "<1".  But I just noticed that "=" is for the On Activation, etc. and "==" is to test a condition.  This should help.  good luck.

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:Detecting if all units in a group are dead
« Reply #2 on: 15 Jan 2003, 19:08:20 »
Your description of what you did is unclear, so I'll tell you from scratch how to check if every unit in a group is dead.

1. In the Initialization field of the group's leader, put the following code:

east1 = group this

2. Create a trigger, and in the Condition field, put the following code:

east countSide (units east1) < 1

3. In the trigger's On Activation field, make something happen.

Explanation:

Step 1 defines the name of the group.  In this example, I called the group "east1".

Step 2 creates a trigger that checks if there is less than 1 unit alive in the east1 group.  Less than 1 obviously means 0 or less.  In other words, that they are all dead.

Step 3 makes something upon all units in east1 being dead.

From your post, it sounds like you actually have 2 groups for which you want to check if everyone is dead.  If that is so, simply repeat step one for each group that you want to check, but change the group name for each group.  E.g., east1 and east2.  You will only need a single trigger to check if everyone is dead if you use the following code in the Condition field:

east countSide (units east1) < 1 and east countSide (units east2) < 1

This will check if there are 0 or less units alive in east1, and 0 or less units alive in east2.

Good luck.
Ranger

Ahbenshaut

  • Guest
Re:Detecting if all units in a group are dead
« Reply #3 on: 16 Jan 2003, 02:46:59 »
Thanks..That helps alot :D