OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started 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.
-
in the condition put:
not alive nameofunit
or:
!(alive nameofunit)
either will work
-
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
-
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?
-
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.
-
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)
-
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.
-
Yes.
-
Yeah. Of course, the syntax would look more like this:
!(alive unit1) && !(alive unit2)
-
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)
-
Really? Never knew that :P
I think the other way looks nicer anyway :D
-
lol yeah thats how i first did it (i learned by opening up the bis stuff and looking around)