OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: RT-SuperTron on 21 Aug 2002, 21:24:40

Title: Array in Condition field?
Post by: RT-SuperTron on 21 Aug 2002, 21:24:40
 :D

Weee, I just wanna know how the f.....something I can make an array in the Condition field work.

exmpl.

Condition: ? Player in VehicleName

If I have several Vehicles for witch this condition must go, how should I put it in the Condition. ::) For some odd reason I cant make it work.

Thnx

[RT]SuperTron
Title: Re:Array in Condition field?
Post by: Wolfrug on 21 Aug 2002, 21:30:53
Hm, well, if you've got a host of different vehicles and each person must go into their separate vehicle, there's really no "easy" way to do this (as in with a forEach command). You'd have to put:

aP in Vehicle1 AND aB in Vehicle2 AND aC in Vehicle 3

Or, I suppose, depending on the situation, you could synchronize the "get In" waypoint with the trigger (or possible a Move waypoint right ahead of the vehicle, activating as soon as the Get In waypoint is complete -> after the person is in the vehicle), or put a small aBIn=true into the On Activation field of each waypoint. But that would be just as much work, so the whole string of AND's is probably the best.

If it was something else you wanted, please elaborate  :D

Wolfrug out.
Title: Re:Array in Condition field?
Post by: seanver on 21 Aug 2002, 21:31:53
you mean you want something like: player in vehicle AND player2 in vehicle AND player3 in vehicle2

??
Title: Re:Array in Condition field?
Post by: RT-SuperTron on 21 Aug 2002, 22:00:35
 :o

D**n the F*****s are fast too.

You are on my trail but not quite so let me xplain a little further.

Im toying with some scripts for the "Comcag" witch you can obtain at www.operation-flashpoint.dk

This script is light version of some heavy "radio" scripting and the idea is that only the units present in the Comcag's can see other units on the "map", kinda like a radar system. So if you are in a comcag you can see and comunicate with other units, and if you are not then..."bad luck guys, last boat outa here leaves at 5.15, but i guess you'll never know  ;D"

Therefor the units/players dont have to be in the comcags at the same time.

It seams that if I use ..

Condition: ? Player in Cag1 OR Player in Cag2 OR Player in Cag3

It will only work with one of them..

[RT]SuperTron
Title: Re:Array in Condition field?
Post by: Bremmer on 21 Aug 2002, 22:26:00
Untested, by I think it should work:

Declare an array of all the vehicles you are interested in in your init file. eg.

vehs = [car1,car2,tank1,tank2,boat1,boat2]

Don't forget to name the vehicles in the editor. Set up a repeating trigger with condition:

(vehicle player) in vehs

Now whenever you get in one of the vehicles you declared the trigger will be true, and false when you get out again.

Cheers
Title: Re:Array in Condition field?
Post by: Chris Death on 22 Aug 2002, 00:15:09
Quote
vehs = [car1,car2,tank1,tank2,boat1,boat2]

               Don't forget to name the vehicles in the editor. Set up a repeating trigger with condition:

               (vehicle player) in vehs

Bremmer, i think this condition will only check, if the variable "player" can be found
in array "vehs"

It would become true, if vehs=[car1,car2,player,tank1,tank2,etc.]

In this case, it would be false.

But probably could work:

"player in _x" foreach vehs

If not, you could try to capture the vehicles with a trigger (to get in use of trigger_list),
and then the condition should work:

"player in _x" foreach list trigger_name

:edit - but then again, i noticed: (vehicle player) in Bremmer's reply - yep, that should work aswell
 - sorry Bremmer.

~S~ CD
Title: Re:Array in Condition field?
Post by: Sui on 22 Aug 2002, 06:44:47
What you're after is the count command... it's kind of the equivelent of foreach in a condition field:

"player in _x" count [veh1,veh2,veh3] > 0

Throwing that into a condition field of a trigger will make it go off if the player jumps into one of the vehicles in the bold array. You can either add more vehicles there, or as Bremmer suggested, create an array in the init.sqs or where ever is more convenient and use that
Title: Re:Array in Condition field?
Post by: tai mai shu on 22 Aug 2002, 08:04:09
damn, you moderators are ofp gods!!!!  :P  ;)  ;D, but than again, thats probly why your mods on the best ofp sditing website on the planet
Title: Re:Array in Condition field?
Post by: Chris Death on 22 Aug 2002, 17:45:53
huh - yeah off course it's count, not foreach.

Anybody seen my head laying around?  :D

~S~ CD
Title: Re:Array in Condition field?
Post by: Artak on 28 Aug 2002, 19:57:16
#Problem solved! Nice  :D