OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: titan on 18 Jan 2005, 02:09:41

Title: trigger - activate when unit dead
Post by: titan on 18 Jan 2005, 02:09:41
How would you go about activating a trigger when a unit/empty object is destroyed. I want this so for instances when you destroy a target, you get the message "TARGET # WAS DESTROYED" or for at the end of a mission, where you can only end the mission once the objective target has been destroyed.
Title: Re:trigger - activate when unit dead
Post by: Triggerhappy on 18 Jan 2005, 02:50:40
in the condition put:
not alive nameofunit

or:
!(alive nameofunit)

either will work
Title: Re:trigger - activate when unit dead
Post by: AirCav on 18 Jan 2005, 05:58:23
Hi Trig,

I just tried using that line.  Not working.  Could you tell me what i'm doing wrong?

Here's the trigger:

Condition: (bomber distance SL1 < 20) or !(Alive bomber)
On Activation: [bomber] exec "ëxplosion.sqs"

The trigger worked fine before I added the !(Alive Bomber) piece.  The intent is to have the car explode either when the bomber does, or is within lethal range (20m) of the target.  


Also, i'm using 1.46 if that makes a difference.

-Air
Title: Re:trigger - activate when unit dead
Post by: macguba on 18 Jan 2005, 12:53:43
Odd.   Does this

Condition:  !(Alive bomber)
On Activation: [bomber] exec "ëxplosion.sqs"

work?

Check that you have only one unit called bomber and the name is spelled correctly.   Is bomber a soldier?
Title: Re:trigger - activate when unit dead
Post by: titan on 18 Jan 2005, 13:15:46
Thank you.  

not alive nameofunit  works fine. The problem now of course, is that is what activates the trigger. Is there a way you can activate a trigger with the presence of a unit. Which when gets activated, it checks to see if a unit is dead, and if it is... then activate the text or what ever.
Title: Re:trigger - activate when unit dead
Post by: Triggerhappy on 18 Jan 2005, 22:32:20
make the trigger grouped to whoever you want to be in it to activate it
*note that your options will change when you do that
set those options to the one you want, and in condition put:
this &&(or AND) !(alive unitname)
Title: Re:trigger - activate when unit dead
Post by: titan on 19 Jan 2005, 12:09:10
ok, all works well and fine. Yet another question.... is it possible to activate the trigger when        "not alive target1  AND   not alive target2"  or something like that. You know, so when 2 units are dead, and not just one of them.
Title: Re:trigger - activate when unit dead
Post by: macguba on 19 Jan 2005, 12:46:09
Yes.
Title: Re:trigger - activate when unit dead
Post by: Lean Bear on 19 Jan 2005, 12:53:27
Yeah. Of course, the syntax would look more like this:

!(alive unit1) && !(alive unit2)
Title: Re:trigger - activate when unit dead
Post by: Triggerhappy on 19 Jan 2005, 21:57:57
actually, lean bear, you CAN write it as:
not alive unit1 and not alive unit2

in fact, thats how BIS did it in the official missions/campaign (at least the original ones, i don't know about res)
Title: Re:trigger - activate when unit dead
Post by: Lean Bear on 20 Jan 2005, 18:12:54
Really? Never knew that :P

I think the other way looks nicer anyway :D
Title: Re:trigger - activate when unit dead
Post by: Triggerhappy on 21 Jan 2005, 00:12:54
lol yeah thats how i first did it (i learned by opening up the bis stuff and looking around)