OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Knight_Sky on 31 Jan 2003, 17:52:09

Title: COnditions and triggers
Post by: Knight_Sky on 31 Jan 2003, 17:52:09
Is it possible to put more then one condition in a trigger ive tried seperating them with ";" but to no avail? Any ideas?
Also if i put a condition in  a trigger as soon as the condition is met the trigger activates regardless of if ive only set it to activate if a certain unit is present , any ideas with that?
Cheers
KS
Title: Re:COnditions and triggers
Post by: Chris Death on 31 Jan 2003, 18:10:41
question 1: yes it is

you can combine conditions by using the feature called: AND

e.g: this AND not (alive whoever)

question 2: seems you didn't setup the trigger's condition
to be met by only a certain unit then.
More info would be required to give you a definitely answer
onto that.

Just a few tips here:

variant a: unit in thislist
as a condition

or

variant b: group (F2 + drag a line from unit to trigger) the trigger with the unit, so that only this unit can activate the
trigger.

~S~ CD
Title: Re:COnditions and triggers
Post by: Knight_Sky on 01 Feb 2003, 11:39:25
The trigger is allready grouped with the unit, if there is no condition the trigger will only activate if the unit is present. To show you what i mean here is the context.

The mission has an element of yur clichéd hostage rescue.
I want the hostages to be freed, ie stop there surrender stance and join the group.

Here is what i have done
I have set a trigger so that when all of east are gona within a certain area, a variable i have called eastgone becomes true. I have set another trigger grouped with the players unit, so that when the unit gets within 5 metres of the prisoner AND all the east are dead, the prisoners join the group and are effectively freed.

Here is the problem.
The trigger to free the hostages activates as soon as eastgone become true regardless of weather the unit is an where near them.

Any ideas?

Knight Sky
Title: Re:COnditions and triggers
Post by: Sui on 01 Feb 2003, 12:40:54
Welcome to the forums, Knight_Sky

Try this one:

Trigger

Radius: Covering all East units
Condition: East not present
Condition Field: this and (player distance hostage < 5)
OnActivation: hostage switchmove "null"; [ hostage ] join (group player)

That trigger will go off when there is no east inside it's area, and when the player is less than 5m from hostage. hostage will then get out of the surrender pose, and join the player's group.

Hope that helps you out ;)
Title: Re:COnditions and triggers
Post by: Knight_Sky on 01 Feb 2003, 14:15:11
That is perfec! thanks alot!
Cheers
KS
Title: Re:COnditions and triggers
Post by: Kojak on 02 Feb 2003, 15:13:40
Sorry for breaking in like this in a finished topic, but I have a similar problem:

I want to use a (sort of) random event to make things happen - if west squad A destroys east squad 1 some west choppers will move in, if east squad 1 instead destroys west squad A some russian tanks will come rolling instead.

I tried this with using variables and the OR command, but nothing really happened, no matter what event should take place, and the combat between the two squads has a 50-50 chance for either event. So, what am I doing wrong?
Title: Re:COnditions and triggers
Post by: macguba on 02 Feb 2003, 18:12:44
hmmmm ... doesn't sound like you're doing anything toooooo badly wrong.  I use hints to help me sort out problems like this - when a variable is set, or a trigger fired, a hint pops up.

Anyway, try this

in init.sqs put this

westwin=false
eastwin=false

Now you need two triggers


TriggerWest
synchro with a hold waypoint for the west choppers
type switch
condition: (not eastwin) and (count units East1 ==0)
on activation:   westwin=true


TriggerEast
synchro with a hold waypoint for the east tanks
type switch
condition: (not westwin) and (count units WestA ==0)
on activation:   eastwin=true

Syntax not guaranteed but you get the picture.    Once one trigger has been fired the other one cannot be fired.  

You have to define the variables in init.sqs otherwise:   if OFP finds a variable that has not previously been defined it assumes that the whole expression is false (I think).

Hope that helps!


Title: Re:COnditions and triggers
Post by: Kojak on 02 Feb 2003, 20:20:15
Thanks, I'll try that!