How to change custom music in events?

General discussion about Super Mario Bros. X.
SuperSpaceMan230
Cheep-Cheep
Cheep-Cheep
Posts: 14
Joined: Sat Nov 05, 2016 4:24 pm

How to change custom music in events?

Postby SuperSpaceMan230 » Sun Sep 08, 2019 5:15 pm

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

TheNightingale
Charged Spiny
Charged Spiny
Posts: 1971
Joined: Fri Apr 20, 2018 9:28 pm
Flair: And here comes the last great american dynasty
Pronouns: he/him
Contact:

Re: How to change custom music in events?

Postby TheNightingale » Sun Sep 08, 2019 5:34 pm

You mean changing from a custom song to another custom song via events?

ElectriKong
Posts: 4646
Joined: Mon Jun 06, 2016 4:32 pm
Flair: I have NO idea what to put here
Pronouns: he/him
Contact:

Re: How to change custom music in events?

Postby ElectriKong » Sun Sep 08, 2019 5:43 pm

You can only have one custom music per section. You will have to replace default music with a music.ini file to use more.

HenryRichard
Birdo
Birdo
Posts: 2843
Joined: Mon Dec 23, 2013 12:09 pm
Flair: Is this where I type my password?
Contact:

Re: How to change custom music in events?

Postby HenryRichard » Wed Sep 11, 2019 11:18 am

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.

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9491
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: How to change custom music in events?

Postby Enjl » Wed Sep 11, 2019 12:02 pm

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.

ExpressionlessBA747
Shy Guy
Shy Guy
Posts: 8
Joined: Fri Sep 24, 2021 1:19 pm
Pronouns: he/him

Re: How to change custom music in events?

Postby ExpressionlessBA747 » Mon Feb 28, 2022 7:59 pm

ElectriKing wrote:
Sun Sep 08, 2019 5:43 pm
You can only have one custom music per section. You will have to replace default music with a music.ini file to use more.
How is this Works?

deice
Buster Beetle
Buster Beetle
Posts: 441
Joined: Fri Jul 23, 2021 7:35 am

Re: How to change custom music in events?

Postby deice » Tue Mar 01, 2022 7:00 am

ExpressionlessBA747 wrote:
Mon Feb 28, 2022 7:59 pm
How is this Works?
go to data/_templates and open music.ini for an example.

ExpressionlessBA747
Shy Guy
Shy Guy
Posts: 8
Joined: Fri Sep 24, 2021 1:19 pm
Pronouns: he/him

Re: How to change custom music in events?

Postby ExpressionlessBA747 » Tue Mar 01, 2022 9:00 am

deice wrote:
Tue Mar 01, 2022 7:00 am
ExpressionlessBA747 wrote:
Mon Feb 28, 2022 7:59 pm
How is this Works?
go to data/_templates and open music.ini for an example.
i put the file level inside or out of the file level to make it work?

deice
Buster Beetle
Buster Beetle
Posts: 441
Joined: Fri Jul 23, 2021 7:35 am

Re: How to change custom music in events?

Postby deice » Tue Mar 01, 2022 12:14 pm

ExpressionlessBA747 wrote:
Tue Mar 01, 2022 9:00 am
i put the file level inside or out of the file level to make it work?
that depends. it functions the same as custom graphics, so, if you place your music.ini in your episode folder it will replace the given songs across the whole episode, whereas putting it inside a level folder will replace them just for that level.


Return to “General”

Who is online

Users browsing this forum: Ahrefs [Bot] and 1 guest