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.
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.
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?
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.