Page 1 of 1

worldPlayerDisable.lua

Posted: Fri Apr 17, 2020 12:09 pm
by DigitalDetective47
worldPlayerDisable.lua is a script(?) that (mostly) fixes a bug in SMBX2 BETA 4 Patch 1 where the player can select a character that is not allowed within the episode in episodes where more than one character is allowed. Do NOT use this script for episodes with only one character allowed, because it will most likely break in 2‐player mode. To use it simply enter these lines of code into your map.lua file:

Code: Select all

worldPlayerDisable=API.load("worldPlayerDisable")
worldPlayerDisable.allowedPlayers={playerList}
worldPlayerDisable.generateMask()
Replace playerList with a list of all players that should be allowed in the episode. If you need to have this character list change at some point during your episode, simply duplicate the second & third lines. If you are using this at a point in the future where SMBX2 has more than 16 characters, you need to also include this line somewhere:

Code: Select all

worldPlayerDisable.playerTotal=characterCount
Replace characterCount with the current number of characters in SMBX2.
Download here: https://drive.google.com/file/d/1ueALiK ... sp=sharing
The reason that I say that it mostly fixes this bug is because the character that would be shown without the script (the disabled one) is still displayed for one frame.
Spoiler: show
Image

Re: worldPlayerDisable.lua

Posted: Fri Apr 17, 2020 12:15 pm
by Emral
Fixing the one-frame thing is incredibly trivial: Just use onTickEnd.

Re: worldPlayerDisable.lua

Posted: Fri Apr 17, 2020 12:20 pm
by DigitalDetective47
Enjl wrote:
Fri Apr 17, 2020 12:15 pm
Fixing the one-frame thing is incredibly trivial: Just use onTickEnd.
Actually no, because the game doesn't run ticks while paused.

Re: worldPlayerDisable.lua

Posted: Fri Apr 17, 2020 12:24 pm
by Emral
Ninji2701 wrote:
Fri Apr 17, 2020 12:20 pm
Enjl wrote:
Fri Apr 17, 2020 12:15 pm
Fixing the one-frame thing is incredibly trivial: Just use onTickEnd.
Actually no, because the game doesn't run ticks while paused.
Then, onDraw

Re: worldPlayerDisable.lua

Posted: Fri Apr 17, 2020 12:26 pm
by DigitalDetective47
Enjl wrote:
Fri Apr 17, 2020 12:24 pm
Ninji2701 wrote:
Fri Apr 17, 2020 12:20 pm
Enjl wrote:
Fri Apr 17, 2020 12:15 pm
Fixing the one-frame thing is incredibly trivial: Just use onTickEnd.
Actually no, because the game doesn't run ticks while paused.
Then, onDraw
Causes issues where attempting moving right past characters will simply raise the preview of your current character instead of switching to the next valid character.

Re: worldPlayerDisable.lua

Posted: Fri Apr 17, 2020 12:29 pm
by Emral
Ninji2701 wrote:
Fri Apr 17, 2020 12:26 pm
Then there are issues elsewhere in your code. Fixing the 1 frame thing is very easy by running relevant parts of your code after smbx's main call and before drawing, and if it wouldn't be fixed in smbx2 in a matter of days, I would spend a couple minutes to show so.

Re: worldPlayerDisable.lua

Posted: Sat Apr 18, 2020 7:11 am
by Hoeloe
This library is completely pointless. A Lua system for doing this exists natively:

Code: Select all

local pm = require("playerManager")
pm.overworldCharacters = {list of characters}

Re: worldPlayerDisable.lua

Posted: Tue Mar 08, 2022 2:28 pm
by Mal8rk
The download link doesen't work

Re: worldPlayerDisable.lua

Posted: Wed Mar 09, 2022 2:21 am
by Marioman2007
POPME wrote:
Tue Mar 08, 2022 2:28 pm
The download link doesen't work
Hoeloe wrote:
Sat Apr 18, 2020 7:11 am
This library is completely pointless. A Lua system for doing this exists natively:

Code: Select all

local pm = require("playerManager")
pm.overworldCharacters = {list of characters}