Final Music lua problem (Solved)

Need help with any SMBX game-related issues? Ask your questions here.

Moderator: Userbase Moderators

Levelmaker_123
Spiny
Spiny
Posts: 25
Joined: Fri Dec 08, 2023 1:46 pm
Pronouns: he/him
Contact:

Final Music lua problem (Solved)

Postby Levelmaker_123 » Fri Sep 20, 2024 10:27 am

Alright, this is going to be my final one,so how should I fix this?
So, this is the original code:

Code: Select all

function onEvent(eventName)
	if(eventName == "musictrigger1") then
		Audio.MusicChange(0, "Wario Land Shake It! OST - Bad Manor.ogg", 200)
	end
	if(eventName == "musictrigger2") then
		Audio.MusicChange(0, "Wario Land Shake It! OST - Bad Manor.ogg", 200)
	end
end
And it's cool and all but what if I want to put more custom music? Of course putting a third one doesn't works,so is there a way to put in not 2 but like 3,4,5 or more?
Last edited by Levelmaker_123 on Sun Sep 22, 2024 12:54 pm, edited 1 time in total.

mariobrigade2018
Eerie
Eerie
Posts: 719
Joined: Wed May 24, 2023 7:00 pm
Flair: OK in coding who dreams of making a Mario game
Pronouns: he/him

Re: Final Music lua problem

Postby mariobrigade2018 » Fri Sep 20, 2024 10:41 am

Levekmaker_123 wrote:
Fri Sep 20, 2024 10:27 am
Alright, this is going to be my final one,so how should I fix this?
So, this is the original code:

Code: Select all

function onEvent(eventName)
	if(eventName == "musictrigger1") then
		Audio.MusicChange(0, "Wario Land Shake It! OST - Bad Manor.ogg", 200)
	end
	if(eventName == "musictrigger2") then
		Audio.MusicChange(0, "Wario Land Shake It! OST - Bad Manor.ogg", 200)
	end
end
And it's cool and all but what if I want to put more custom music? Of course putting a third one doesn't works,so is there a way to put in not 2 but like 3,4,5 or more?
Correct me if I’m wrong, but could you use an “if else if chain”for that?

Levelmaker_123
Spiny
Spiny
Posts: 25
Joined: Fri Dec 08, 2023 1:46 pm
Pronouns: he/him
Contact:

Re: Final Music lua problem

Postby Levelmaker_123 » Fri Sep 20, 2024 2:37 pm

mariobrigade2018 wrote:
Fri Sep 20, 2024 10:41 am
Levekmaker_123 wrote:
Fri Sep 20, 2024 10:27 am
Alright, this is going to be my final one,so how should I fix this?
So, this is the original code:

Code: Select all

function onEvent(eventName)
	if(eventName == "musictrigger1") then
		Audio.MusicChange(0, "Wario Land Shake It! OST - Bad Manor.ogg", 200)
	end
	if(eventName == "musictrigger2") then
		Audio.MusicChange(0, "Wario Land Shake It! OST - Bad Manor.ogg", 200)
	end
end
And it's cool and all but what if I want to put more custom music? Of course putting a third one doesn't works,so is there a way to put in not 2 but like 3,4,5 or more?
Correct me if I’m wrong, but could you use an “if else if chain”for that?
I could try that


Return to “Help and Support”

Who is online

Users browsing this forum: No registered users and 2 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari