OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: tcp on 25 Aug 2009, 18:34:01

Title: Using AND and OR together in a conditional
Post by: tcp on 25 Aug 2009, 18:34:01
I created a trigger with ((getpos (thislist select 0)) select 2 > 1) && (("Plane" countType thislist  > 0) || ("Helicopter" countType thislist  > 0)) as the condition. It works with just the OR statement but not with the AND statement added.
Title: Re: Using AND and OR together in a conditional
Post by: Mandoble on 25 Aug 2009, 18:45:51
Try changing:
Code: [Select]
((getpos (thislist select 0)) select 2 > 1)--->
(((getpos (thislist select 0)) select 2) > 1)

Anyway, this might generate errors as if the trigger area is empty, then thisList is empty and then (thislist select 0) is not possible.
Title: Re: Using AND and OR together in a conditional
Post by: tcp on 25 Aug 2009, 20:39:44
Thanks for the reply, I found out that I just had a wrong name for something in the trigger. So both the original and the correction work.

BTW, I now have a cool trigger to have a light next to a service point turn off when planes or helicopters come close, turn it on during the repair, and back off again when they start to leave. Had to use isEngineOn instead of the getpos height. It looks like this:

Condition:
((("Plane" countType thislist  > 0) || ("Helicopter" countType thislist  > 0))) && (isEngineOn (thislist select 0))
On Act:
tlight1 action ["lightOff", tug1];
On Dea:
tlight1 action ["lightOn", tug1];

tlight1 is the game logic orginally used to turn the lights on in the empty tug.
tug1 is the tug.