characterselect.lua - choose your character with style!

Share and discuss custom LunaLua code and content packs for SMBX2.

Moderator: Userbase Moderators

Gaming-Dojo
Tweeter
Tweeter
Posts: 143
Joined: Mon Jan 25, 2016 9:20 am
Pronouns: he/him
Contact:

characterselect.lua - choose your character with style!

Postby Gaming-Dojo » Sun Aug 10, 2025 11:31 am

Hello Folks,

Inspired by the following topic over in the LunaLua help section of the forum: viewtopic.php?t=29570
I decided to write a lua script for a character select screen. Out of the box, the script is designed to only be accesed from the overworld. You can, however, by modifying the code, it can be also accessed from inside levels. If you need help with this, please feel free to reach out to me again.
I also included an example for a set of conditions for unlocking characters. I also included a how to use file to maybe already answer a few questions.

But without further ado, please view the script in action:


Update: V. 1.1 is out now. It's a rather small update offering to toggle whether or not locked characters should be visible at all
Update 2: V 1.2 out now. Now, you can set whether or not a locked character should be visible in the char select screen for every character individually.
Update 3: V 2.0 out now. this time, more changes have occured so see the post below for more details. For short, code is now more organized, styles have been added, the character select screen is now a menu point with the corresponding advantages and options for character names and lives display habe been added.

And finally, the download links:
V 1.0: https://drive.google.com/drive/folders/ ... drive_link
V 1.1: https://drive.google.com/file/d/1Vs1eE4 ... drive_link
V 1.2: https://drive.google.com/drive/folders/ ... drive_link
V 2.0: https://drive.google.com/drive/folders/ ... drive_link
Last edited by Gaming-Dojo on Sun Aug 24, 2025 5:51 pm, edited 7 times in total.

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

Re: Character select screen

Postby mariobrigade2018 » Sun Aug 10, 2025 4:43 pm

Cool. Is there’s way to hide characters that you for sure don’t want the player to play as?

Gaming-Dojo
Tweeter
Tweeter
Posts: 143
Joined: Mon Jan 25, 2016 9:20 am
Pronouns: he/him
Contact:

Re: Character select screen

Postby Gaming-Dojo » Sat Aug 16, 2025 10:08 am

hello Mariobrigade, hello folks,

Here comes a small update with the change requested by mariobrigade. Just swap out the characterselect.lua file from the original release with the one from the following download and you are good to go. Feel also free to view the updated how to use file provided with the V 1.1 Update download as well. In the future, I might also work on 2-player-support as well as organizing the chars without spaced for not unlocked characters when hiding not unlocked characters as well as integrating the char select menu into the customPauseMenu script so it does not interfere with worldmap navigation.

And here, finally, a screenshot of the update with hidden unlockable characters in action:
Image

And last but not least the download for the update:
https://drive.google.com/file/d/1Vs1eE4 ... drive_link

So stay tuned.
Gaming-Dojo

Gaming-Dojo
Tweeter
Tweeter
Posts: 143
Joined: Mon Jan 25, 2016 9:20 am
Pronouns: he/him
Contact:

Re: characterselect.lua - choose your character with style!

Postby Gaming-Dojo » Sun Aug 17, 2025 8:55 am

Hello folks,

another small update again. It provides a solution to set for each character that is not unlocked (unlocked characters are always visible in the char select screen as wouldn't make sense otherwise) individually, whether it should appear in the character select screen in grey with a lock icon or not appear in the character select screen at all.

Here's a picture of how this could look in action. Mario, Luigi, Toad and Rosalina are unlocked, Peach, Link, Wario and Bowser are locked, but displayed in the character select screen and all other characters are locked and hidden in the character select screen.

Image

Possible usecases for setting characters to not be visible in the char select screen could be to avoid misleading the player into thinking they could play as characters they actually never can or to avoid spoiling future unlockable characters and with those characters maybe parts of the plot.

But now, without furter ado, the download link for the new update. It includes the updated characterselect.lua script as well as an updated how_to_use.txt file:
https://drive.google.com/drive/folders/ ... drive_link
Last edited by Gaming-Dojo on Mon Aug 18, 2025 2:12 pm, edited 1 time in total.

Shaktool
2025 Egg Hunter
2025 Egg Hunter
Posts: 538
Joined: Thu Jul 25, 2024 5:34 am
Flair: zip zoom
Pronouns: male

Re: Character select screen

Postby Shaktool » Sun Aug 17, 2025 10:05 am

i wonder if there will be menu customization

Gaming-Dojo
Tweeter
Tweeter
Posts: 143
Joined: Mon Jan 25, 2016 9:20 am
Pronouns: he/him
Contact:

Re: characterselect.lua - choose your character with style!

Postby Gaming-Dojo » Sun Aug 17, 2025 11:06 am

Shaktool wrote:
Sun Aug 17, 2025 10:05 am
i wonder if there will be menu customization
Do you mean by menu customization rather how the character select menu looks or how it works? If the former, this can be customized rather easily, at least for changing the background, cursor and sprites for the characters. Changing the background and cursor is as easy as replacing a file (make sure it is named exactly like the original file) If the latter, this is what I plan on working next. Here, I want to achieve that the game automatically recognizes, how many characters are shown and then automatically adjust, how many rows and columns are drawn, maybe even adding support for customizing the scale of the sprites. If you mean something completely different, please specify, what exactly you mean.
Last edited by Gaming-Dojo on Mon Aug 18, 2025 2:12 pm, edited 1 time in total.

Shaktool
2025 Egg Hunter
2025 Egg Hunter
Posts: 538
Joined: Thu Jul 25, 2024 5:34 am
Flair: zip zoom
Pronouns: male

Re: Character select screen

Postby Shaktool » Sun Aug 17, 2025 12:59 pm

Like minimumHUD, i wonder if there are various skins you can type in the file and it will change.

also i do recommend changing the title to be more akin to the other lua lib, for example: charSelect.lua - choose your character!

i do also ponder about a SMB2 character select screen, like minimum just the borders, but that is also fine

Gaming-Dojo
Tweeter
Tweeter
Posts: 143
Joined: Mon Jan 25, 2016 9:20 am
Pronouns: he/him
Contact:

Re: characterselect.lua - choose your character with style!

Postby Gaming-Dojo » Mon Aug 18, 2025 2:07 pm

Shaktool wrote:
Sun Aug 17, 2025 12:59 pm
Like minimumHUD, i wonder if there are various skins you can type in the file and it will change.

also i do recommend changing the title to be more akin to the other lua lib, for example: charSelect.lua - choose your character!

i do also ponder about a SMB2 character select screen, like minimum just the borders, but that is also fine
will definitely come. for the SMB2 background: can be done very easily by just deleting the bg.png file out of the characterSelectGraphics folder, load in the SMB2 Char Select background and rename it to bg.png. However, I'm not sure if the characters fit the layout then. However, this is the next thing I'll be working at after making the char select a menu in customPause.lua which is what I'm working on right now. When finished, this will work with 2 arrays for x and y positions for the individual characters as well as adding an array that only contains the visible characters and using that array then for drawing instead of the full array. This would remove the gaps that are present in the current version.

Also, thanks for the naming idea. Actually sounds pretty nice, so I will see, if I can just change the title of the topic.

FireSeraphim
Buster Beetle
Buster Beetle
Posts: 86
Joined: Wed Apr 16, 2014 4:21 pm
Flair: Verified Professional Vampire Hunter
Contact:

Re: characterselect.lua - choose your character with style!

Postby FireSeraphim » Sat Aug 23, 2025 6:09 pm

I too, am in favour of a SMB2 styled character select screen, with the music included. I look forward to seeing this API and it's accommodating pause menu API completed.

Gaming-Dojo
Tweeter
Tweeter
Posts: 143
Joined: Mon Jan 25, 2016 9:20 am
Pronouns: he/him
Contact:

Re: characterselect.lua - choose your character with style!

Postby Gaming-Dojo » Sun Aug 24, 2025 5:44 pm

FireSeraphim wrote:
Sat Aug 23, 2025 6:09 pm
I too, am in favour of a SMB2 styled character select screen, with the music included. I look forward to seeing this API and it's accommodating pause menu API completed.
Hallo FireSeraphim, hello folks,

thank you for the idea. Will definitely include the music of the respective games for every style but will take me some more time. For the time being however, I have good news. With this post, I release V 2.0 of my script, featuring a refactor of the code so all variables for positioning are now at the top of the script thus easy to access. Furtchermore, I have now included the option to show the names of the characters below them as well as an option for showing, how many lives the player has left (currently just supports the mem value. In the future however, I might include live counters of other lua scripts as well. Another update is, that I have not set up 2 predefined stlyes (Mario World and Mario Bros 2 USA (AllStars)). In the Future more styles will definitely come (SMB1 and SMB3 (both Allstars) are planned, some more ideas include Super Mario Kart, Megaman, Super Mario Maker 2 and Zelda A Link to the Past. Another big change is, I implemented my script now, as planned, in the customPause.lua script by Marioman2007 so credit goes there for the script of which I included a modified version in my download as well. Furthermore, comments have been added to the characterselect.lua script and how to use.txt and credits.txt files have been updated. A new styles.txt file has also been added where you can see all predefined styles with a short description.

But now that we went over all important changes, just see some images of the script in Action:

SMB2 Style: Image
SMB2 Style with locked characters: Image
SMW Style: Image
customPause Menu with char select option: Image

And here comes the download for V 2.0: https://drive.google.com/drive/folders/ ... drive_link


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari