icantswim.lua - Mega Man-like water (v1.0.2)

Share and discuss custom LunaLua code and content packs for SMBX2.
cold soup
Cheep-Cheep
Cheep-Cheep
Posts: 13
Joined: Wed May 13, 2020 8:29 pm
Flair: yeah
Pronouns: he/him
Contact:

icantswim.lua - Mega Man-like water (v1.0.2)

Postby cold soup » Sun Aug 08, 2021 3:54 pm

icantswim.lua is a library that lowers a player's gravity when they go underwater (via water boxes, currently doesn't affect underwater sections), instead of putting them in a swimming state. Essentially, Mega Man water physics applied to Mario. Includes adjustable values for a player's jump height, fall speed, and run speed in water, and toggleable splash and bubble effects.

Note that this library is not compatible with multiplayer at the moment. (X2 characters are partially supported)

Please report any bugs you find, I'm pretty new to Lua so any feedback would be appreciated!

EXAMPLE:
Spoiler: show
Image
DOWNLOAD: CREDITS:
Spoiler: show
Thanks to RandomTalkingBush on the Spriters Resource for ripping the splash and bubble sprites
Thanks to KBM-Quine#6602 on Discord for discovering how to enable underwater physics for NPCs
Thanks to MrDoubleA#3124 for fixing an issue where NPCs that use player defines don't work properly
Last edited by cold soup on Sat Oct 02, 2021 5:43 pm, edited 4 times in total.

SuperAlex
Blooper
Blooper
Posts: 190
Joined: Mon Nov 02, 2020 3:02 pm
Contact:

Re: icantswim.lua - Mega Man-like water

Postby SuperAlex » Sun Aug 08, 2021 7:15 pm

Wow. The splash effect would remember me of the SMM2 SMW Water.

Murphmario
Chargin' Chuck
Chargin' Chuck
Posts: 2343
Joined: Fri Dec 20, 2013 7:07 pm
Pronouns: he/him

Re: icantswim.lua - Mega Man-like water

Postby Murphmario » Sun Aug 08, 2021 9:44 pm

This is really cool! Hope sometime in the future you can make this compatable with the SMBX2 characters, especially Mega Man for obvious reasons.

Hatsune Blake
Posts: 570
Joined: Sun Feb 23, 2014 1:55 pm
Pronouns: He / Him

Re: icantswim.lua - Mega Man-like water

Postby Hatsune Blake » Mon Aug 09, 2021 12:05 am

This is incredibly awesome. I'd expect to see this in a few levels in the future! Fantastic work.

ElTipsta
Lakitu
Lakitu
Posts: 474
Joined: Fri Dec 20, 2013 3:16 pm
Pronouns: she/her

Re: icantswim.lua - Mega Man-like water

Postby ElTipsta » Mon Aug 09, 2021 2:39 pm

This is fantastic, thanks for this :)

cold soup
Cheep-Cheep
Cheep-Cheep
Posts: 13
Joined: Wed May 13, 2020 8:29 pm
Flair: yeah
Pronouns: he/him
Contact:

Re: icantswim.lua - Mega Man-like water (v1.0.1)

Postby cold soup » Fri Aug 13, 2021 7:06 pm

Minor bugfix update, I made it so that water boxes don't ignore if their layer is hidden and I improved the way bubbles despawn.

MECHDRAGON777
Pink Yoshi Egg
Pink Yoshi Egg
Posts: 6419
Joined: Fri Dec 20, 2013 6:40 pm
Flair: Nuclear Queen of Reversion.
Contact:

Re: icantswim.lua - Mega Man-like water (v1.0.1)

Postby MECHDRAGON777 » Tue Aug 17, 2021 1:31 am

Reminds me of how Samus behaves in water without the Gravity Suit.

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

Re: icantswim.lua - Mega Man-like water (v1.0.1)

Postby MrDoubleA » Fri Aug 27, 2021 2:47 pm

A lovely little script, although it does take a bit of editing to have it not break other scripts that modify the defines (such as the X2 characters or clear pipe cannons).

ElTipsta
Lakitu
Lakitu
Posts: 474
Joined: Fri Dec 20, 2013 3:16 pm
Pronouns: she/her

Re: icantswim.lua - Mega Man-like water (v1.0.1)

Postby ElTipsta » Fri Sep 03, 2021 6:08 am

ok i've tried to put this into a level and i can't seem to get it to work.

i've tried using enjl's how to use guide in the pinned thread but it's just not working.

interestingly i even tried modifying it a bit and was able to get the intended physics placed outside of the water but not in it (kinda like zerogravity).

how are you supposed to make it compatible?

Marioman2007
Buster Beetle
Buster Beetle
Posts: 401
Joined: Tue Aug 25, 2020 3:19 am
Pronouns: He/Him

Re: icantswim.lua - Mega Man-like water (v1.0.1)

Postby Marioman2007 » Fri Sep 03, 2021 7:52 am

ElTipsta wrote:
Fri Sep 03, 2021 6:08 am
ok i've tried to put this into a level and i can't seem to get it to work.

i've tried using enjl's how to use guide in the pinned thread but it's just not working.

interestingly i even tried modifying it a bit and was able to get the intended physics placed outside of the water but not in it (kinda like zerogravity).

how are you supposed to make it compatible?
1) Are you loading the library?
2) Are you testing this underwater?

cold soup
Cheep-Cheep
Cheep-Cheep
Posts: 13
Joined: Wed May 13, 2020 8:29 pm
Flair: yeah
Pronouns: he/him
Contact:

Re: icantswim.lua - Mega Man-like water (v1.0.1)

Postby cold soup » Mon Sep 06, 2021 5:03 pm

ElTipsta wrote:
Fri Sep 03, 2021 6:08 am
ok i've tried to put this into a level and i can't seem to get it to work.

i've tried using enjl's how to use guide in the pinned thread but it's just not working.

interestingly i even tried modifying it a bit and was able to get the intended physics placed outside of the water but not in it (kinda like zerogravity).

how are you supposed to make it compatible?
are you using water boxes? the water physics don't work if you set a section to underwater.

cold soup
Cheep-Cheep
Cheep-Cheep
Posts: 13
Joined: Wed May 13, 2020 8:29 pm
Flair: yeah
Pronouns: he/him
Contact:

Re: icantswim.lua - Mega Man-like water (v1.0.2)

Postby cold soup » Sat Oct 02, 2021 5:46 pm

Another bugfix update, this one's more major. This update fixes issues related to NPCs that use player defines, such as Launch Barrels. X2 character support should be better, although I still have to modify a few things before they become fully supported. Massive thanks to MrDoubleA for providing a fix to these issues!


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 2 guests