resetdoors.lua - Full rewind (BETA)

Share and discuss custom LunaLua code and content packs for SMBX2.

Moderator: Userbase Moderators

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

resetdoors.lua - Full rewind (BETA)

Postby Emral » Thu May 16, 2019 3:21 pm

Everyone who knows about SMW and SMM probably missed this feature for like 10 years.

That said, it's not perfect. There are edge cases that this code may not account for. Please read the notice at the end of the post for more information.

Recommended for use in one-screen puzzle levels primarily.

Download:
https://pastebin.com/TLkGsyrp

Demo:
Spoiler: show
Image
How to use:
Load the library and it works by default!
Customization options:
resetdoors.blacklistNPCS({list of npc ids}) will exclude those IDs from resetting
resetdoors.whitelistWarps({list of warp ids}) will whitelist those IDs as reset doors. If NO warps are whitelisted, ALL warps are reset doors. Even instant warps and pipes.
resetdoors.blocks = true/false - toggles block resets (default true)
resetdoors.npcs = true/false - toggles npc resets (default true)

NOTICE AT THE END OF THE POST
This is a demo.
You might encounter crashes with certain new NPCs.
This might have lag spikes in large levels/large sections with a lot of NPCs.

KNOWN EDGE CASES (will be fixed in the future):
-Enemies that are still spawned but have fallen out of the section will not respawn until their natural despawn.
-Paddlewheels break!
-By extension, everything with orbits breaks!
-New springs break!
-more?

Please report any breaks you find with this in this thread because finding new NPCs that break from this help find faulty code with the NPCs themselves! Sneaky bugs.

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

Re: resetdoors.lua - Full rewind (BETA)

Postby Hoeloe » Thu May 16, 2019 6:34 pm

Wonder if it might be worth actually making the reset door an NPC, without requiring a warp and just simulating the animation.

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

Re: resetdoors.lua - Full rewind (BETA)

Postby Emral » Fri May 17, 2019 3:39 pm

Hoeloe wrote:
Thu May 16, 2019 6:34 pm
Wonder if it might be worth actually making the reset door an NPC, without requiring a warp and just simulating the animation.
An NPC? Interesting. I considered it might be a good basegame inclusion alongside pipecannons when we are able to add more warp types. I also thought about it being linked to a BGO that has a specific door sprite, but that wouldn't really work well if a pipe were responsible for a reset, heh.

In any case:
v0.9.1 changelog:
-NPCs now remember their ai values
-Blacklisted NPCs no longer permanently die upon reset (oops!)
-NPCs now remember their direction properly

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

Re: resetdoors.lua - Full rewind (BETA)

Postby Hoeloe » Fri May 17, 2019 5:36 pm

Enjl wrote:
Fri May 17, 2019 3:39 pm
I considered it might be a good basegame inclusion alongside pipecannons when we are able to add more warp types.
An alternative might be to have a checkbox on the warps (kind of like the "two way warp" box). Would need the Lua side PGE-FL implementation though.

squp
Snifit
Snifit
Posts: 211
Joined: Sat Aug 12, 2017 10:10 pm
Flair: worm
Pronouns: she/it
Contact:

Re: resetdoors.lua - Full rewind (BETA)

Postby squp » Thu May 30, 2019 4:30 am

For some reason this doesn't work at all for me on my own level. I'm aware of the fact warps start at 0 like sections, but when I enter a reset door in my own level, it doesn't work. The reset doors are used in (someone else')s MaGLX3 submission and they work absolutely fine. I would post the code but I'm currently away from my PC.
Also you wrote "BlacklistNPCs" wrong in the OP. You capitalised the S.

SuperAlex
2025 Egg Hunter
2025 Egg Hunter
Posts: 225
Joined: Mon Nov 02, 2020 3:02 pm
Flair: Spriting
Pronouns: He/Him
Contact:

Re: resetdoors.lua - Full rewind (BETA)

Postby SuperAlex » Wed Jan 19, 2022 7:03 pm

Enjl wrote:
Thu May 16, 2019 3:21 pm
Everyone who knows about SMW and SMM probably missed this feature for like 10 years.
Ummm Reset doors is not working because I put warp white list in my luna file
Image

Image

SuperAlex
2025 Egg Hunter
2025 Egg Hunter
Posts: 225
Joined: Mon Nov 02, 2020 3:02 pm
Flair: Spriting
Pronouns: He/Him
Contact:

Re: resetdoors.lua - Full rewind (BETA)

Postby SuperAlex » Fri Jan 21, 2022 2:36 pm

Enjl wrote:
Thu May 16, 2019 3:21 pm
Everyone who knows about SMW and SMM probably missed this feature for like 10 years.

That said, it's not perfect. There are edge cases that this code may not account for. Please read the notice at the end of the post for more information.

Recommended for use in one-screen puzzle levels primarily.

Download:
https://pastebin.com/TLkGsyrp

Demo:
Spoiler: show
Image
How to use:
Load the library and it works by default!
Customization options:
resetdoors.blacklistNPCS({list of npc ids}) will exclude those IDs from resetting
resetdoors.whitelistWarps({list of warp ids}) will whitelist those IDs as reset doors. If NO warps are whitelisted, ALL warps are reset doors. Even instant warps and pipes.
resetdoors.blocks = true/false - toggles block resets (default true)
resetdoors.npcs = true/false - toggles npc resets (default true)

NOTICE AT THE END OF THE POST
This is a demo.
You might encounter crashes with certain new NPCs.
This might have lag spikes in large levels/large sections with a lot of NPCs.

KNOWN EDGE CASES (will be fixed in the future):
-Enemies that are still spawned but have fallen out of the section will not respawn until their natural despawn.
-Paddlewheels break!
-By extension, everything with orbits breaks!
-New springs break!
-more?

Please report any breaks you find with this in this thread because finding new NPCs that break from this help find faulty code with the NPCs themselves! Sneaky bugs.
Hello in the problem of the top


Return to “LunaLua”

Who is online

Users browsing this forum: Timtams72 and 5 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari