[NPC PACK] Water Currents

Share and discuss custom LunaLua code and content packs for SMBX2.

Moderator: Userbase Moderators

9thCore
2025 Egg Hunter
2025 Egg Hunter
Posts: 41
Joined: Tue Mar 10, 2015 1:46 pm
Flair: hewo
Pronouns: he/him

[NPC PACK] Water Currents

Postby 9thCore » Fri Aug 21, 2020 5:08 am

Have you ever wanted to use water currents?
Well now you can!

Major thanks to MegaDood for helping me make this npc come to life!
Gifs portraying the currents in action: show
ImageImage
Supports directions in left,right,up,down!
Enjl suggested diagonals, so I added ANGLES! (v2 onwards)
Adjustable speed! (The bubbles move faster/slower depending on the speed too!)
Adjustable range!

To install:
1) Extract everything into your level folder.
2) If you want to change default settings, open waterCurrentSettings.lua. All of the settings have been documented there.
3) You're done!


Latest Version (V8.2)
Important Files: show
npc-752.lua: Modifying stuff in this file may end in the water current not moving the player correctly. Only edit this file with caution and if you can read my very spaghetti code.
waterCurrentManager.lua: The file that governs the visual side of the water currents, the bubbles. Modifying this file may result in the bubbles not appearing correctly. Modifying this value won't affect the gameplay in any way.
waterCurrentSettings.lua: The file that governs the global settings for the water currents. Modifying stuff in this file will at most end in the game throwing errors (for example, if a value is a boolean and you set it as a number).
You should probably read this so you know how this can be used after every update.
Changelog: show
V1: show
-Released!
V2: show
-Re-did the system for moving the player/spawning the bubbles, now they are compatible with ANGLES!
V3: show
-Added some neat effects to the bubbles, moving them on a sine wave and making them flicker.
V3.1: show
-Fixed a small oversight that made the bubbles only move as a sine wave on the X axis.
-Added a new file, waterManagerSettings.lua. In here you can set global settings for water currents to use.
--allowShadowMarioThroughCurrent: if you want players who used the Shadowstar cheat code to be able to go through the water current, set this to true.
--More settings (probably) coming at a later date.
V3.2: show
-Added more options to the waterManagerSettings.lua file:
--showBubblesOutsideWater: If you want the bubbles to appear outside of water, set this to true. Doesn't affect gameplay nor does it make sense logically but whatever.
--affectOutsideWater: If you want the players to be affected by the water current when outside water, set this to true. Doesn't make any sense but whatever.
V4: show
-I realised there was no layer support, soooo:
-Added support for moving layers!
-Also, when you hide a layer that the water currents are in, they stop pushing the player until the layer is shown again! Also, the bubbles stop being produced when the layer is hidden. Just a small little touch.

-I added this just for additional ways to make cool stuffs with the water currents. Have fun with hiding/showing/moving them!
V5: show
-Added a system to disable the culling of bubble particles when water current NPCs are off-screen.
-There is a new option inside of waterManagerSettings.lua:
--alwaysCull: If set to true, the particles will always be culled. Increases performance but will make it so if a water current NPC is offscreen, the bubbles won't appear, even though the water current itself can still push the player.
---Additional notes about culling: I implemented some optimization for water currents. When they are offscreen horizontally, they don't render (This system also accounts for the range, so if you have, say, a 12 block long water current and the water current NPC is off-screen, the bubbles will still render!). I didn't yet find a way to do this vertically, so if you put a lot of water currents in a vertical level, be sure to set alwaysCull to true. If you don't, the game will either run slower or bubbles won't render in because of the particle limit. You can always change the limit by going into bubble_particle.ini and setting the "limit" value higher, though be warned that too high of a value will make your level run slower on lower-end machines. [Always account for lower-end machines! Whatever you have, there's probably some gamer out there that has a slower machine, in which case the game can slow down considerably.]
V6: show
-Added a new extra-setting, the width of the water current.
--Defaults to 32.
--Intended to be changed when the water current is on top of a pipe.
V6.1: show
-Fixed a problem where, if the layer a water current is on is hidden and then shown, the bubbles won't appear anymore. (This would happen rarely)
V6.2: show
-Fixed a bug where, if the player was in a forced state (powerup up/down) they would still be moved by the water current, causing them to enter walls.
V6.3: show
-Made it so that if you have the customhurt=1 property in a block, if the player is pushed into it by the water current, they get hurt!
V6.4: show
-Fixed a possible layer bug.
V6.5: show
-Added integration with my Metal Mario npc thingy if you wanna use it.
-There is a new option inside of waterManagerSettings.lua:
--affectMetal: If this is true, it will also affect Metal Mario and stuff. (Check out my other stuff if you want to know how this can be used!)
V7: show
-New major update WOO
-Rewrote the script so it uses the Colliders.lua file for collision checking. This means that it's much more reliable!
-You can now go through inactive switch blocks and the such! Huge thanks to Dragonfan96 for telling me, didn't even think of these cases haha
-It also checks for NPC blocks now so yay!
-No new options in waterManagerSettings.lua this time around but there's some more extra-settings!
--Water Current Width: This one now actually works, it sets the width of the physical current.
--Create Bubbles: If, for any reason, you don't want the bubbles to spawn, this is a good option to enable.
--Use Momentum For Horizontal Movement: If checked, will set the player's horizontal speed instead of moving them manually. This both has the effect of less janky interaction but also makes it really hard to fight the current. Oh and if the power is under 1 it won't work.. blame Redigit for this one.
--Bubble Speed: Sets the speed of the bubbles. If 0.00, will use the power. If anything else than 0, will use this value instead.
V7.1: show
-fixed a bug that i JUST saw oops (i swear i fixed it alreadybut i guess i didnt?????????)
V7.2: show
-haha yeah there's an option to prewarm the bubbles now, which means that the current will start out filled
-currently, there's a problem with the fact that bubbles only appear once the current npc gets spawned; that is, if it's onscreen.
-i dont know how to solve this yet but ill try sometime
V8: show
- Yo, New Version!
-added an option that controls whether or not npcs that are offscreen are active.
-active, in this case, meaning if they affect the player or show the bubbles.
-oh yea i also fixed the prewarming thing from v7.2, hopefully
V8.1: show
- squashed a small bug, oops
- thanks dragonfan96 for reporting it!
V8.2: show
- added a multiplier for how fast the bubbles spawn as well as settings to autocalculate it
- perfect if you have a wide current and want bubbles everywhere and you dont want to rely on a lot of individual currents
If there are any bugs, please report them. I will try to fix them as soon as possible.
Last edited by 9thCore on Fri May 13, 2022 10:15 am, edited 44 times in total.

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9865
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: Water Currents!

Postby Emral » Fri Aug 21, 2020 6:05 am

Very nice! If you're interested in expanding this, how about diagonals? Should just be a matter of rotating the speed vector by a more granular angle value, I'd imagine.

PdizzleParker
Chain Chomp
Chain Chomp
Posts: 324
Joined: Fri Aug 10, 2018 11:26 am
Flair: doin your mom
Pronouns: they/them
Contact:

Re: Water Currents!

Postby PdizzleParker » Fri Aug 21, 2020 11:16 am

Wow, I've wanted this in SMBX for a really long time. I bet this could lead to some insane level design, too.

TheGameyFireBro105
Eerie
Eerie
Posts: 747
Joined: Thu Jan 09, 2020 6:09 pm
Flair: Good at remakes
Pronouns: he/him

Re: Water Currents!

Postby TheGameyFireBro105 » Fri Aug 21, 2020 9:47 pm

they moove a bit slow visually speaking.

DisasterMaster
Blooper
Blooper
Posts: 161
Joined: Fri Jan 31, 2020 10:01 pm

Re: Water Currents!

Postby DisasterMaster » Sat Aug 22, 2020 12:35 am

TheGameyFireBro105 wrote:
Fri Aug 21, 2020 9:47 pm
they moove a bit slow visually speaking.
Their speed is dependent on the "current power" setting. So if it's set to a very low speed (like 0.10), the bubbles will move as slow as molasses. If you are comparing the rate of bubble visuals in SMB3 (using the pipes at the start of 3-1 as reference) to this Lua, then yes (at an approximate current power of 1.0) this Lua creates more bubbles. However, I think they move fine in relation to the power behind their current; it's the amount of bubbles being generated per second that may give off the illusion of them moving slowly since you're seeing so many at a time, especially at low currents.

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

Re: Water Currents!

Postby MECHDRAGON777 » Sat Aug 22, 2020 1:07 am

Seems like an interesting script for sure. Might make use of this in a stand alone level or even in my episode. Thanks. Will try it out and give my feedback at a later date.

PROX
Van De Graf
Van De Graf
Posts: 1964
Joined: Sun Jul 06, 2014 8:50 pm

Re: Water Currents!

Postby PROX » Sat Aug 22, 2020 4:35 am

OH YES! I was hoping someone would make these! I will definitely put them to good use.

MegaDood
Charged Spiny
Charged Spiny
Posts: 1805
Joined: Wed Nov 01, 2017 2:43 am

Re: Water Currents!

Postby MegaDood » Sat Aug 22, 2020 6:28 am

Nice job with these! I'm glad I was able to help out.

MaximalCuboid
Shy Guy
Shy Guy
Posts: 9
Joined: Sun Nov 08, 2020 1:47 pm

Re: [NPC PACK] Water Currents!

Postby MaximalCuboid » Sun Nov 08, 2020 1:52 pm

9th Core, I believe the files are broken
I've attempted to extract the zip after downloading to be told "the archive is damaged or in an unknown format"
I've asked several friends to attempt the download as well with WinRAR and Ark and have encountered the same issue
Can you attempt to repair the download?

Added in 36 minutes 21 seconds:
MaximalCuboid wrote:
Sun Nov 08, 2020 1:52 pm
9th Core, I believe the files are broken
I've attempted to extract the zip after downloading to be told "the archive is damaged or in an unknown format"
I've asked several friends to attempt the download as well with WinRAR and Ark and have encountered the same issue
Can you attempt to repair the download?
I was able to get it to work via a friend with 7vip who rezipped it for me, but it still may be something to look into

BLOODMOON1
Cheep-Cheep
Cheep-Cheep
Posts: 11
Joined: Thu Jul 01, 2021 9:50 am
Pronouns: he/him
Contact:

Re: [NPC PACK] Water Currents!

Postby BLOODMOON1 » Sat Jul 24, 2021 5:58 am

Is there any way to remove the bubbles?
This NPC pack allows you to make good geysers but the bubbles kinda ruin it.

Marioman2007
2025 Egg Hunter
2025 Egg Hunter
Posts: 530
Joined: Tue Aug 25, 2020 3:19 am
Flair: Dr. Bones
Pronouns: He/Him

Re: [NPC PACK] Water Currents!

Postby Marioman2007 » Sat Jul 24, 2021 6:50 am

BLOODMOON1 wrote:
Sat Jul 24, 2021 5:58 am
Is there any way to remove the bubbles?
This NPC pack allows you to make good geysers but the bubbles kinda ruin it.
just edit the bubble.png file.

BLOODMOON1
Cheep-Cheep
Cheep-Cheep
Posts: 11
Joined: Thu Jul 01, 2021 9:50 am
Pronouns: he/him
Contact:

Re: [NPC PACK] Water Currents!

Postby BLOODMOON1 » Sat Jul 24, 2021 7:10 am

marioman2007 wrote:
Sat Jul 24, 2021 6:50 am
BLOODMOON1 wrote:
Sat Jul 24, 2021 5:58 am
Is there any way to remove the bubbles?
This NPC pack allows you to make good geysers but the bubbles kinda ruin it.
just edit the bubble.png file.
Graphics wise, that makes it impossible to have both in 1 level, like i have planned in my next level.

MaximalCuboid
Shy Guy
Shy Guy
Posts: 9
Joined: Sun Nov 08, 2020 1:47 pm

Re: [NPC PACK] Water Currents!

Postby MaximalCuboid » Sat Jul 24, 2021 1:35 pm

BLOODMOON1 wrote:
Sat Jul 24, 2021 7:10 am
marioman2007 wrote:
Sat Jul 24, 2021 6:50 am
BLOODMOON1 wrote:
Sat Jul 24, 2021 5:58 am
Is there any way to remove the bubbles?
This NPC pack allows you to make good geysers but the bubbles kinda ruin it.
just edit the bubble.png file.
Graphics wise, that makes it impossible to have both in 1 level, like i have planned in my next level.
You could just make a copy NPC with a different ID and edit that one so it doesn't make any particles

BLOODMOON1
Cheep-Cheep
Cheep-Cheep
Posts: 11
Joined: Thu Jul 01, 2021 9:50 am
Pronouns: he/him
Contact:

Re: [NPC PACK] Water Currents!

Postby BLOODMOON1 » Sun Jul 25, 2021 4:29 am

MaximalCuboid wrote:
Sat Jul 24, 2021 1:35 pm
BLOODMOON1 wrote:
Sat Jul 24, 2021 7:10 am
marioman2007 wrote:
Sat Jul 24, 2021 6:50 am


just edit the bubble.png file.
Graphics wise, that makes it impossible to have both in 1 level, like i have planned in my next level.
You could just make a copy NPC with a different ID and edit that one so it doesn't make any particles
I tried that, the particles still show.
I copied the ini file, lua file and icon and changed the id to 753.

9thCore
2025 Egg Hunter
2025 Egg Hunter
Posts: 41
Joined: Tue Mar 10, 2015 1:46 pm
Flair: hewo
Pronouns: he/him

Re: [NPC PACK] Water Currents!

Postby 9thCore » Mon Jul 26, 2021 5:12 am

BLOODMOON1 wrote:
Sun Jul 25, 2021 4:29 am
MaximalCuboid wrote:
Sat Jul 24, 2021 1:35 pm
BLOODMOON1 wrote:
Sat Jul 24, 2021 7:10 am


Graphics wise, that makes it impossible to have both in 1 level, like i have planned in my next level.
You could just make a copy NPC with a different ID and edit that one so it doesn't make any particles
I tried that, the particles still show.
I copied the ini file, lua file and icon and changed the id to 753.
I think you'll have to go into your lua file (id 753) and delete anything that's related to waterCurrentManager as that's the one that handles particles
Its been a while since i made this script but I checked it and it seems like thats the one that generates the particles themselves

TheGameyFireBro105
Eerie
Eerie
Posts: 747
Joined: Thu Jan 09, 2020 6:09 pm
Flair: Good at remakes
Pronouns: he/him

Re: [NPC PACK] Water Currents!

Postby TheGameyFireBro105 » Mon Aug 09, 2021 5:19 pm

Could you add a thing that shows the angle it's going in the editor? It's a bit hard to know how to set the directions properly.

9thCore
2025 Egg Hunter
2025 Egg Hunter
Posts: 41
Joined: Tue Mar 10, 2015 1:46 pm
Flair: hewo
Pronouns: he/him

Re: [NPC PACK] Water Currents!

Postby 9thCore » Tue Aug 10, 2021 12:04 am

TheGameyFireBro105 wrote:
Mon Aug 09, 2021 5:19 pm
Could you add a thing that shows the angle it's going in the editor? It's a bit hard to know how to set the directions properly.
Can't do that. lua doesn't work inside of the editor.
Best I could do is one water current NPC for each angle (0-360) and uhhhh

no:)

TheGameyFireBro105
Eerie
Eerie
Posts: 747
Joined: Thu Jan 09, 2020 6:09 pm
Flair: Good at remakes
Pronouns: he/him

Re: [NPC PACK] Water Currents!

Postby TheGameyFireBro105 » Tue Aug 10, 2021 10:58 am

Why not make a LVLX file with the base angles copy-and-pasteable?

9thCore
2025 Egg Hunter
2025 Egg Hunter
Posts: 41
Joined: Tue Mar 10, 2015 1:46 pm
Flair: hewo
Pronouns: he/him

Re: [NPC PACK] Water Currents!

Postby 9thCore » Tue Aug 10, 2021 12:30 pm

TheGameyFireBro105 wrote:
Tue Aug 10, 2021 10:58 am
Why not make a LVLX file with the base angles copy-and-pasteable?
What.

Why. Why would I do that.

I literally said what angles you can use if you want up/down/left/right directions for the currents in the angle's description (in extra-settings). From there it's some basic knowledge of how angles work

(plus can you even copy paste between different levels in PGE? never tried so i dont know)

Neon358
Fighter Fly
Fighter Fly
Posts: 35
Joined: Tue Apr 07, 2020 5:24 pm

Re: [NPC PACK] Water Currents!

Postby Neon358 » Tue Aug 10, 2021 2:41 pm

Great! Is there a version for SMBX 1.4.5?


Return to “LunaLua”

Who is online

Users browsing this forum: Semrush [Bot] and 2 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari