How to change sound cue(music) when player attack?

Cant find anything about changing sound cues on spesific situations? Can someone help me please?

How is the player attack being called?
If you put sound cues in your level then from the level blueprint, depending where/how you’re calling the player attack, you could tell it to stop playing the current sound cue and then play the new sound cue.

Hi, thanks for help, I have an attack boolean in player BP, I can change the music in level blueprint, maybe my question is not so clear, what I ask is changing music inside sound cue, I couldnt find any node to change the input inside mixer node in audio cue. Also I dont know how to reference sound cue in player BP or any BP. Should I cast? Or get all actors of class?

Also, where can I understand when my music has done, I mean finished?

If you want to change the music inside the sound cue one option would be to use the branch node. For example you could have two Wave Players, one with your Attack Music and the other one with your normal music. Name the branch node whatever you like, e.g ‘AttackMusic’, and if it is set to true then play the AttackMusic, and if it is false play your normal music.

From your level BP you can create a reference to your sound cue then drag off of it and select the ‘Set Boolean Parameter’ whenever you want to switch to your Attack Music. In the ‘name’ section of the node you write whatever it is you called your branch in the sound cue, in this example it was ‘AttackMusic’, and then check the bool box to true.

Similarly when you want to switch back you would do the same thing but make sure the bool box was set to false.

Below I have a sound cue called ‘Jompson’ with two Wave Players and a branch called AttackMusic.
In my level BP, whenever I press the G key, the boolean branch in the sound cue will be set to true and will play ‘Starter_Birds’, when I press the H key it will be set to false and play ‘Starter_Music’.

Does this help? :slight_smile:

If you want to know if it has finished playing, in the level BP you can drag off your Sound Cue reference and there is a function called ‘IsPlaying’ which will return a bool value. If the sound cue is not playing/has finished it will return false. So you could set a variable storing that value which will let you know if the sound has finished :slight_smile:

Glad I could help :slight_smile:

Thank you! that is excatly what I need.