OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: wastzzz on 30 Aug 2006, 02:40:46

Title: refering to a trigger's name to know if it's been activated?
Post by: wastzzz on 30 Aug 2006, 02:40:46
is there a way to catch the boolean value that sets up when a trigger gets activated (assuming the trigger has got a name)?
i have a trigger named "trg1" with condition set on True, countdown 5 secs; then i have another trigger named "trg2".
i would like to activate trg2 when trg1 activates, but setting trg2's condition to "trg1" doesn't work.
i know how to do it in other ways, but i was wondering if i could get this one to work as well.

cheers,
wast
Title: Re: refering to a trigger's name to know if it's been activated?
Post by: THobson on 30 Aug 2006, 08:47:03
Rather than trying to access the trigger directly in this way it is more normal to create your own boolean that is set when the first trigger fires by putting something like:
trig1Fired = true
in the on Activation field of the first trigger.  Note: trig1Fired is any name you wish to give it.

When using booleans in this way it is very good practice to initialsie their values at the start of the mission.  For example in init.sqs put:
trig1Fired = false

The reason for this is that any boolean expression that makes use of an undefined variable will always resolve to false.

So in your case if you wanted to allow something to happen if the first trigger had not fired then you might use:
not trig1Fired

but if trig1Fired is undefined then both trig1Fired  and not trig1Fired will be false!
Title: Re: refering to a trigger's name to know if it's been activated?
Post by: wastzzz on 30 Aug 2006, 10:55:00
ye that was the way i always used to do, but thanks anyway for the quick reply :)
Title: Re: refering to a trigger's name to know if it's been activated?
Post by: Chris Death on 30 Aug 2006, 15:42:03
Well, there's one other way, if you want avoid using booleans;

Place a gamelogic and give it two waypoints
Syncronize the first waypoint with the trigger you want check for it's status
and lead the second wayoint into the second trigger's area
Now group the gamelogic with the second trigger so that it
will activate trigger 2 after trigger 1 let it pass.  ;)

~S~ CD