Jump to content
Sign in to follow this  
scribe308

Trigger Inactive when enemy unit dies?

Recommended Posts

Hi all,

I'm new to this and apologize for my lack of knowledge, but I'm trying to make a trigger that plays a sound (did it) and becomes inactive when a local enemy is killed (named "ins_1")

Can I put a quick line of code into the condition line in the trigger that accomplishes the following:?

when enemy (ins_1) is not alive, setactivation to false

Thanks for any help. I think it's the details of the scripting language that have me stumped...

Scribe308

Share this post


Link to post
Share on other sites
in the condition space for the trigger that plays the sound:

! alive ins_1

that would trigger the trigger when the unit dies, making the sound start first when ins_1 is dead.

Only way to stop the sound is by deleteing the trigger, I think. So if  you put "this && (alive ins_1)" in the condition field, and give the trigger a name, then in the on deactivation field you put "deletevehicle triggername", where triggername is the name of the trigger.

Hmm, that didn't work. You'll just have to name the trigger something, then add another trigger, put "! alive ins_1" in the condition field, then in the on activation field you'll have to put "deletevehicle triggername".

Share this post


Link to post
Share on other sites

Thanks guys,

I'll try your ideas.

BTW, do you think it's easier to have this in a script that constantly runs? a continual loop that checks for enemy dead and delets triggers when that condition is met?

Scribe308

Share this post


Link to post
Share on other sites

I would have used a script, not because it's easier, but because it would look better in the editor tounge2.gif

Share this post


Link to post
Share on other sites
I would have used a script, not because it's easier, but because it would look better in the editor tounge2.gif

? ? ?  huh.gif  ? ? ?

Share this post


Link to post
Share on other sites

What about, something like, this?

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">This AddEventHandler ["killed",{PlaySound "YourSound"}]

Put it in your guys Init field and it will play when he is killed. Might get a bit more complicated than that in Multi Player though.

Share this post


Link to post
Share on other sites
I would have used a script, not because it's easier, but because it would look better in the editor tounge2.gif

? ? ?  huh.gif  ? ? ?

If you got a lot of easy stuff to do, you might want to do it in a trigger, but I prefer doing it in a script, because if I have 300 small things like that in triggers, that would be a lot of triggers, and therefor the editor would look like a mess (when I say editor I mean the mission would look like a mess when editing ingame).

UNN, he wants to stop a sound, that is started by a trigger, when the unit dies wink_o.gif (I think he's using one of those sounds in the effect thingy in the trigger).

Share this post


Link to post
Share on other sites
Quote[/b] ]UNN, he wants to stop a sound, that is started by a trigger, when the unit dies  (I think he's using one of those sounds in the effect thingy in the trigger).

I see then just use this instead wink_o.gif

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">This AddEventHandler ["killed",{DeleteVehicle YourTrigger}]

Share this post


Link to post
Share on other sites

Yesh, that would actually be the best way TBH biggrin_o.gif (Why didn't I think about using a EH? icon_rolleyes.gif )

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×