OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: 456820 on 23 Dec 2004, 18:34:31

Title: group dead?
Post by: 456820 on 23 Dec 2004, 18:34:31
how do you check if a group is dead or a vechile i usually put "(count units groupname == 0) and (not canmove vechile name) they used to work im sure everything is correct but when i use it and i kill all the groups and vechiles it doesnt activate the trigger? so is there a different way of checking if agroup or vechile is down wich will activate a trigger?
Title: Re:group dead?
Post by: Triggerhappy on 23 Dec 2004, 18:46:53
"!(alive _x)" foreach units groupname
as for the vehicle....  ???
Title: Re:group dead?
Post by: 456820 on 23 Dec 2004, 18:55:16
ok thankyou and do you know why i had the other problem
Title: Re:group dead?
Post by: Triggerhappy on 23 Dec 2004, 19:06:28
perhaps just a syntax problem when you tried it? idk
for the vehicle, i noticed your syntax is wrong:
not (or !)...
not(canmove vehicle) or
!(canmove vehicle)
try it
Title: Re:group dead?
Post by: 456820 on 23 Dec 2004, 19:29:10
i took the two things i use from a tut mission in editors depot the mission or have i have had any problem with it till now
Title: Re:group dead?
Post by: Triggerhappy on 23 Dec 2004, 20:38:39
hmmm... i have no clue what the problem is, unless you recently got a new version and it doesn't use the not command (it is considered a command, right?) but rather the !
just a wild guess, but i doubt it
Title: Re:group dead?
Post by: 456820 on 24 Dec 2004, 09:04:53
i dont think so but if i 4x the game and wait for ages then the trigger activates i was thinking how it says (count units) means when the player sees all the units dead but i dont think so  and the (not canmove) one works most of the time but still doesnt all
Title: Re:group dead?
Post by: THobson on 24 Dec 2004, 13:40:57
count units can take ages to recognise that units are dead especially if the group has been wiped out.  Better is something like

{alive _x} count units <groupname>

But that was pretty much Triggerhappy's first post so if you are using that I don't see what the problem is.
Title: Re:group dead?
Post by: 456820 on 24 Dec 2004, 13:46:08
is the {} and <> needd or does it have to be {alive_x} count units <groupname> wat is the x for
Title: Re:group dead?
Post by: THobson on 24 Dec 2004, 13:54:16
type it exactly as shown except instead of <groupname> just put the name you have given to the group   I put <> around it to show that is is not an instruction.

_x is a reserved variable that takes on each of the values in the array units <groupname> in turn.  

To explain the instruction in full:

<groupname> is the name you have given to a group
units <groupname> is an array of all the units in the group
count units <groupname> is the number of units in the group

But note that it can include dead units that have not yet been removed from the group.

Putting {alive _x} in front of the count tells OFP only to count units that are alive

In general:
 {condition} count array

will count the number of units in the array for which the condition is true.

Title: Re:group dead?
Post by: 456820 on 24 Dec 2004, 13:55:49
oh ok thanks
Title: Re:group dead?
Post by: 456820 on 24 Dec 2004, 18:40:07
hang on so wouldnt you change the x to 0 so it say's "groupname number of people alive = 0 so therefore activates the trigger"
Title: Re:group dead?
Post by: Triggerhappy on 24 Dec 2004, 19:06:21
no, you would do:
{alive _x} count units <groupname> == 0
Title: Re:group dead?
Post by: THobson on 24 Dec 2004, 19:42:32
Thank you Triggerhappy.

Let us give a worked example so there can be no further misunderstanding.

In the init field of your group leader put:
Grp1 = group this
This gives your group the name Grp1

In your trigger's activiation field put:
{alive _x} count units Grp1 == 0

This is topical at the moment.  Have a look at:
http://www.ofpec.com/yabbse/index.php?board=6;action=display;threadid=21106 (http://www.ofpec.com/yabbse/index.php?board=6;action=display;threadid=21106)