Home   Help Search Login Register  

Author Topic: Trigger Conditions...??  (Read 2102 times)

0 Members and 1 Guest are viewing this topic.

Offline ahmed117

  • Members
  • *
  • The 3d!t0R -=I.S.I=-
Trigger Conditions...??
« on: 19 Jan 2012, 09:31:20 »
Guys, I need some information about the trigger conditions... The question is... that I want a trigger to be activated when a specific unit, vehicle or object is dead... This is not the only question of trigger condition... I want a complete list of trigger conditions  I can't find it.. over here, can any one give me any link to it?..
The 3d!t0R            -=O.F.P.E.C=-                                                         -=I.S.I=-

Re: Trigger Conditions...??
« Reply #1 on: 19 Jan 2012, 10:20:57 »
   Hello, you can't find complete list of trigger conditions because... It doesn't exist! Trigger conditions are whatever you want them to be and can be everything.
   Common conditions are boolean ones which you activate by putting something = true in a script (the .sqs file) and by putting something condition on a trigger so that trigger will run only when that condition is set true from script. Other conditions make use of special symbols like ?, !=, and, or, not... but I suggest you to take a look at COMREF to get acquainted with all those funny symbols. There isn't any complete list of conditions but there is list of things which conditions are built with and that list is the one you should focus your attention in.
   As far as I poorly know, there are two different ways to write conditions (but you achieve same result however) one via trigger and one via script.

About your specific question, condition for dead unit in trigger is

Code: [Select]
not (alive unitname)
and in script is

Code: [Select]
@not (alive unitname)
what happens

or

Code: [Select]
? not (alive unitname) : what happens
with the important difference that @ frozes the rest of the script, which is after @not (alive unitname), until that condition is reached (e.g. until that unit is killed/destroyed) and ? doesn't frozes the script but the script will be ran anyway.

If you have a script, you may imagine it like a branched structure:

main script
     |
     |
     |
@condition
     |
     |
     |
? condition ------ continue conditioned script
     |
     |
     |
continue main script

By default, branch structure reads both conditioned script and main script but, if for some reason after ? condition, you want to avoid reading main script and read only conditioned script you have to put ; exit command after last command you put inside conditioned script (e.g. ? not (alive unitname) : titleText "We got a man down!!!"; exit).

That's all!
« Last Edit: 19 Jan 2012, 10:23:49 by Doktor_Headshot »
? (this == thinkable) : this = scriptable

Offline Gruntage

  • Missions Depot
  • Administrator
  • *****
  • How do I get outta this chickensh*t outfit?
Re: Trigger Conditions...??
« Reply #2 on: 19 Jan 2012, 11:36:45 »
Following on from what Doktor said, for vehicles (and ground units as well) you can use these:

Code: [Select]
? not (canMove _unit)
This can be used for vehicles such as urals and uazs. If the vehicle is not able to move, then the above condition would be met.

Code: [Select]
? not (canStand _unit)
Used for ground troops. If the _unit is unable to stand due to his injuries, then the above condition would be met.

You could use the 'getdammage condition if you want to check how much damage a building, vehicle or unit has sustained:

Code: [Select]
? (getdammage _unit > 0.5)
"But one thing I can tell you from not just OFP but life in general:  criticism is directly proportional to quality. The more criticism a mission receives, the better the outcome" - macguba

Offline ahmed117

  • Members
  • *
  • The 3d!t0R -=I.S.I=-
Re: Trigger Conditions...??
« Reply #3 on: 19 Jan 2012, 15:08:39 »
Thanks for your suggestions, but this not answers my question. As my Mission scenario is a bit different.look, I have a squad of 8 soldiers, and if even one of them dies the mission will be Failed.... is there any trigger condition of scenarios like this? But I will still prefer to use scripts.
The 3d!t0R            -=O.F.P.E.C=-                                                         -=I.S.I=-

Offline Gruntage

  • Missions Depot
  • Administrator
  • *****
  • How do I get outta this chickensh*t outfit?
Re: Trigger Conditions...??
« Reply #4 on: 19 Jan 2012, 15:23:54 »
Ah ok, this is easily done using the following code:

Basically you need to set up a trigger with this in the condition:

Code: [Select]
("alive _x" count units groupname) < 8
With 'End #' as the outcome.

"But one thing I can tell you from not just OFP but life in general:  criticism is directly proportional to quality. The more criticism a mission receives, the better the outcome" - macguba

Offline ahmed117

  • Members
  • *
  • The 3d!t0R -=I.S.I=-
Re: Trigger Conditions...??
« Reply #5 on: 19 Jan 2012, 15:33:08 »
Thankx, but what is the "group name" to be typed? and what is "(alive _x)"...?
The 3d!t0R            -=O.F.P.E.C=-                                                         -=I.S.I=-

Offline Gruntage

  • Missions Depot
  • Administrator
  • *****
  • How do I get outta this chickensh*t outfit?
Re: Trigger Conditions...??
« Reply #6 on: 19 Jan 2012, 15:53:13 »
GroupName is the name of your group of soldiers. To name your group simply put:

Code: [Select]
groupName = group this
...in the leader of the group you want to be named.

Code: [Select]
(alive _x)
'_x' is basically every unit within a group or an array. The 'alive' part is simply how many units in the '_x' array are alive.
"But one thing I can tell you from not just OFP but life in general:  criticism is directly proportional to quality. The more criticism a mission receives, the better the outcome" - macguba