Home   Help Search Login Register  

Author Topic: group dead?  (Read 962 times)

0 Members and 1 Guest are viewing this topic.

Offline 456820

  • Contributing Member
  • **
group dead?
« 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?

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:group dead?
« Reply #1 on: 23 Dec 2004, 18:46:53 »
"!(alive _x)" foreach units groupname
as for the vehicle....  ???

Offline 456820

  • Contributing Member
  • **
Re:group dead?
« Reply #2 on: 23 Dec 2004, 18:55:16 »
ok thankyou and do you know why i had the other problem

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:group dead?
« Reply #3 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
« Last Edit: 23 Dec 2004, 19:06:53 by Triggerhappy »

Offline 456820

  • Contributing Member
  • **
Re:group dead?
« Reply #4 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

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:group dead?
« Reply #5 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

Offline 456820

  • Contributing Member
  • **
Re:group dead?
« Reply #6 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

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:group dead?
« Reply #7 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.
« Last Edit: 24 Dec 2004, 13:41:51 by THobson »

Offline 456820

  • Contributing Member
  • **
Re:group dead?
« Reply #8 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

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:group dead?
« Reply #9 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.

« Last Edit: 24 Dec 2004, 13:56:56 by THobson »

Offline 456820

  • Contributing Member
  • **
Re:group dead?
« Reply #10 on: 24 Dec 2004, 13:55:49 »
oh ok thanks

Offline 456820

  • Contributing Member
  • **
Re:group dead?
« Reply #11 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"

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:group dead?
« Reply #12 on: 24 Dec 2004, 19:06:21 »
no, you would do:
{alive _x} count units <groupname> == 0

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:group dead?
« Reply #13 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