Page 1 of 1

How do I keep Mario as big Mario?

Posted: Sat Nov 20, 2021 8:14 pm
by Grimlox_Tv
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.

Re: How do I keep Mario as big Mario?

Posted: Sun Nov 21, 2021 8:12 am
by deice
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.

Re: How do I keep Mario as big Mario?

Posted: Sun Nov 21, 2021 12:54 pm
by Grimlox_Tv
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?.

Re: How do I keep Mario as big Mario?

Posted: Sun Nov 21, 2021 1:00 pm
by deice
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.

Re: How do I keep Mario as big Mario?

Posted: Sun Nov 21, 2021 5:07 pm
by Emral
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

Re: How do I keep Mario as big Mario?

Posted: Mon Nov 22, 2021 8:03 am
by deice
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