How to create a sound that plays 1 time after a double jump, and does not play constantly while I click on the button.
Hey @NailV123!
Why don’t you go ahead and show us what code you’ve got, and maybe we can just fill in the blanks for you!
There’s a lot more than one way to do things, and it’s better to adapt code you have than to start over, both for time and for learning purposes.
Let us know and we’ll get you squared away!
Ahhh I see.
You do not want to use “Add Audio Component” for this. This will make them permanently added to the Blueprint forever. If you WANT it to play through an audio component, you will want to add that outside of the code, straight into the hierarchy, but I don’t think this is what you want.
PlaySoundAtLocation and DoOnce nodes are what you need, I think.
PlaySoundAtLocation will play the chosen sound originating at the location you give, you can use “GetActorLocation” to make the origin this actor.
DoOnce will prevent any code moving through after it has been passed through once, with a reset option. You can reset it in any number of ways, I like to use a custom event to do so. With this, you call a custom event on your landing event for each DoOnce that needs resetting.
Hope this helps! ![]()
And how to do it through an audio component, I just didn’t know about it.
Sorry for my knowledge and broken English.
To clarify, are you saying it is necessary that you use an audio component? Because that is much more complicated.
You will add an audio component to the Blueprint. Then use “Get AudioComponent” (or what you named it), then choose the audio file you need. Then from there you can use “Play” and “Stop”.
Okay, I’ll try to do it in a simple way, if everything is solved, I will mark you with the solution.
thank you very much!
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
