Restricting characters for levels
Posted: Wed May 18, 2022 1:54 pm
Is there a way to restrict the playable character to 1 specific character for a level without using Character Blocks? Like maybe a lua code or something?
Forums for SMBX
https://www.smbxgame.com/forums/
Code: Select all
local setChar = CHARACTER_MARIO
function onStart()
player.character = setChar
end
It's actually better to use player:transform(setChar) instead of setting the character field directly. Changing the character in this way is the same as hitting a character switch block, which is not true of just assinging to player.character.deice wrote: ↑Wed May 18, 2022 5:24 pmwhile this should probably go inside the "lunalua help" subforum, you can filter the player's character as such:
the list of character constants can be found here, you can replace "CHARACTER_MARIO" with any of them.Code: Select all
local setChar = CHARACTER_MARIO function onStart() player.character = setChar end
i believe that enjl said this feature won't require lua in the next version.