How do I keep Mario as big Mario?

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

Moderator: Userbase Moderators

Grimlox_Tv
Goomba
Goomba
Posts: 2
Joined: Mon Mar 26, 2018 11:32 am
Contact:

How do I keep Mario as big Mario?

Postby Grimlox_Tv » Sat Nov 20, 2021 8:14 pm

Hi I'm trying to figure out a way to lock Mario in his Super Mushroom form and make it so he doesn't revert to his smaller self. I'm trying to create a series of levels where the player is supposed to only be in Super mode and everything should be a one hit kill may they be hazards, enemies, or traps. Admittedly I'm not the best coder so if anyone has an answer you'd be a great help.

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

Re: How do I keep Mario as big Mario?

Postby deice » Sun Nov 21, 2021 8:12 am

try putting this code in your level's luna.lua file:

Code: Select all

function onStart()
	player.powerup = PLAYER_BIG
end

function onTickEnd()
	if(player.powerup == PLAYER_SMALL and player:mem(0x13E, FIELD_WORD) == 0) then
		player:kill()
	end
end
also, just a heads up, but you should probably post questions like this in lunalua help next time.

Grimlox_Tv
Goomba
Goomba
Posts: 2
Joined: Mon Mar 26, 2018 11:32 am
Contact:

Re: How do I keep Mario as big Mario?

Postby Grimlox_Tv » Sun Nov 21, 2021 12:54 pm

deice wrote:
Sun Nov 21, 2021 8:12 am
try putting this code in your level's luna.lua file:

Code: Select all

function onStart()
	player.powerup = PLAYER_BIG
end

function onTickEnd()
	if(player.powerup == PLAYER_SMALL and player:mem(0x13E, FIELD_WORD) == 0) then
		player:kill()
	end
end
also, just a heads up, but you should probably post questions like this in lunalua help next time.
Thank you, your help is much appreciated and I will keep that in mind for next time. Question though, what exactly does the luna.lua file look like?. In the folder the only world folder the only file I can spot is the desktop ini file. Is the Lua file the world file itself or is there something else I need to do to get the proper file?.

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

Re: How do I keep Mario as big Mario?

Postby deice » Sun Nov 21, 2021 1:00 pm

Grimlox_Tv wrote:
Sun Nov 21, 2021 12:54 pm
Thank you, your help is much appreciated and I will keep that in mind for next time. Question though, what exactly does the luna.lua file look like?. In the folder the only world folder the only file I can spot is the desktop ini file. Is the Lua file the world file itself or is there something else I need to do to get the proper file?.
just create a text file, rename it to luna.lua, place it in your level folder like you would with custom graphics, and copy-paste the code inside.

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9890
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: How do I keep Mario as big Mario?

Postby Emral » Sun Nov 21, 2021 5:07 pm

deice wrote:
Sun Nov 21, 2021 8:12 am
try putting this code in your level's luna.lua file:

Code: Select all

function onStart()
	player.powerup = PLAYER_BIG
end

function onTickEnd()
	if(player.powerup == PLAYER_SMALL and player:mem(0x13E, FIELD_WORD) == 0) then
		player:kill()
	end
end
also, just a heads up, but you should probably post questions like this in lunalua help next time.
1) 0x13E is just the field player.deathTimer - easier to remember
2) Do you think it would be good here to use onPostPlayerHarm to handle the kill?

Code: Select all

function onPostPlayerHarm(harmedPlayer)
	harmedPlayer:kill()
end

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

Re: How do I keep Mario as big Mario?

Postby deice » Mon Nov 22, 2021 8:03 am

Enjl wrote:
Sun Nov 21, 2021 5:07 pm
1) 0x13E is just the field player.deathTimer - easier to remember
pgewiki moment
Enjl wrote:
Sun Nov 21, 2021 5:07 pm
2) Do you think it would be good here to use onPostPlayerHarm to handle the kill?

Code: Select all

function onPostPlayerHarm(harmedPlayer)
	harmedPlayer:kill()
end
to clarify for OP that there's a small difference in functionality:
- enjl's code will kill the player if they take damage in any way
- the code i originally posted will also kill the player if their powerup gets filtered, and won't work in two player mode


Return to “Help and Support”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari