Home   Help Search Login Register  

Author Topic: foreach this group  (Read 1090 times)

0 Members and 1 Guest are viewing this topic.

Offline 456820

  • Contributing Member
  • **
foreach this group
« on: 01 Apr 2005, 09:42:57 »
most people will know the {this _x) moveincargo car1 foreach this group
thing but how is it actually written as i know that is wrong
and also what are the other kind like for each this list
and so on

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:foreach this group
« Reply #1 on: 01 Apr 2005, 10:04:49 »
{_x moveInCargo vehiclename} forEach units groupname

what comes after forEach needs to be a list of things, in otherwords it needs to be an array.

whatever is between the { } with be actioned once for each item in the list and _x will be replaced by that item
« Last Edit: 01 Apr 2005, 10:07:31 by THobson »

Offline 456820

  • Contributing Member
  • **
Re:foreach this group
« Reply #2 on: 01 Apr 2005, 10:06:06 »
thanks you for that and do you know any og the other kind of them that are used like for whole sides and just certain units

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:foreach this group
« Reply #3 on: 01 Apr 2005, 10:09:57 »
I was editing while you were posting so read my first reply again.

For whole sides you need to set up a trigger that covers the map of the type:
west present
call it something like: trigAllWest

then:

{whatever _x} for each list trigAllWest

At least that is how I do it.

Offline 456820

  • Contributing Member
  • **
Re:foreach this group
« Reply #4 on: 01 Apr 2005, 10:13:06 »
oh cool thanks for that
any other things thatcan be used like that would be very handy
and also how can i have an or
like
not alive civi1 or not alive civi2
that doesnt seem to work for me but i want a trigger to fire when one of 5 civillains are dead and i dont want to create 5 different triggers cause then it will just get confusing

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:foreach this group
« Reply #5 on: 01 Apr 2005, 11:35:35 »
You could use an event handler.  To use a trigger have the condition:

not (alive loon1) or not (alive loon2) or not (... you getthe idea

I think your porblem was the lack of brackets.  I find it a good idea to put brackest around anything that shoul dwork out to be either true ir false.

Offline 456820

  • Contributing Member
  • **
Re:foreach this group
« Reply #6 on: 01 Apr 2005, 19:14:10 »
thanks that works