Explore/Battle Music Swap

Good Morning! hopefully someone can help :slight_smile: i have just tried to make a simple code, that plays a sound at my characters location, I have set the sound as a variable so i can call it in another blueprint. In my enemy bp, i have a sphere collision, and on begin overlap, from other actor, i cast to my third person character, and then as the tpc, i set the music type to my battle music, and then on end overlap, i set it back to the explore music…but for some reason, it aint working. I have been having a hard time with collision lately ( when my player attackes my enemy the npc goes flying into the air, skyrim style :D) but dunno if thats the issue or not…please see attached photos for reference, thanks! :slight_smile:
example1

Is the first graph in your player?

The problem is, just changing the value of the variable isn’t enough, because the music is already playing.

You need to stop the old music, and start the new music.

Also, worth noting, the location of the music doesn’t matter, unless you have setup attenuation.

So, in the player have

And you can just call it with the different wave files from the overlap events.

PS: CurrentMusic is a reference of type AudioComponent

1 Like

awesome, thanks buddy! :slight_smile:

1 Like

sorry, still learning all of this lol, apologies if this is a stupid question but what type is the music input on the play music custom event please? :slight_smile: and so if i wanted to change the song depending on the player entering a sphere collision on my enemy, i should just cast to the player, and as the player set current music?

It’s a sound wave reference :slight_smile:

1 Like