nobrokensmbxkicker.lua: Now game over and read credits without launching the broken SMBX launcher! (v1.1.0)

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

Moderator: Userbase Moderators

SpencerlyEverly
Banned
Posts: 72
Joined: Tue Jul 22, 2014 5:23 pm
Pronouns: they/them
Contact:

nobrokensmbxkicker.lua: Now game over and read credits without launching the broken SMBX launcher! (v1.1.0)

Postby SpencerlyEverly » Sat Apr 30, 2022 11:49 am

Since coding these into SMAS++ (Some are scrapped but are actually released now), I did wanna make sure there was a library dedicated to not kicking into the broken SMBX launcher (Found when Saving/Quitting any SMBX 1.3 episode without a custom pause menu).

So today, I now unveil...

nobrokensmbxkicker, a.k.a. A No Broken Launcher Loader Preventer 1.3

This can be replaceable for all episodes. Simply add the files/folders and .lua files on any 1.3 episode and you're good to go! Make sure you aren't replacing any files before copying though. If there are any conflicing credits/gameover folders, let me know asap!

You can load this with pausemenu13.lua to make a fully compatible 1.3 episode experience!

Download it here.

Enjoy!

(Code by me! This time.)

Last edited by SpencerlyEverly on Tue Nov 29, 2022 11:18 pm, edited 3 times in total.

MrDoubleA
Edward
Edward
Posts: 394
Joined: Mon Aug 20, 2018 7:02 am
Flair: How much munchers?

Re: nobrokensmbxkicker.lua: Now game over and read credits without launching the broken SMBX launcher! (v1.0)

Postby MrDoubleA » Sat Apr 30, 2022 12:06 pm

There's a big issue with how the game over code works. It uses a variable called playerlives, which is initialised as such:

Code: Select all

local playerlives = mem(0x00B2C5AC,FIELD_FLOAT) --The lives count
... BUT, memory addresses simply don't work like that.
Take the case where the player starts off the level with 0 lives. "playerlives" is thus initialised to 0. Since this is just a usually variable, it will not update at all unless your own code does it. This is because variables store the VALUE assigned to them, and keeps nothing of where it came from.
If you, from here, got a few extra lives, but then died without exiting/restarting the level, you would go straight to the game over sequence.
The easy fix is just to use the actual mem address instead of an extra variable.

Another thing, but one that has no baring on functionality: the game over code is very repetitive. It repeats the same code for both players (which, aside from minor things like no supermario128 support, is just kinda ugly and hard to edit in the future). You can fix this just by using a loop:

Code: Select all

for _,p in ipairs(Player.get()) do
	-- The code here will be run for every single player. 'p' represents the player it is *currently* handling.
	-- 'p' is also the *player itself*, NOT an index. This means you can just do p.x, p.y, p.deathTimer, etc. with no need for Player().
end

SpencerlyEverly
Banned
Posts: 72
Joined: Tue Jul 22, 2014 5:23 pm
Pronouns: they/them
Contact:

Re: nobrokensmbxkicker.lua: Now game over and read credits without launching the broken SMBX launcher! (v1.0)

Postby SpencerlyEverly » Sat Apr 30, 2022 12:16 pm

MrDoubleA wrote:
Sat Apr 30, 2022 12:06 pm
There's a big issue with how the game over code works. It uses a variable called playerlives, which is initialised as such:

Code: Select all

local playerlives = mem(0x00B2C5AC,FIELD_FLOAT) --The lives count
... BUT, memory addresses simply don't work like that.
Take the case where the player starts off the level with 0 lives. "playerlives" is thus initialised to 0. Since this is just a usually variable, it will not update at all unless your own code does it. This is because variables store the VALUE assigned to them, and keeps nothing of where it came from.
If you, from here, got a few extra lives, but then died without exiting/restarting the level, you would go straight to the game over sequence.
The easy fix is just to use the actual mem address instead of an extra variable.

Another thing, but one that has no baring on functionality: the game over code is very repetitive. It repeats the same code for both players (which, aside from minor things like no supermario128 support, is just kinda ugly and hard to edit in the future). You can fix this just by using a loop:

Code: Select all

for _,p in ipairs(Player.get()) do
	-- The code here will be run for every single player. 'p' represents the player it is *currently* handling.
	-- 'p' is also the *player itself*, NOT an index. This means you can just do p.x, p.y, p.deathTimer, etc. with no need for Player().
end
Thanks for the suggestions! I'm gonna soon release v1.0.1 that'll implement these fixes. As usual, thanks for the epic reports MDA

Woshee_real
Shy Guy
Shy Guy
Posts: 9
Joined: Sat Oct 17, 2020 8:10 pm
Flair: GO NUTS!
Contact:

Re: nobrokensmbxkicker.lua: Now game over and read credits without launching the broken SMBX launcher! (v1.0.1)

Postby Woshee_real » Sun May 01, 2022 5:06 am

Can this work in custom episodes?

SpencerlyEverly
Banned
Posts: 72
Joined: Tue Jul 22, 2014 5:23 pm
Pronouns: they/them
Contact:

Re: nobrokensmbxkicker.lua: Now game over and read credits without launching the broken SMBX launcher! (v1.0.1)

Postby SpencerlyEverly » Mon May 02, 2022 11:10 am

Woshee_real wrote:
Sun May 01, 2022 5:06 am
Can this work in custom episodes?
Provided they didn't remove lives, or override anything related to the code that was made, yes. But if anything needs to be overwritten, you can change the code correspondingly to redirect to a different lvlx, and rename folders and files if anything needs to be changed over.

In other words, I can't take any chances of it working fully in X2 episodes.

SpencerlyEverly
Banned
Posts: 72
Joined: Tue Jul 22, 2014 5:23 pm
Pronouns: they/them
Contact:

Re: nobrokensmbxkicker.lua: Now game over and read credits without launching the broken SMBX launcher! (v1.1.0)

Postby SpencerlyEverly » Tue Nov 29, 2022 11:19 pm

After so long without an update, v1.1.0 has been released! This gives in some code cleanup and stability, pretty much (No new features this time, unfortunately).

Download it now!

Seba the DragonBear
Goomba
Goomba
Posts: 2
Joined: Sat May 05, 2018 11:30 pm

Re: nobrokensmbxkicker.lua: Now game over and read credits without launching the broken SMBX launcher! (v1.1.0)

Postby Seba the DragonBear » Thu Dec 01, 2022 5:41 pm

Massive Bejeweled Twist vibes with the "Game Over" voice xd


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari