Home   Help Search Login Register  

Author Topic: group in vehicle  (Read 1048 times)

0 Members and 1 Guest are viewing this topic.

Offline bardosy

  • Honoured Contributor
  • ***
  • campaign designer
    • CartooDiv
group in vehicle
« on: 31 Aug 2005, 08:15:36 »
Sorry for newby-question, but I can't find answer in my downloaded documentations.

How can I know, if a whole group is in a vehicle?

I have a trigger and I want put an expression in the Condition field, like

group(player) in heli1
or
units group(player) in heli1

^these doesn't work, just I want explain what is my question.

Finally I use: (u1 in heli1)and(u2 in heli1)and...    where u1,u2,u3... are the names of group member.
It's works, but I feel there is some better solution.
Fix bayonet!

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:group in vehicle
« Reply #1 on: 31 Aug 2005, 08:21:25 »
Code: [Select]
count ({_x in vehicle_name} count units group group_name) == count units group group_name
syntax not guaranteed  ::)

Offline bardosy

  • Honoured Contributor
  • ***
  • campaign designer
    • CartooDiv
Re:group in vehicle
« Reply #2 on: 31 Aug 2005, 08:23:00 »
Thank you!!! I'll try it!!!

Fix bayonet!

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:group in vehicle
« Reply #3 on: 31 Aug 2005, 09:15:02 »
I thnk bedges meant:

{_x in vehicle_name} count units group_name) == count units group_name

That will work  if you know the name of the vehicle.  If you  don't or if the group may be spread across different vehicles try:

{_x != vehicle _x} count units groupname

will return the number that are in any vehicle.  So the test would then be:


{_x != vehicle _x} count units groupname == count units groupname

So many ways to do the same thing
« Last Edit: 31 Aug 2005, 09:18:22 by THobson »

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re:group in vehicle
« Reply #4 on: 14 Sep 2005, 18:12:50 »
There is now a function in the function library to do this checking. It can check if all group members are in any vehicle (not necessarily in the same vehicle), or it can check if all group members are in one specific vehicle.

Follow this link:

groupInVehicle



« Last Edit: 14 Sep 2005, 18:13:44 by Baddo »

Kyle Sarnik

  • Guest
Re:group in vehicle
« Reply #5 on: 14 Sep 2005, 20:51:02 »
I thnk bedges meant:

{_x in vehicle_name} count units group_name) == count units group_name

Carefull now, don't wanna get a missing "(" error, you best close those parentheses  ;)
« Last Edit: 14 Sep 2005, 20:51:48 by Kyle Sarnik »

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:group in vehicle
« Reply #6 on: 14 Sep 2005, 20:57:10 »
True enough - sloppy cut and paste on my part.  :-[ I got rid of 'count (' but neglected to get rid of the closing ')'.  It should of course be:


{_x in vehicle_name} count units group_name == count units group_name

« Last Edit: 14 Sep 2005, 20:57:25 by THobson »

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:group in vehicle
« Reply #7 on: 14 Sep 2005, 22:03:41 »
i should also put my hands up and admit my responsibility - they were after all my parentheses to begin with... :-[

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:group in vehicle
« Reply #8 on: 14 Sep 2005, 22:12:34 »
yet again a correction, not exactly necessary, but possibly vital depending on the situation....:

{_x in vehicle_name} count units group_name == {alive _x} count units group_name


because if someone in the group dies, it might not register (and remove them from the group) until long after, but the whether they are alive (or dead) is always known

like i said, not absolutely necessary, but very good to have

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:group in vehicle
« Reply #9 on: 14 Sep 2005, 22:53:52 »
Good catch.  :thumbsup: It's missing things like this that causes those strange bugs we all struggle over.

EDIT:

On further thought should it be:

{(_x in vehicle_name) and (alive _x)} count units group_name == {alive _x} count units group_name

Just in case a dead loon in the vehicle gets counted?
« Last Edit: 14 Sep 2005, 23:07:29 by THobson »

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:group in vehicle
« Reply #10 on: 15 Sep 2005, 00:16:04 »
didn't think of that, althought the chances of something like that are incredibly slim, but, better safe than sorry :P

Offline bardosy

  • Honoured Contributor
  • ***
  • campaign designer
    • CartooDiv
Re:group in vehicle
« Reply #11 on: 15 Sep 2005, 07:49:35 »
Thanks for the correct answer guys!
Fix bayonet!