x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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

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

Product Version: UE 4.16
Tags:
more ▼

asked Aug 18 '17 at 10:10 AM in Blueprint Scripting

avatar image

mahlukat
19 6 9 9

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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? :)

alt text

alt text

more ▼

answered Aug 18 '17 at 09:38 PM

avatar image

M.wmmn
155 6 6 12

avatar image M.wmmn Aug 18 '17 at 09:41 PM

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 :)

avatar image mahlukat Aug 18 '17 at 10:07 PM

Thank you! that is excatly what I need.

avatar image M.wmmn Aug 18 '17 at 10:17 PM

Glad I could help :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered Aug 18 '17 at 02:05 PM

avatar image

M.wmmn
155 6 6 12

avatar image mahlukat Aug 18 '17 at 03:41 PM

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?

avatar image mahlukat Aug 18 '17 at 03:54 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question