Page 1 of 1

resetdoors.lua - Full rewind (BETA)

Posted: Thu May 16, 2019 3:21 pm
by Emral
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.

Re: resetdoors.lua - Full rewind (BETA)

Posted: Thu May 16, 2019 6:34 pm
by Hoeloe
Wonder if it might be worth actually making the reset door an NPC, without requiring a warp and just simulating the animation.

Re: resetdoors.lua - Full rewind (BETA)

Posted: Fri May 17, 2019 3:39 pm
by Emral
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

Re: resetdoors.lua - Full rewind (BETA)

Posted: Fri May 17, 2019 5:36 pm
by Hoeloe
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.

Re: resetdoors.lua - Full rewind (BETA)

Posted: Thu May 30, 2019 4:30 am
by squp
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.

Re: resetdoors.lua - Full rewind (BETA)

Posted: Wed Jan 19, 2022 7:03 pm
by SuperAlex
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

Re: resetdoors.lua - Full rewind (BETA)

Posted: Fri Jan 21, 2022 2:36 pm
by SuperAlex
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