Jump to content
Sign in to follow this  
tangowrangler

How to stop a trigger effect from playing when something is destroyed

Recommended Posts

I already have a trigger setup to play an effect when there is presence within the trigger area (i.e. Muslim prayer). I would like to have a loudspeaker object placed on the map essentially playing the music. A task would be created for the teams to destroy the loudspeaker which would deactivate the trigger playing the effect.

If the object is not functional then I could do replace the loudspeaker with a building.

Any thoughts? Thanks in advance.

Share this post


Link to post
Share on other sites

You could add another trigger that kicks in when the loudspeaker is destroyed, which in turn moves the sound trigger away to i.e. [0,0], then deletes the trigger.

Cond: !alive uMySpeaker

On act: 0 = [] spawn {tMySoundTrigger setPos [0,0]; sleep 0.1; deleteVehicle tMySoundTrigger;};

Not sure atm if you need to setPos it. It might continue a little while as well.

Share this post


Link to post
Share on other sites

There is an easier way.

Simply make the trigger repeatable and add "&& alive <loudSpeaker>" to the condition field of the trigger after "this" (replacing <loudSpeaker> with the name of your loud speaker object).

Share this post


Link to post
Share on other sites

One thought - once the trigger is deactivated.. will the sound (which I assume is a user defined file of any particular lenght) stop immediately on destruction of the object? My initial thought is no. Maybe this just doesn't require a solution anyway.

Share this post


Link to post
Share on other sites

The sound file will be the default muslimprayer1 which is a trigger effect. I was sort of concerned that loop would have to be completed before it was stopped (well someone else told me that).

I will try the options listed here and see what I come up with. Thanks for the input so far.

---------- Post added at 07:56 PM ---------- Previous post was at 07:44 PM ----------

I just tested the ST Dux's method on the one trigger that is playing the effect and I put this in the field:

Condition: this && (alive speaker1);

***I had to add ( ) around the statement to have it work***

I was able to place one satchel on the loudspeaker and once the satchel exploded the puslim prayer stopped.

Thanks it was easy and effective.

---------- Post added at 07:59 PM ---------- Previous post was at 07:56 PM ----------

One thought - once the trigger is deactivated.. will the sound (which I assume is a user defined file of any particular lenght) stop immediately on destruction of the object? My initial thought is no. Maybe this just doesn't require a solution anyway.

The sound would continue playing as the trigger was not checking for the object's alive status.

Share this post


Link to post
Share on other sites

Remember, this reflects what is activated by the triggers dropdown (activated by west, radio alpha etc). Unless you have a purpose with this, you might be better off with just alive speaker1.

The reason I moved the trigger was to simulate immediate shut off of the sound, so you wouldn't have to listen through the whole loop. But when I actually tested, it didn't seem to move it properly. Might have to go with a dummyobject and trigger attachTo that object, and move that, dunno. CfgSFX (trigger) based sounds haven't been nice to me over the years.

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  

×