Page 1 of 2

CHS.lua - Custom Health and more! [v1.3]

Posted: Tue Jan 11, 2022 9:55 am
by Marioman2007
Important!

Consider using the newer version if you don't need multiplayer compatibility and the air meter:
The newer one has better code as well.
viewtopic.php?t=28975


----------------------------------------------------------------------------------------------------------------------


Heyo!
Today I present y'all my first library, originally this was going to be a fixed version of smgModder.lua but I ended up redoing almost everything.

GIFs
Spoiler: show
Image
Image
Image
(Debug text removed.)

Credits
Spoiler: show
---- SmgLifeSystem.lua ----
Marioman2007 - Creating the library + custom NPCs for it
PixelPest - Heavy inspiration + some original snippets code
MrDoubleA - Some snippets of code
Enjl - GFX and render code for the Air meter
LxXzit - GFX of the health meter


---- Lumas and Starbits ----
Luma and Starbit sprites by SilentDream
Slightly Reshaded and Recolored by Marioman2007, using the color palettes by Q-Nova
Made into Custom NPCs by Marioman2007


---- Other ----
Life-Up Mushroom & Air Mushroom sprites by RedBallBomb
Full heal shroom, Life-Up heart & Normal heart sprites by RedBallBomb and Marioman2007
LxXzit for the SMG Big Font
Unknown source for SMW harmed sprites
Mario's harmed sprites by HartFlip0218 (8-bit version), ElectroWelly (Conversion to 16-bit) and Greorge Sprout (Better eyes and gloves)

Changelog
Spoiler: show
1.0 - Released the library
1.01 - Removed particles as they were causing some errors
1.1 - icantswim.lua support + fixed a bug related to starman invincibility
1.2 - Fixed a few more bugs + made the health and air variables global
1.3 - Tons of optimization, new features, made all the powerups use an AI file, redid the air system, 2p support,
fixed a bug where sometimes after collecting the life up powerups the game wouldn't unpause and the bar flew offscreen,
lumas no longer cause an error, redid their drawing system, added follow behavior for starbits,
no need to use ini files for player 1 states, added documentation!

Special Thanks
- Enjl
- MrDoubleA
- Rednaxela
- Sambo
- Hoeloe

Download
https://drive.google.com/file/d/1FWQyzz ... sp=sharing

Documentation
https://docs.google.com/document/d/1QpK ... sp=sharing


Enjoy and give credits if used!

Re: SmgLifeSystem.lua - Custom Health and more!

Posted: Tue Jan 11, 2022 10:12 am
by georgespezi12
Download link doesn't work

Re: SmgLifeSystem.lua - Custom Health and more!

Posted: Tue Jan 11, 2022 10:20 am
by Marioman2007
georgespezi12 wrote:
Tue Jan 11, 2022 10:12 am
Download link doesn't work
works fine for me
anyways, updated the original post with an alternate download link

thanks for reporting!

Re: SmgLifeSystem.lua - Custom Health and more!

Posted: Tue Jan 11, 2022 11:01 am
by tangy
why are you hosting on discord? i am a purveyor of bad ideas and even i wouldnt do that

Re: SmgLifeSystem.lua - Custom Health and more!

Posted: Tue Jan 11, 2022 11:11 am
by georgespezi12
Image

Spawning a life shroom from a ? block spawns this error.

Re: SmgLifeSystem.lua - Custom Health and more!

Posted: Tue Jan 11, 2022 12:23 pm
by Sonya Sanchez
tangeruse wrote:
Tue Jan 11, 2022 11:01 am
why are you hosting on discord? i am a purveyor of bad ideas and even i wouldnt do that
How is that a bad idea? The only way you wouldn’t be able to download this would be if he deletes the message that has the download link or if discord is down.

There’s no rule of disallowing stuff being hosted over discord and it’s even imo more reliable than certain other hosting sites!

Not to mention there’s a alternative link.

Re: SmgLifeSystem.lua - Custom Health and more!

Posted: Wed Jan 12, 2022 2:41 am
by Marioman2007
Sonya Sanchez wrote:
Tue Jan 11, 2022 12:23 pm
tangeruse wrote:
Tue Jan 11, 2022 11:01 am
why are you hosting on discord? i am a purveyor of bad ideas and even i wouldnt do that
The only way you wouldn’t be able to download this would be if he deletes the message that has the download link or if discord is down.
oh, didn't knew that was causing the problem, lol
georgespezi12 wrote:
Tue Jan 11, 2022 11:11 am
Image

Spawning a life shroom from a ? block spawns this error.
Fixed, thanks!
also added an Air Mushroom and documentation for adding/setting - health and air!

Re: SmgLifeSystem.lua - Custom Health and more!

Posted: Wed Jan 12, 2022 4:57 am
by MegaDood
I really like this script! Well done! I also love how you added starbits and lumas with their own colours.
Really good that we can choose between Galaxy or Odyssey styled life ups.

Re: SmgLifeSystem.lua - Custom Health and more!

Posted: Wed Jan 12, 2022 9:11 am
by AlanLive2020
Oh cool! I also made one using the mario editor health images (which i havent published) but this is way better

Re: SmgLifeSystem.lua - Custom Health and more!

Posted: Wed Jan 12, 2022 9:50 am
by TheGameyFireBro105
Could you make it compatible with icantswim.lua? I'm trying to use it for a recreation of Sonic 1 (Genesis) Labryinth Zone.

Re: SmgLifeSystem.lua - Custom Health and more!

Posted: Wed Jan 12, 2022 10:02 am
by Marioman2007
MegaDood wrote:
Wed Jan 12, 2022 4:57 am
I really like this script! Well done! I also love how you added starbits and lumas with their own colours.
Really good that we can choose between Galaxy or Odyssey styled life ups.
AlanLive2020 wrote:
Wed Jan 12, 2022 9:11 am
Oh cool! I also made one using the mario editor health images (which i havent published) but this is way better
Thanks guys ^-^

TheGameyFireBro105 wrote:
Wed Jan 12, 2022 9:50 am
Could you make it compatible with icantswim.lua? I'm trying to use it for a recreation of Sonic 1 (Genesis) Labryinth Zone.
hmm, I don't see why it shouldn't be compatible...

Re: SmgLifeSystem.lua - Custom Health and more!

Posted: Wed Jan 12, 2022 10:06 am
by TheGameyFireBro105
I don't see the air meter when submerging with icantswim.


(LOOK! I'm now in Metroid Dread! I'm a Rinka!)

Re: SmgLifeSystem.lua - Custom Health and more!

Posted: Wed Jan 12, 2022 10:27 am
by Marioman2007
TheGameyFireBro105 wrote:
Wed Jan 12, 2022 10:06 am
I don't see the air meter when submerging with icantswim.


(LOOK! I'm now in Metroid Dread! I'm a Rinka!)

Code: Select all

SmgLifeSystem.AirMeterActive = true
in your luna.lua file

Re: SmgLifeSystem.lua - Custom Health and more!

Posted: Wed Jan 12, 2022 10:34 am
by AlanLive2020
Hey uhhh, just a suggestion, maybe use Game Data so it saves between loading levels?

Added in 46 seconds:
marioman2007 wrote:
Wed Jan 12, 2022 10:27 am
TheGameyFireBro105 wrote:
Wed Jan 12, 2022 10:06 am
I don't see the air meter when submerging with icantswim.


(LOOK! I'm now in Metroid Dread! I'm a Rinka!)

Code: Select all

SmgLifeSystem.AirMeterActive = true
in your luna.lua file
Doesn't work

Re: SmgLifeSystem.lua - Custom Health and more!

Posted: Wed Jan 12, 2022 10:59 am
by Marioman2007
AlanLive2020 wrote:
Wed Jan 12, 2022 10:35 am
Hey uhhh, just a suggestion, maybe use Game Data so it saves between loading levels?

Added in 46 seconds:
marioman2007 wrote:
Wed Jan 12, 2022 10:27 am

Code: Select all

SmgLifeSystem.AirMeterActive = true
in your luna.lua file
Doesn't work
1) I guess no, it would make some levels a lot harder (1-2 hp) or easier (5-6 hp)
2) oh oof, I'll see what I could do, but later

Re: SmgLifeSystem.lua - Custom Health and more!

Posted: Fri Jan 14, 2022 3:43 pm
by Sluggish
This is amazing but is there any way to turn off the harm animation. I just want a single frame to be there instead of full animation. I tried that but it still moves up and down.

Re: SmgLifeSystem.lua - Custom Health and more!

Posted: Sun Jan 16, 2022 2:46 pm
by AlanLive2020
Found a workaround to it not working with icantswim.

Replace line 546 with this:

Code: Select all

if player:mem(0x34, FIELD_WORD) > 0 and player:mem(0x06, FIELD_WORD) == 0 or Defines.jumpheight == 40 then
Note that this only works when the icantswim jumpheight is 40. If you change the jump height in the icantswim code, change the number here as well.

Re: SmgLifeSystem.lua v1.1 - Custom Health and more! Now with icantswim.lua support!

Posted: Mon Jan 17, 2022 1:00 am
by Marioman2007
Version 1.1 is here!

This version adds support for icantswim.lua
you can turn it on/off by setting SmgLifeSystem.icantswimSupport to true/false

it also fixes a bug with starman invincibility

link is in the main post!

Sluggish wrote:
Fri Jan 14, 2022 3:43 pm
This is amazing but is there any way to turn off the harm animation. I just want a single frame to be there instead of full animation. I tried that but it still moves up and down.
set SmgLifeSystem.SetHurtFrame to false and remove the players' ini files

Re: SmgLifeSystem.lua v1.1 - Custom Health and more! Now with icantswim.lua support!

Posted: Mon Jan 17, 2022 8:31 am
by AlanLive2020
marioman2007 wrote:
Mon Jan 17, 2022 1:00 am
Version 1.1 is here!

This version adds support for icantswim.lua
you can turn it on/off by setting SmgLifeSystem.icantswimSupport to true/false

it also fixes a bug with starman invincibility

link is in the main post!

Sluggish wrote:
Fri Jan 14, 2022 3:43 pm
This is amazing but is there any way to turn off the harm animation. I just want a single frame to be there instead of full animation. I tried that but it still moves up and down.
set SmgLifeSystem.SetHurtFrame to false and remove the players' ini files
Well thats a better solution.

Added in 3 hours 49 minutes 31 seconds:
Re: SmgLifeSystem.lua - Custom Health and more!
There is some boolean text on the top left of the screen. Dunno if thats intentional or not. Anyway i deleted it.

Added in 4 minutes 54 seconds:
Re: SmgLifeSystem.lua - Custom Health and more!
How do i make the coin reward from collecting a heart at full health add to anothercurrency.lua?

Re: SmgLifeSystem.lua v1.1 - Custom Health and more! Now with icantswim.lua support!

Posted: Mon Jan 17, 2022 8:49 pm
by Marioman2007
AlanLive2020 wrote:
Mon Jan 17, 2022 12:25 pm
There is some boolean text on the top left of the screen. Dunno if thats intentional or not. Anyway i deleted it.
at which line? can't seem to find that

AlanLive2020 wrote:
Mon Jan 17, 2022 12:25 pm
How do i make the coin reward from collecting a heart at full health add to anothercurrency.lua?
it already does that