World Selector with Progressively Changing Music

Post here for help and support regarding LunaLua and SMBX2's libraries and features.

Moderator: Userbase Moderators

KurttheKing
Tweeter
Tweeter
Posts: 149
Joined: Tue Mar 15, 2022 4:55 pm
Flair: Certified Nerd
Pronouns: He/Him
Contact:

World Selector with Progressively Changing Music

Postby KurttheKing » Wed Mar 23, 2022 10:33 am

Here we go, Post 2. I've seen a world map selector in Super Mario & the Ancient Stars. How can I make one, that has different music every time I complete a world? For example, I complete the Second World, and the music gets another beat playing in the background
https://i.ytimg.com/vi/1BBoEhHOUTk/mqdefault.jpg
This is the one I found in SM & TAS

deice
Rocky Wrench
Rocky Wrench
Posts: 638
Joined: Fri Jul 23, 2021 7:35 am

Re: World Selector with Progressively Changing Music

Postby deice » Wed Mar 23, 2022 12:56 pm

you'd have to keep track of completed worlds in savedata, and then use something like jukebox.lua to check and play the correct music.

you might be able to do it in vanilla as well but you'd have to override a decent chunk of the overworld music and then make several identical copies of the world selector each with different music playing, which would be quite unwieldy and limiting (for example, all the worlds would have to be completed in a set order). if you aren't familiar with how to use lua, a decent (but potentially slightly outdated) set of tutorials can be found here (for the basics) and here (for the rest).

KurttheKing
Tweeter
Tweeter
Posts: 149
Joined: Tue Mar 15, 2022 4:55 pm
Flair: Certified Nerd
Pronouns: He/Him
Contact:

Re: World Selector with Progressively Changing Music

Postby KurttheKing » Wed Mar 23, 2022 3:30 pm

Yeah, I'm completely new to using Lunalua. Never once have I tried using it. I'm not much of a coder, so I wouldn't know what exactly to do. I will watch as many tutorials as I can find for help on Lunalua, but all I need to know is how to make a Jukebox change the song it plays. Shouldn't be too hard. I'll try to figure out how to keep track of savedata, that should help. I'll update if things work

AlanLive2020
Buster Beetle
Buster Beetle
Posts: 98
Joined: Fri Nov 27, 2020 8:15 am
Flair: The guy with no social skills or self-esteem :')

Re: World Selector with Progressively Changing Music

Postby AlanLive2020 » Tue Mar 29, 2022 6:24 pm

I'm kinda of bad at lua, but I'm assuming you could change the music via lua based on how many power stars you have by getting the value of SaveData.starCount (not sure if that's the name of the variable) and changing the music with each star you get. Not sure how to change the music with lua yet. Idk if it would work the same on the world map either. I'm guessing it would also be a bit harder to do if it's custom music.

Marioman2007
2025 Egg Hunter
2025 Egg Hunter
Posts: 546
Joined: Tue Aug 25, 2020 3:19 am
Flair: Dr. Bones
Pronouns: He/Him

Re: World Selector with Progressively Changing Music

Postby Marioman2007 » Tue Mar 29, 2022 8:30 pm

AlanLive2020 wrote:
Tue Mar 29, 2022 6:24 pm
I'm kinda of bad at lua, but I'm assuming you could change the music via lua based on how many power stars you have by getting the value of SaveData.starCount (not sure if that's the name of the variable) and changing the music with each star you get. Not sure how to change the music with lua yet. Idk if it would work the same on the world map either. I'm guessing it would also be a bit harder to do if it's custom music.
I don't remember the star count having a SaveData variable
it uses a mem value: mem(0x00B251E0, FIELD_WORD)

also you can use jukebox.lua to lua change music
viewtopic.php?f=101&t=27445


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 2 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari