anotherPowerDownLibrary.lua v1.1.2 - like powerUpGuard or altpsystem, but newer

Share and discuss custom LunaLua code and content packs for SMBX2.
KBM-Quine
Monty Mole
Monty Mole
Posts: 128
Joined: Wed Jan 15, 2014 11:10 am
Flair: Crazy with a K

anotherPowerDownLibrary.lua v1.1.2 - like powerUpGuard or altpsystem, but newer

Postby KBM-Quine » Sun Feb 07, 2021 5:54 pm

as you might guess, powerUpGuard was giving a fellow dev problems with camera related code, so this aims to fix that by not touching the camera what so ever.
i went to the drawing board on how to do this. i asked my self "how does 1.3 do "fire toad/peach with three hearts to super" power down?" and copied it nearly 1:1, with a few caveats.
if you'd like a link to that, here it is.
should be multiplayer compatible and usable on any character with a reserve box. the reason for characters with the heart system are not using this system by default is it'd defeat the point of the heart system. you can however use it still, check the documentation for more info. do note, it's majorly untested for heart system characters.

if you are unaware what powerUpGuard.lua or altpsystem.lua are, they made powerdown go from fire > small to fire > big > small instead. they have unfortunately become outdated or unweildly as described above. thus why this was made.

gifs: show
Image
Image
Image
basic use: show
- place the library in the base of your episode or level folder. you can place it elsewhere if you know what your doing, but this guide assumes your unfamiliar with this process.
- make a luna.lua file in the base of your episode or level folder. this is most easily done by making a new text document and renaming it to luna.lua (assuming you have show file extensions on. here's a guide on that for each windows version if you do not.) you can also use a text editor of choice to make one. select "All Files (".")" as the type and put .lua at the end of the filename when saving. make sure the file is luna.lua and not luna.lua.txt!
- place this code in your luna.lua file and save:

Code: Select all

local anotherPowerDownLibrary = require("anotherPowerDownLibrary")
and that should make it work as intended. there are settings you can customize as well. read the documentation spoiler for more information.
documentation: show
this section assumes you have some knowledge of lunalua/lua, fair warning.

if you want to blacklist/whitelist a character, you can like so:

Code: Select all

anotherPowerDownLibrary.setCharacterActive(charID, bool)
charID - can be either the a number or character constant, more info on that can be found here
bool - true if you want them using this system, false if not.

for more advanced use, there are a few other things that you can do:

Code: Select all

anotherPowerDownLibrary.enabled = bool
anotherPowerDownLibrary.customForcedState = number
anotherPowerDownLibrary.powerDownSFX = number or sound file
anotherPowerDownLibrary.enabled - whether this library is running or not, default is true
anotherPowerDownLibrary.customForcedState - the forced state the player is put into by the library. don't make this anything from here. default is 751, ala the custom range. the intention of using a custom forced state was to make this easily detectable in external code.
anotherPowerDownLibrary.powerDownSFX - the sound played during the power down state. default is 5. can be either an internal sound ID or a string pointing to a custom sound file. you can find a list of internal IDs here.

feel free to give any feedback or report bugs, have a nice day.
Image
Last edited by KBM-Quine on Mon Nov 27, 2023 11:05 pm, edited 8 times in total.

The Handwoven Box
Swooper
Swooper
Posts: 56
Joined: Sun Jul 31, 2016 10:35 am

Re: anotherPowerDownLibrary.lua - like powerUpGuard or altpsystem, but newer

Postby The Handwoven Box » Mon Apr 26, 2021 6:49 pm

Just what I was looking for!

AToMIC
Hoopster
Hoopster
Posts: 106
Joined: Fri Jan 24, 2014 2:57 pm
Flair: I'm here
Pronouns: He/Him

Re: anotherPowerDownLibrary.lua - like powerUpGuard or altpsystem, but newer

Postby AToMIC » Thu Apr 29, 2021 10:41 am

My dude, you found the cure. Power up guard was great and all, but I noticed was very buggy. Hopefully this one works as a newer alternative.

KBM-Quine
Monty Mole
Monty Mole
Posts: 128
Joined: Wed Jan 15, 2014 11:10 am
Flair: Crazy with a K

Re: anotherPowerDownLibrary.lua - like powerUpGuard or altpsystem, but newer

Postby KBM-Quine » Fri May 07, 2021 12:32 pm

so i realized the thing i was doing could be done better and have updated this as such. mostly moved from using a forcedState to check if the code should run to using onPlayerHarm. that's not to say there aren't some bugs squashed from this.

  • fixed a crash that would point to bowser if you were using this on the overworld.
  • fixed an accidental autocomplete that made it so ducking while being hurt erroneously moved the player upwards.
  • added anotherPowerDownLibrary.powerDownSFX, which allows you to play a custom sound upon APDLs forcedstate being called. see top post for more details, under documentation.
hope you all enjoy, thanks for looking and have a nice day!

Art
Shy Guy
Shy Guy
Posts: 5
Joined: Sat Aug 15, 2015 10:06 pm

Re: anotherPowerDownLibrary.lua - like powerUpGuard or altpsystem, but newer

Postby Art » Sun May 16, 2021 3:20 am

I must be doing something wrong but I can't get this to work, the previous one worked somehow.

So I'm putting the file in the episode folder, and pasting the ''local anotherPowerDownLibrary = require("anotherPowerDownLibrary")'' bit in the luna file, also tried lunaworld but that didn't work either. Is that correct or am I doing something wrong there?

KBM-Quine
Monty Mole
Monty Mole
Posts: 128
Joined: Wed Jan 15, 2014 11:10 am
Flair: Crazy with a K

Re: anotherPowerDownLibrary.lua v1.1 - like powerUpGuard or altpsystem, but newer

Postby KBM-Quine » Thu May 20, 2021 5:17 am

perhaps give a redownload? might have grabbed it while i was in the middle of updating it and got an earlier test of the newer implementation

Suckerman7 GM
Rocky Wrench
Rocky Wrench
Posts: 686
Joined: Fri Jun 19, 2015 9:42 am
Flair: Multiversal Traveller/Prismverse's God of Creation
Pronouns: he/him

Re: anotherPowerDownLibrary.lua - like powerUpGuard or altpsystem, but newer

Postby Suckerman7 GM » Thu May 20, 2021 5:20 am

Art wrote:
Sun May 16, 2021 3:20 am
I must be doing something wrong but I can't get this to work, the previous one worked somehow.

So I'm putting the file in the episode folder, and pasting the ''local anotherPowerDownLibrary = require("anotherPowerDownLibrary")'' bit in the luna file, also tried lunaworld but that didn't work either. Is that correct or am I doing something wrong there?
Have you added the quotation marks at the start and end of the code you are using to activate the lua code? If you do, then remove them.

KBM-Quine
Monty Mole
Monty Mole
Posts: 128
Joined: Wed Jan 15, 2014 11:10 am
Flair: Crazy with a K

Re: anotherPowerDownLibrary.lua v1.1.1 - like powerUpGuard or altpsystem, but newer

Postby KBM-Quine » Tue May 25, 2021 9:06 am

small update. i forgot to make sure this doesn't kick in in certain situations where you wouldn't lose your power up (getting hurt on a mount, having 3 health, being a fairy)

KBM-Quine
Monty Mole
Monty Mole
Posts: 128
Joined: Wed Jan 15, 2014 11:10 am
Flair: Crazy with a K

Re: anotherPowerDownLibrary.lua v1.1.2 - like powerUpGuard or altpsystem, but newer

Postby KBM-Quine » Mon May 31, 2021 11:27 pm

another small update. fixed starman not being as invincible as it should be. thanks to Lucky711 on discord for the find. link in the top post has been updated.

TheTrueMarioMaster
Blooper
Blooper
Posts: 199
Joined: Mon Mar 19, 2018 11:58 pm

Re: anotherPowerDownLibrary.lua v1.1.2 - like powerUpGuard or altpsystem, but newer

Postby TheTrueMarioMaster » Mon Jul 05, 2021 12:58 am

Is it possible with this code to make it so a character stays big after getting hit without making the character unkillable?

KBM-Quine
Monty Mole
Monty Mole
Posts: 128
Joined: Wed Jan 15, 2014 11:10 am
Flair: Crazy with a K

Re: anotherPowerDownLibrary.lua v1.1.2 - like powerUpGuard or altpsystem, but newer

Postby KBM-Quine » Tue Jul 06, 2021 7:12 am

TheTrueMarioMaster wrote:
Mon Jul 05, 2021 12:58 am
Is it possible with this code to make it so a character stays big after getting hit without making the character unkillable?
yes and no. the specific code here won't be suitable for that. but you can use this as a reference i suppose. at the very least, it'd involve using onPlayerHarm(). you can read more about that in X2 docs here.

Lunar Chris
Monty Mole
Monty Mole
Posts: 134
Joined: Mon Jan 06, 2014 9:51 pm
Flair: Moon Lord's Servant
Contact:

Re: anotherPowerDownLibrary.lua v1.1.2 - like powerUpGuard or altpsystem, but newer

Postby Lunar Chris » Sun Aug 22, 2021 12:49 pm

Very useful script, but I have one issue:
For some reason, this doesn't apply to every other level I make, even using my test level as the basis won't carry the script over. How do I make it so that it applies for all the levels for my episode?

MrDoubleA
Flurry
Flurry
Posts: 385
Joined: Mon Aug 20, 2018 7:02 am
Flair: How much munchers?
Pronouns: he/him

Re: anotherPowerDownLibrary.lua v1.1.2 - like powerUpGuard or altpsystem, but newer

Postby MrDoubleA » Sun Aug 22, 2021 1:11 pm

PikaChris wrote:
Sun Aug 22, 2021 12:49 pm
Very useful script, but I have one issue:
For some reason, this doesn't apply to every other level I make, even using my test level as the basis won't carry the script over. How do I make it so that it applies for all the levels for my episode?
That sounds like you put the luna.lua file into the level's folder. In order to apply to the whole episode, it must be in the episode folder instead.

Lunar Chris
Monty Mole
Monty Mole
Posts: 134
Joined: Mon Jan 06, 2014 9:51 pm
Flair: Moon Lord's Servant
Contact:

Re: anotherPowerDownLibrary.lua v1.1.2 - like powerUpGuard or altpsystem, but newer

Postby Lunar Chris » Sun Aug 22, 2021 1:37 pm

Well silly me. I did leave the Lua file in the level folder. Thanks.

Alucard648
Monty Mole
Monty Mole
Posts: 131
Joined: Sun Aug 16, 2015 3:45 am

Re: anotherPowerDownLibrary.lua v1.1.2 - like powerUpGuard or altpsystem, but newer

Postby Alucard648 » Wed Sep 01, 2021 12:33 am

KBM-Quine wrote:
Sun Feb 07, 2021 5:54 pm
the reason for characters with the heart system not being able to use it is it'd defeat the point of the heart system.
Characters with heart system should have +2 max HP to balance that.

Marioman2007
Lakitu
Lakitu
Posts: 474
Joined: Tue Aug 25, 2020 3:19 am
Flair: Dr. Bones
Pronouns: He/Him

Re: anotherPowerDownLibrary.lua v1.1.2 - like powerUpGuard or altpsystem, but newer

Postby Marioman2007 » Wed Sep 01, 2021 12:05 pm

Question: why is there anotherPowerDownLibrary.powerDownSFX if you can just use a custom SFX file like custom GFX?

KBM-Quine
Monty Mole
Monty Mole
Posts: 128
Joined: Wed Jan 15, 2014 11:10 am
Flair: Crazy with a K

Re: anotherPowerDownLibrary.lua v1.1.2 - like powerUpGuard or altpsystem, but newer

Postby KBM-Quine » Thu Sep 02, 2021 8:57 pm

Alucard648 wrote:
Wed Sep 01, 2021 12:33 am
KBM-Quine wrote:
Sun Feb 07, 2021 5:54 pm
the reason for characters with the heart system not being able to use it is it'd defeat the point of the heart system.
Characters with heart system should have +2 max HP to balance that.
that's ultimately outside of the scope of this library. this is just meant to be more versatile then the likes of powerUpGuard or altpsystem. if someone wants to, their free to make something like that. but i'm not interested in messing about with the HP system myself.
marioman2007 wrote:
Wed Sep 01, 2021 12:05 pm
Question: why is there anotherPowerDownLibrary.powerDownSFX if you can just use a custom SFX file like custom GFX?
to be honest, it's a silly thing on my end to have of done. it's actually caused me more headache then good in the end anyways. i've actually been thinking of reverting to an earlier version of this without .powerDownSFX. let me know how that sounds and i'll get to it eventually.

$h31d0nc00p3rfan
Rex
Rex
Posts: 33
Joined: Thu Jul 24, 2014 6:48 pm

Re: anotherPowerDownLibrary.lua v1.1.2 - like powerUpGuard or altpsystem, but newer

Postby $h31d0nc00p3rfan » Mon Nov 27, 2023 10:12 pm

I cannot make heads or tails of this. How do I implement this in my level?

KBM-Quine
Monty Mole
Monty Mole
Posts: 128
Joined: Wed Jan 15, 2014 11:10 am
Flair: Crazy with a K

Re: anotherPowerDownLibrary.lua v1.1.2 - like powerUpGuard or altpsystem, but newer

Postby KBM-Quine » Mon Nov 27, 2023 11:08 pm

$h31d0nc00p3rfan wrote:
Mon Nov 27, 2023 10:12 pm
I cannot make heads or tails of this. How do I implement this in my level?
i believe we handled this via discord but on the off chance this is a different person, i have edited the op a bit to hopefully help understand it better. hope that helps!

$h31d0nc00p3rfan
Rex
Rex
Posts: 33
Joined: Thu Jul 24, 2014 6:48 pm

Re: anotherPowerDownLibrary.lua v1.1.2 - like powerUpGuard or altpsystem, but newer

Postby $h31d0nc00p3rfan » Tue Nov 28, 2023 11:19 pm

KBM-Quine wrote:
Mon Nov 27, 2023 11:08 pm
$h31d0nc00p3rfan wrote:
Mon Nov 27, 2023 10:12 pm
I cannot make heads or tails of this. How do I implement this in my level?
i believe we handled this via discord but on the off chance this is a different person, i have edited the op a bit to hopefully help understand it better. hope that helps!
Same person, different username. (Don't ask, don't judge.) And yes, thank you!


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 2 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari