Home   Help Search Login Register  

Author Topic: Trigger syntax  (Read 1204 times)

0 Members and 1 Guest are viewing this topic.

rOk

  • Guest
Trigger syntax
« on: 12 Aug 2004, 09:31:46 »
Hi all

Another editing question I'm afraid. Here goes

I have 4 west loons in captive state. It's enough if you only save 1. Now what I want is that a variable becomes true if anyone (or all or anything in between) of them enters a specific trigger area.
They're each in their own group.
I know the variable part, I just don't know the syntax for the condition/s mentioned above.

Thanks

Offline Mud_Spike

  • Contributing Member
  • **
Re:Trigger syntax
« Reply #1 on: 12 Aug 2004, 09:46:10 »
Three solutions comes to mind:

(The four units are named u0, u1, u2, u3)

1) Make a trigger with West Present, in the Condition field write:
Code: [Select]
this && ("_x in thislist" count [u0,u1,u2,u3]) > 0
2) Make four triggers, West Present, then group each one with one of the units. (non-scripted approach)

3) Make a trigger, 0 radius, (or have it spinning in a script (with @<condition>)), in the condition field write:
Code: [Select]
"_x distance safe_obj < 50" count [u0,u1,u2,u3] > 0
Where safe_obj is an object in the center of what you feel is safe-ground.

None of the syntax is guaranteed.

rOk

  • Guest
Re:Trigger syntax
« Reply #2 on: 12 Aug 2004, 11:11:15 »
Thanks Mud_Spike

The first one works like a charm, had 4 triggers already but I'm trying to cut down on the numbers of them.

Now there's another problem

When the loon comes there variable turns to true, however in another trigger which has the condition this variable = true and someone not alive and end #1 there is no end.
Any thoughts?
Thanks

Offline Mud_Spike

  • Contributing Member
  • **
Re:Trigger syntax
« Reply #3 on: 12 Aug 2004, 11:16:58 »
And it goes like this?
Condition:
Code: [Select]
variable == true && not alive unitX
Then it should work, if not, try to separate it further, have another trigger just checking 'not alive unitX', hint "":ing, setting a variable, and then use that variable in your trigger.. 'var==true&&isdead==true'.
If that works and the above doesnt, something is fishy.


rOk

  • Guest
Re:Trigger syntax
« Reply #4 on: 12 Aug 2004, 11:47:50 »
Nope, no joy.

All of it has a problem with "==" it says "type any; expected number, string, object...


Separating them into 2 different + the ending trigger doesn't work also.


Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Trigger syntax
« Reply #5 on: 12 Aug 2004, 12:05:53 »
myVariable = true  -   assigns to the variable the value true

myVariable             - what you put in a condition line if you want the trigger to fire when the variable is true

myVariable and (not alive loon1)    - see above

myVariable == true    -  not used in OFP
« Last Edit: 12 Aug 2004, 12:06:12 by macguba »
Plenty of reviewed ArmA missions for you to play

rOk

  • Guest
Re:Trigger syntax
« Reply #6 on: 12 Aug 2004, 12:39:31 »
Argh...

I feel so stupid. I should have known this. Anyway works great.
Thanks both of you

Just one quickie left:

This isn't MP ready right?
Where do I need to declare this a public variable?

Offline Mud_Spike

  • Contributing Member
  • **
Re:Trigger syntax
« Reply #7 on: 12 Aug 2004, 15:20:37 »
Oops, sorry about that.

Offline Wadmann

  • OFPEC Patron
  • ****
  • I'm the next evolutionary step after a llama!
Re:Trigger syntax
« Reply #8 on: 12 Aug 2004, 16:24:42 »
Hey rOk!

I am not a MP scripter, but I have seen publicVariable's declared in the init.sqs of some MP mission that I have unPBOed. Hope this helps!

                                                                         Wadmann
Check out my Camouflage Collection! New items added 31 July 2005.

Dubieman

  • Guest
Re:Trigger syntax
« Reply #9 on: 12 Aug 2004, 16:37:08 »
I've heard its best to define every variable in the init.sqs, like

manv = false
captive = false
dude = true

You know, set the starting postion for the variable, true or false...

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Trigger syntax
« Reply #10 on: 12 Aug 2004, 17:09:20 »
It is not always necessary to initialise every variable in init.sqs or elsewhere.     The important thing is to realise that when the game meets an initialised (or undefined) variable it treats the whole expression (not just the variable) as false.

PublicVariable is for when you want the value of a variable to be sent to all computers in MP.    You can use publicvariable whenever you like, it doesn't have to be in init.sqs.  
Plenty of reviewed ArmA missions for you to play

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:Trigger syntax
« Reply #11 on: 12 Aug 2004, 17:09:28 »
Now now, let's not get too complicated.

If you want to know if ANYONE from a group is in a trigger radius, you GROUP the trigger to the group leader and after that select ANYONE from the trigger's activation options.


Trigger actions are run on all clients (if not told otherwise) so you don't have to worry about publicvariable. Everyone will know the mission is over if a trigger launches it.
So the whole thing would go:

* Artak reads the first post again
eh.. erm..
Ok, so I missed the part where you say they're all in their own groups. Scrap the rest but note the publicvariable thing.  ;D
Not all is lost.

rOk

  • Guest
Re:Trigger syntax
« Reply #12 on: 12 Aug 2004, 17:52:15 »
So basically what you're saying is, that if a variable status gets changed in the trigger there's no need to declare it as a PublicVariable?  ???

@macguba or anyone who knows:

Quote
The important thing is to realise that when the game meets an initialised (or undefined) variable it treats the whole expression (not just the variable) as false.

But what if it's as simple as GuiltyRoachKillar said?
ie:
Dude=false
From what I understand this is the whole expression and if it is, what would change then?
Hope I'm making some sense here.

Thanks all

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Trigger syntax
« Reply #13 on: 12 Aug 2004, 18:08:27 »
dude=false

does indeed define (or initialise) the variable "dude".

The point is that if dude has not been initialised the following expressions all return false:-

dude

not dude

dude or (not dude) or true
Plenty of reviewed ArmA missions for you to play

Offline Mud_Spike

  • Contributing Member
  • **
Re:Trigger syntax
« Reply #14 on: 12 Aug 2004, 18:58:52 »
Trigger actions are run on all clients (if not told otherwise) so you don't have to worry about publicvariable. Everyone will know the mission is over if a trigger launches it.

Is the trigger Action or the trigger itself (i.e., Condition which then maybe fires the Action) being executed on all clients?

I think I read somewhere a long time ago that triggers are only triggered on the server, in that case, the client would have to use publicVariable for the trigger to fire, and everyone is brought up to date automagically.