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: 147
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.

Update 4: V 3.0 out now. See Post below for the changes in detail.

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
V 3.0: https://drive.google.com/drive/folders/ ... sp=sharing
Last edited by Gaming-Dojo on Sun Sep 07, 2025 12:04 pm, edited 9 times in total.

mariobrigade2018
Eerie
Eerie
Posts: 731
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: 147
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: 147
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: 563
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: 147
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: 563
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: 147
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: 147
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

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

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

Postby Gaming-Dojo » Sat Sep 06, 2025 4:38 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.
Hello folks, hello FireSeraphim,

music of SMB2 as well as Styles to choose from are complete now, also you can now select your character at the start of each level, but options for selecting on worldmap and/or in level are also supported.

I have now worked some more on the character select script so I will be able to release another update tomorrow. It will include support for music in the title menu as well as support for styles with 5 ones already included in this release (Mario World, Bros 2, Bros 3 (inspired by the spades cards minigame) as well as a megaman 7 password screen inspired style and one mimicking the input name screen from The Legend of Zelda A Link to the Past. I also have some more ideas, which I will include in future releases. Also, I want to ask you, if I should leave the character display as is with just grid-structures being possible or if I should add in the option for free definition of coords for each character similar to how I handled it in an earlier version.

Untill tomorrow with new screenshots, videos and a new release.

Best regards
Gaming-Dojo

Added in 5 minutes 31 seconds:
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.
music of SMB2 as well as Styles to choose from are complete now, also you can now select your character at the start of each level, but options for selecting on worldmap and/or in level are also supported

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

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

Postby Gaming-Dojo » Sun Sep 07, 2025 12:03 pm

Hello folks,

as announced yesterday, here's the new version 3.0 of my character select screen. As much has changed since the last version, I recommend just copying all files in the episode/level folder and kick out the old ones. Now, there are toggles, whether or not the player should be able to switch characters at the start of a level, anytime on the overworld or anytime inside a level with the support of multiple of these options being enabled at the same time.

Apart from that, the issue of unlocked characters resetting after a level was exited (death or beaten the level) as well as the selected characters being reset has been resolved. Another thing present in this release are new styles, bringing it to a total of 5 styles to chosse from or creating your own. In styles, now sounds for confirmation that a character has been selected and a sound when the cursor is moved have been added as well as background music for the menu has been added. Also when on world map and on a level at the same time, the players position is slightly shifted downwards to avoid entering a level by pressing jump button to confirm the character selection.

But now, without further ado, some more videos and screens of the new functionaliity and styles and musics in action:

First, some screenshots:

Image
Image
Image
Image

and now, the yideos:








and here is the new download link for Version 3.0:
https://drive.google.com/drive/folders/ ... sp=sharing

If you have any questions, ideas of concerns, just feel free to reach out. Also if you have cool styles you made for my script, feel free to share them and I might include them in a future update (credit will be given to you then, of course)

Best regards
Gaming-Dojo


Return to “LunaLua”

Who is online

Users browsing this forum: Mal8rk and 3 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari