OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: NoMore on 04 Dec 2009, 08:36:32

Title: Trigger condition problem..
Post by: NoMore on 04 Dec 2009, 08:36:32
Ok here is my problem:
I have two triggers and one of them has the condition field:
Code: [Select]
this && not(GrpSpot)And activation:
Code: [Select]
secondOBJ=true
The second trigger has the codition:
Code: [Select]
this && not(secondOBJ)And activation
Code: [Select]
GrpSpot=true
I'm very unsure of the "&& not(GrpSpot)" parts of the conditions...
But what am I doing wrong?  :dry:

And any suggestions for a subject name..?
Title: Re: Trigger condition problem..
Post by: bedges on 04 Dec 2009, 14:33:20
The syntax looks okay to me, although you probably need to initialise the variables GrpSpot and secondObj as false in your init.sqs for the triggers to work properly.

You could also write the trigger condition without brackets as

Code: [Select]
this && not GrpSpotor
Code: [Select]
this && !GrpSpot
What exactly isn't working about it?
Title: Re: Trigger condition problem..
Post by: THobson on 08 Dec 2009, 21:50:50
You might find it easier to read if you used and instead of &&:

this and not GrpSpot.

My guess is bedges as has it right.  You need to initialise the varaiables first.  Any condition that includes an undefined varaible will return a False

So the condition in both:

If undefined_variable then {...}
and
If not undefined_variable then {...}

Will return false and the neither block of code will be run.



Title: Re: Trigger condition problem..
Post by: JasonO on 06 Jan 2010, 16:21:25
You don't need the 'this' part in the condition unless someone will actually be walking into the trigger and activiating it.
If that is the case then ignore me. However, if its just the case of having a trigger on the side to check a variable condition and running some code after it becomes true; you do not need the 'this' part.

So the two conditions would just be:

not(GrpSpot)

and

not(secondOBJ)

I know I probably bumped this but I'm pretty sure that is the problem if you are using the trigger for what I said.