OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: NightJay0044 on 22 Jan 2009, 07:13:15

Title: Count Units command
Post by: NightJay0044 on 22 Jan 2009, 07:13:15
HI all, I generated a small script using the count units command. here is the code I generated in a trigger:

Quote
Conditon: (count units group1) < 4
Onactivation: E1 Setdammage 1

basically what I did is inserted a group:

group1 = group this

inserted another soldier, naamed it E1, but it's a west soldier. (purposes of not being shot at)

the group has 5 soldiers..basicall what i did, was once there was less then 4 soldiers in group1, E1 would die.lo but hey I tested it and it worked only when I shot all the soldiers in the group.

If I used a grenade the game didnt' recognize the command when I blew up 4 soldiers up at once, why is this? Is it because the game cannot respond that fast with that command?

But it works fine if I shoot the soldiers but not if I blow them up with a grenade...

 :)

Title: Re: Count Units command
Post by: Walter_E_Kurtz on 22 Jan 2009, 17:29:05
I think it's to do with dead units still being considered part of a group, until a team-mate says "Oh no, number is down." At which point they are removed from the group, and the count drops correspondingly.

Try using an alternative format for the Count command (http://www.ofpec.com/COMREF/index.php?action=details&id=78):

Code: [Select]
({alive _x} count units group1) < 4


Edit: corrected syntax (it is necessary to use units group1 to create an array) and tested.