OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: shrubbery on 11 Feb 2005, 01:55:55

Title: How can I make a trigger only activate when certain units are dead?
Post by: shrubbery on 11 Feb 2005, 01:55:55
I'm a bit of a noob when it comes to scripting and what I want to do is have a trigger that will only work when my team has destroyed some BMPs and SU25s and another trigger that will make a hint pop up if all the BMPs and SU25s have not been destroyed. I tried putting
Code: [Select]
not(alive b1);not(alive b2)into the condition field but didn't seem to work.
Title: Re:How can I make a trigger only activate when certain units are dead?
Post by: nominesine on 11 Feb 2005, 02:04:32
You are almost there... just a little syntax problem. This is what your condition field should look like...

!(alive b1) and !(alive b2)

If you write...

!(alive b1) or !(alive b2)

...the trigger will fire when b1 or b2 is dead.

The ; is only used to separate different commands in the activation field. ! means not (you can use either one)
Title: Re:How can I make a trigger only activate when certain units are dead?
Post by: macguba on 11 Feb 2005, 09:34:30
nominesine is of course absolutely right.    However, there is a subtlety here.

Vehicles, armoured vehicles in particular, can look destroyed after you have plugged the appropriate number of LAWs into them.   However, sometimes they do not register as "not alive".    This can cause the mission not to finish - the player thinks he has zapped all the BMPs, and indeed he has, but not quite enough to make the trigger fire.

For this reason it is better to use

(not canFire b1 and not canMove b1) and (not canFire b2 and not canMove b2)

The trigger will fire when the two vehicles can neither move nor fire, and a vehicle which can't do either of these is functionally destroyed anyway.   You don't actually need the brackets, they just make the line easier to read.    You can add as many vehicles as you like.
Title: Re:How can I make a trigger only activate when certain units are dead?
Post by: shrubbery on 19 Feb 2005, 21:54:09
Nice one guys but I've just run into a bit of a problem on this one. I want the trigger to activate when the west is present but it just activates as soon as the condition field is met.
this is what I have

Activated by west

Condition: (canFire b1 or canMove b1)or(canFire b2 or canMove b2)or(canFire b3 or canMove b3)or(canFire a1 or canMove a1)or(canFire a2 or canMove a2)or(canFire a3 or canMove a3)or(canFire a4 or canMove a4)or(canFire a5 or canMove a5)or(canFire a6 or canMove a6)

On activation: theres a hint in here
Title: Re:How can I make a trigger only activate when certain units are dead?
Post by: Triggerhappy on 20 Feb 2005, 00:00:46
condition: this and (!(canFire b1) and !(canMove b1)) and (canFire b2 or canMove b2)or(canFire b3 or canMove b3)or(canFire a1 or canMove a1)or(canFire a2 or canMove a2)or(canFire a3 or canMove a3)or(canFire a4 or canMove a4)or(canFire a5 or canMove a5)or(canFire a6 or canMove a6)

ugh, too many ands and such to change

the main problem is the bold
but also you need to change everything to not canmove/canfire, like mac said

and you should make your "or"s into "and"s otherwise you only need one of those true, as in, if one of them can't move, but can still fire, and all the rest are fine, that part of it will show true
Title: Re:How can I make a trigger only activate when certain units are dead?
Post by: Fragorl on 21 Feb 2005, 11:02:06
Instead of all that repetition, perhaps try:

"(!canmove _x and !canfire _x)" count [a1,a2,a3,a4,a5,a6,b1,b2,b3] == 9

as your condition?