Page 1 of 1

How to change custom music in events?

Posted: Sun Sep 08, 2019 5:15 pm
by SuperSpaceMan230
Im trying to make an event where the music changes in one part, but i cant change to other custom music, it just doesnt show me something to add the custom music,anyone knows how to add custom music?
Image

Re: How to change custom music in events?

Posted: Sun Sep 08, 2019 5:34 pm
by Scroll
You mean changing from a custom song to another custom song via events?

Re: How to change custom music in events?

Posted: Sun Sep 08, 2019 5:43 pm
by Electriking
You can only have one custom music per section. You will have to replace default music with a music.ini file to use more.

Re: How to change custom music in events?

Posted: Wed Sep 11, 2019 11:18 am
by HenryRichard
You could also use Lua in SMBX2 (you'll need the PAL version) - this example code should start playing a music file called "boss-music.ogg" in player 1's section when an event called "Start Boss Music" is triggered:

Code: Select all

function onEvent(eventName)
	if(eventName == "Start Boss Music") then
		Audio.MusicChange(player.section, "boss-music.ogg")
	end
end
If you'd like to learn more LunaLua Enjl has some good tutorials on it here.

EDIT: I can't seem to get the code to format correctly (it's supposed to be 5 lines, not one), so it looks more complicated than it is. Sorry about that - it should still work properly though.

Re: How to change custom music in events?

Posted: Wed Sep 11, 2019 12:02 pm
by Enjl
HenryRichard wrote:
Wed Sep 11, 2019 11:18 am
EDIT: I can't seem to get the code to format correctly (it's supposed to be 5 lines, not one), so it looks more complicated than it is. Sorry about that - it should still work properly though.
It looks fine on the prosilver theme. The SMBX forum theme has been busted for a year or so regarding the code block. I've resorted to just not using it and ditching indenting in favour of multiple lines.