Page 1 of 1

Power Up and Damage Pause Code. Should be Conflictless.

Posted: Wed Oct 19, 2022 4:47 pm
by Alucardium
This is my first post here, hello!

I wrote a script that adds damage pause to the game. It notes whether it's supposed to happen or not so things like the SMB2 Timer powerup still work, and it shouldn't conflict with other code or affect existing level geometry.

Here is a link to the .lua:
https://pastebin.com/HA36zjCR

Image

I think the way this stuff works you guys can use it when making particular levels. I personally use this in scripts/base/game, and added this line to lunabase.lua under require("base/darkness"):

Code: Select all

require("base/game/DamagePause");
There's already a script that does something like this, but it made springs in certain levels disappear as a side effect. As a result it made progression impossible when I was playing with my little bro. I decided to rewrite the function from scratch in a way that shouldn't conflict with anything. I figured it's in good etiquette to link the file anyways, as it inspired this whole thing:
Unlike mine currently, this script pauses other players as well, so it would be nice if you could check it out here: viewtopic.php?f=101&t=28358

If my current LUA experience hasn't failed me, this code should be immune to any edge cases.

If you find any bugs, let me know so I can fix them!

Known bugs:
  • Does not freeze the other player during multiplayer (I will make instructions to disable the fix for preference.)

Re: Power Up and Damage Pause Code. Should be Conflictless.

Posted: Wed Oct 19, 2022 10:14 pm
by Emral
Useful script for episode creators but you should really not meddle with your base installation like this.

Re: Power Up and Damage Pause Code. Should be Conflictless.

Posted: Thu Oct 20, 2022 9:56 am
by Alucardium
Enjl wrote:
Wed Oct 19, 2022 10:14 pm
Useful script for episode creators but you should really not meddle with your base installation like this.
👍 For sure. It's definitely not worked out with larger scope scripts, and It's definitely not something you should do if you're not fine with troubleshooting. So far it's only been fine with smaller scripts, and even then you might have to configure them a bit.

Some examples where it hasn't worked out for me have been the Extended Koopas overhaul that reworks base koopas, and MarioMan's pause menu. On the other hand, it's worked out so far with things like fast fireballs, modern reserve items, anotherPowerDownLibrary (though I personally don't use it), coyotetime, your playerphysicspatch, and shelljumping (though I had to decrease the leniency because you could hurt yourself throwing shy guys).

It heavily depends on how the code itself was designed or meant to be implemented. You definitely need to know the cause and effect of enabling things, because the majority of levels weren't designed with random ol' scripts in mind and vice versa.

Re: Power Up and Damage Pause Code. Should be Conflictless.

Posted: Wed Feb 15, 2023 7:45 am
by FutureNyanCat
By the way if you take damage during editor playtesting and you try to pause the game while everything is paused, the 1.3 pause menu will come up, it will resolve itself if the damage pause stops.

Re: Power Up and Damage Pause Code. Should be Conflictless.

Posted: Wed Feb 15, 2023 8:21 am
by deice
FutureNyanCat wrote:
Wed Feb 15, 2023 7:45 am
By the way if you take damage during editor playtesting and you try to pause the game while everything is paused, the 1.3 pause menu will come up, it will resolve itself if the damage pause stops.
this is a known quirk of the tester, occurs consistently if Defines.levelFreeze gets set manually through a lua script.

Re: Power Up and Damage Pause Code. Should be Conflictless.

Posted: Wed Jul 05, 2023 3:01 am
by dragonfan96
So um with it using Defines.levelFreeze apart of DamagePause.lua script, it actually makes the stopwatch(and reserve green stopwatch(SMB3)) NPC cease to function..