Sounds Overlapping

0 favourites
  • 7 posts
From the Asset Store
75 explosion sound effects. Essential for many games, Explosions Sounds contains a mix of explosion and impact sounds.
  • How can I limit instances of the same sound from playing? I have a weapon that can overlap multiple enemies each causing them to emit a "hurt" sound. What I don't want is to trigger them all at the same time necessarily, which can start clipping and distort. I want to be able to say only play one of a certain instance of sound while one is still playing.

    Inversely, is there support to stop a currently playing sound if it is asked to play again, effectively interrupting and replacing the original one with the new instance?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I believe you can do that by using the sound's "Stop" action. Have you tried that?

    You could simply stop the sound every time the action occurs, then play it. So you'd have a 2-part action.

    If x condition...

    Stop "sound"

    Play "sound"

    Something like that perhaps?

  • Thanks for the try. My first stroke of genius was to add a counter. For every of this instance playing add one to counter. If counter is above 1 then stop sound. Sounded logical. But it stops all sounds, not just the offending one.

    The same would apply to your idea. Once you throw in that stop sound, it stops all certain sounds. Not just one, or the most recent one.

    I think my ultimate solution lies in some of the timeline and cooldown plugins for C2 that I'm checking out now. Essentially adding a cooldown to a sound so it can't play until the cooldown ends. Still a bit hacky.

    I'm an audio engineer by trade for the video game industry and I'm kinda spoiled on audio middleware like wwise and fmod that allow you to create a basic rule and priority system for audio.

    I'll keep trying stuff out though, thanks!

  • I may have misunderstood this a bit, but it sounds like you just need to add a tag to your particular sound. Then you'll be able to address just that particular sound by referencing that tag.

    Have you tried that?

    Basically, you add a tag, like "gun". Then when you use the Stop action, you enter "gun" for the tag of the sound to stop.

  • yeah, tagging them helps it a bit so they don't stack now. Thanks for that. But I don't want the new one to replace the old, I want the old one to play out before a new one will play (or at least be audible).

    Closer now!

  • TPorter64, not sure but are you sure you're not just missing a "Trigger once" condition? See this tutorial.

  • For this instance, no. I'm not playing it on tick or any other timing variable so it's not that the item is spamming on one ammo+enemy overlap. It's that my weapon is a constant stream (not particles) and can cover multiple enemies. And each one of those enemies that is affected by the stream is told to play a pain sound. What I want to be able to do is say, "ok, 7 enemies are in the stream, but I want to cap the pain sound at only 2 or 3 possible globally at one time".

    I'm still experimenting and feel I'm getting close, but it's never quite right...yet.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)