OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: tai mai shu on 02 Sep 2002, 07:01:47
-
hi.
i was wondering , how do i (without using scripts) use the "foreach thislist" command inside of the condition field of triggers???
for example: how do i make a trigger go off when any person in a group (an array of units) is in a vehicle? and then if this is true, single out THAT guy and pass it to a script (or make that person perform an action or command)?
so basically what im thinking is this:
condition : ? ("_x in vehicle1" foreach group1)
activation : (guy who is in the vehicle) action ["eject"]
any help will be appreciated, as this is an important command for use in scripting and other stuff.
-
You can use "foreach" as a command, but not as a
condition.
In condition you need to use the count command.
"_x in vehicle1" count (units group1) == count (units group1)
: this condition expects all units of group1 to be inside vehicle1
"_x in vehicle1" count (units group1) > 0
: this condition expects at least one of the group to be inside
For your activation field, you might need a little trickier thingy.
You can pass the cargo of that vehicle into an array, and
execute the eject command foreach your_array.
invehiclearray=crew vehicle1 - driver vehicle1
followed by your eject action foreach invehiclearray
~S~ CD
-
damn. i wish i knew C++, that most likely explains how to handle arrays like this. ??? :-\ >:(
-
d**n. i wish i knew C++, that most likely explains how to handle arrays like this
:D nope - that's generally the basics of any programmer's
language in combination with some mathematics
~S~ CD
-
exactly. it has a LOT to do with arrays and such.
-
erm, can anyone help?
-
If you have a vehicle named "vehcle1" and you want to eject everyone inside, the code would be as follows:
"_x action [""EJECT"", (vehicle _x)]" foreach crew vehicle1