OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: greg147 on 18 Feb 2005, 10:38:26
-
Hi all,
How do I make a trigger ([player] join group man) only activate if another trigger has been activated.
Like, a trigger that activates only when the player is within its area, and has completed the last trigger. ;)
Thanks
-
When the first trigger fires you set a variable to true.
Then use that variable in the condition field in the second trigger. For example...
Condition: This AND myVariable
Instead of just
Condition: This
-
Use variables to communicate between triggers. For example:-
Trigger1
Activation: as you like
On activation: trig1=true; blah blah
Trigger2
Activation: trig1 and (blahdy blah)
Trigger2 can fire only if trigger 1 has already fired.
-
Hmmm.....I must be doing this wrong. This is what I have:
Trigger 1
Name: trig1
Radio alpha
Activation: trig1= true; a1 sidechat "blah"
Condition: this
Trigger 2
Name: trig2
West present
Activation: guy setdamage 1
Condition: trig1=true and this
But its not working. How do I fix it? :-[
-
Name: trig2
West present
Activation: guy setdamage 1
Condition: trig1=true and this
should be
Name: trig2
West present
Activation: guy setdamage 1
Condition: trig1 and this
when using a bool as a condition you only need to put the varible name and not bool1=true
-
In OFP code,
= means "set one thing equal to another"
== means "check and see if these two things are the same"
Except with booleans you don't need the ==, you just need the variable name as StonedSoldier right says.
It's all in the comref.
-
OK, corrected it as Stoned Soldier said, but it still doesn't work. I got this error when I started the mission:
'trig1 and this |#|': Error and: Type Object, expected Bool
And then the trigger didn't work at all. Either of them :-[
-
You are using trig1 as the name for a trigger and also the name of a variable. Try the following:
Trigger 1
Name: (leave blank)
Radio alpha
Activation: trig1= true; a1 sidechat "blah"
Condition: this
trig1 is now a variable. Note it is good practice to set trig1 = false at the start of the mission. It will have no effect here, but if later you want another trigger to fire on:
this and not trig1
then failing to initialise trig1 will cause a problem.
Trigger 2
Name: (leave blank)
West present
Activation: guy setdamage 1
Condition: trig1 and this
You only need to give triggers names if you want to access them in someway from somewhere else - for example if you want to move them or get a list of the units that triggered them.
-
OK, thanks ;D
-
No no no it's
Code:
Trigger 1
Name: trig1
Radio alpha
Activation: trig1= true; a1 sidechat "blah"
Condition: this
Trigger 2
Name: trig2
West present
Activation: guy setdamage 1
Condition: this && trig1=true
-
inblow, what are you trying to say? I think you may have posted the original, wrong, code.
-
all i'm trying to say is that AND is replaced by &&
well thats what i do && always work with me
-
and is easier to understand than &&
or is easier to understand than ||
not is easier to understand than !
But they all work!
You are still suggesting that the triggers are given names and that these names match the names of variables - it will never work.