Playing sound at location with a event timer

Hi guys!

So I am new to unreal engine and so far i have learn to use the timer to make stuff. I am making a volcano that erupts randomly and it seems to work but I just cannot get it to make the sound when it erupts. I would really appreciate some help. Not to hold my hand but some guidance as to what I am doing wrong.

Thanks it advance!




Can you just explain what these 3 BPs are?

Why do you want to use a timer to play the audio?

1 Like

Hey there.
A few things wrong on your BPs.

  • You play the audio out of the timer, and only once, which according to what we can see in your screenshots means that it’s only playing at Begin Play.

  • In Play Sound at Location the Start Time doesn’t mean ‘Delay before playing the audio’, it means ‘what second of the audio track should it start playing the audio at’. You can hover the input with your mouse and see the description.

  • If you want the spawn to be at random times, creating a timer with a fixed variable doesn’t work, and if you call this function more than once, you’re creating a new Event Timer.
    The “correct” way is to either store the Timer Handle in a variable to control it when you want to Pause, Reset or Clear the timer, or set Looping to false and make an event that calls your Set Timer by Event that in the Event reference passes the same event, setting Time as a random value each time.

I hope that helps. Please try to make a clearer context and clarify what your BPs are as @ClockworkOcean mentioned.

1 Like

Hi guys! Thanks so much for replying!

EDIT: I do not want to use the timer to play the audio. I want the audio to play once per “eruption” and i cannot for the life of me figure out how to do that. I know its probably not that difficult but i am stump.

So i missed one image but i edited the post to fix it.

So in image order:

The first function spawns the “fireball”.

The second image call the first function and set a timer that spawn those balls at random times.

The third one call the second function and set a timer for 20 seconds.

This makes the volcano erupts at random times throughout the gameplay.

Not related sure if i should mention this but I have a separate BP for the projectile that makes the “fireballs” goes in random direction.

As for the pause, reset and clear timer, I haven’t tried this as yet but i might try to learn how this work.

EDIT: The last image is the one i actually use for the level. I don’t know if this makes sense.

First you should add an Audio Component to the Volcano… vs spawn sound at location.

Second, you’d play the sound via the audio component at eruption which is when the fireballs shoot out. So why not add the playing of sound to the fireball function?

1 Like

That’s something i did not think about! i will try to make this work.

One issue i am having here, when i add the sound to the fireball function. It goes off every time a a ball is spawn. I did try the do once node but maybe i am doing it incorrectly?

Another option is to configure your audio concurrency options for the audio file to only play once total. If this is still working in UE5 or what you are using.

Sound Cue Editor UI | Unreal Engine 4.27 Documentation

1 Like

Just in case anyone is looking for the same solution.

I couldn’t figure out how to do this based on suggestion but i came up with this. Not sure how efficient it is but it seems to work.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.