Home   Help Search Login Register  

Author Topic: how to end a mission when all are dead?  (Read 1257 times)

0 Members and 1 Guest are viewing this topic.

Cool Hand

  • Guest
how to end a mission when all are dead?
« on: 24 Jan 2003, 17:38:43 »
Im having a problem right now. mission almost done but I cant figure out this problem:
I want to make a trigger which will end the mission when all PLAYERS are dead. right now I am using not alive player1 and not alive player2... etc
but it wont work when there are free slots which arent used by either a human player or an AI. the mission wont end even if all players are dead, because the trigger looks for the other slots too, which arent played...
is there a solution available for this?

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:how to end a mission when all are dead?
« Reply #1 on: 24 Jan 2003, 18:12:41 »
Try doing the following things:

1. Name the group that contains the players.  To name a group, put the following code in the initialization field of the group's leader:

squad1 = group this

2. In your trigger's Condition field, put the following code:

west countSide (units squad1) < 1

Change west to whatever side the units are on if they aren't on west.

This code will count how many units in the group "squad1" are alive on the west side.  If there is less than 1 (i.e., 0) alive, then the trigger will activate.

If you want specifically to check if a unit is human controlled vs. AI controlled, you'll have to use a script for that.  Let me know if that's what you want instead.
Ranger

Cool Hand

  • Guest
Re:how to end a mission when all are dead?
« Reply #2 on: 24 Jan 2003, 18:40:16 »
no, this is working well for me. thanks a lot!