Home   Help Search Login Register  

Author Topic: Detecting multiple AI geting killed  (Read 766 times)

0 Members and 1 Guest are viewing this topic.

Wolf

  • Guest
Detecting multiple AI geting killed
« on: 04 Dec 2002, 21:12:41 »
Ok, here's my problem, I need to prevent the player from firing at some specific AI for a short time, so, instead of connecting every single AI  with a not present trigger, can I use the
Not (alive guyname)
in some sort of array, to detect when any one of the AI are dead its failed?
ex. Not (Alive [Guy1, guy2, guy3, etc . . . ]) so that when any one of them are dead, its mission failed.

Or any way possible to do this?
Thank you.

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:Detecting multiple AI geting killed
« Reply #1 on: 04 Dec 2002, 21:57:46 »
You need to use the count command.  This is easiest to do if you have each of those AI units in one group.

In the initialization field of the leader of the group, put the following code:

Code: [Select]
squadUnits = units (group this)
This creates an array, squadUnits, that contains a list of every unit in that group.

Then, put the following code in the condition field of a trigger:

Code: [Select]
"not alive _x" count squadUnits > 0
This checks to see if there is at least 1 dead unit in that group, and if so, the condition is met.

If you do not have all of the AI in one group, you can still use this code, but you must instead manually create an array with a list of the units.

E.g.:

Code: [Select]
squadUnits = [guy1,guy2,guy3]
This code can be placed in the initialization field of any one of those units, or in your init.sqs for the mission.  The trigger's condition would remain the same.
« Last Edit: 04 Dec 2002, 22:00:34 by Ranger »
Ranger

seanver

  • Guest
Re:Detecting multiple AI geting killed
« Reply #2 on: 04 Dec 2002, 21:57:50 »
!(alive guy1) OR !(alive guy2) OR !(alive guy3), etc

Try that

Wolf

  • Guest
Re:Detecting multiple AI geting killed
« Reply #3 on: 04 Dec 2002, 23:10:11 »
You see, I have roughly 15 guys walking around or standing guard, none of them are grouped, so I'll see which one works best, thanks.