OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: 456820 on 01 Apr 2005, 09:42:57

Title: foreach this group
Post by: 456820 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
Title: Re:foreach this group
Post by: THobson 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
Title: Re:foreach this group
Post by: 456820 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
Title: Re:foreach this group
Post by: THobson 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.
Title: Re:foreach this group
Post by: 456820 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
Title: Re:foreach this group
Post by: THobson 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.
Title: Re:foreach this group
Post by: 456820 on 01 Apr 2005, 19:14:10
thanks that works