Restricting characters for levels

Post here for help and support regarding LunaLua and SMBX2's libraries and features.
Wrath666
Cheep-Cheep
Cheep-Cheep
Posts: 13
Joined: Thu Dec 23, 2021 3:06 pm
Flair: Anger & Hatred
Pronouns: he/him

Restricting characters for levels

Postby Wrath666 » 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?

deice
Volcano Lotus
Volcano Lotus
Posts: 549
Joined: Fri Jul 23, 2021 7:35 am

Re: Restricting characters for levels

Postby deice » Wed May 18, 2022 5:24 pm

while this should probably go inside the "lunalua help" subforum, you can filter the player's character as such:

Code: Select all

local setChar = CHARACTER_MARIO

function onStart()
	player.character = setChar 
end
the list of character constants can be found here, you can replace "CHARACTER_MARIO" with any of them.
i believe that enjl said this feature won't require lua in the next version.

Hoeloe
Foo
Foo
Posts: 1463
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: Restricting characters for levels

Postby Hoeloe » Sat May 21, 2022 11:10 am

deice wrote:
Wed May 18, 2022 5:24 pm
while this should probably go inside the "lunalua help" subforum, you can filter the player's character as such:

Code: Select all

local setChar = CHARACTER_MARIO

function onStart()
	player.character = setChar 
end
the list of character constants can be found here, you can replace "CHARACTER_MARIO" with any of them.
i believe that enjl said this feature won't require lua in the next version.
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.


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 2 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari