Share and discuss custom LunaLua code and content packs for SMBX2.
Moderator: Userbase Moderators
|
|
|
|
-
marioSuper21
- Fighter Fly

- Posts: 33
- Joined: Thu Jul 31, 2025 8:43 am
- Pronouns: he
Postby marioSuper21 » Fri Aug 01, 2025 3:51 pm
What i did was just combine the piranhaPlant.lua from MrDoubleA and the Grounded Piranha Plant.lua from MegaDood and add improvements to it.
Piranha Plant:
Grounded Piranha Plant:
Fire Piranha Plant:
Grounded Fire Piranha Plant:
Jumping Piranha Plants(fire/ice) + Ice Piranha Plants(normal/grounded):
Changelog:
[1.0] - Initial release.
[1.1] - Modified the rotation of the piranha's head to move towards the player smoothly, with the addition of a move function to control the speed of the piranha plant to be equal to the speed of the first piranha plant.
[1.3] - Add Horizontal Piranha Plant and Fire Piranha Plant.
[1.5] - Add Jumping Piranha Plant(fire/ice) and Ice Piranha Plant and fire piranha plant issue has finally been fixed
Credits:
piranhaPlant.lua script by MrDoubleA in SMBX2b5
Grounded Piranha Plant.lua script by MegaDood
future:
Horizontal Piranha Plant -- done
Fire Piranha Plant -- done
Jumping Piranha Plant + (fire/ice) -- done
Ice Piranha Plant -- done
Thank for:
mariobrigade2018 for Fireballs Update.
MrDoubleA for piranhaPlant.lua in SMBX2b5.
MegaDood for Grounded Piranha Plant.lua.
Download
Last edited by marioSuper21 on Fri Aug 22, 2025 3:38 pm, edited 6 times in total.
|
|
|
|
|
|
|
|
|
-
mariobrigade2018
- Eerie

- Posts: 712
- Joined: Wed May 24, 2023 7:00 pm
- Flair: OK in coding who dreams of making a Mario game
- Pronouns: he/him
Postby mariobrigade2018 » Fri Aug 01, 2025 4:00 pm
Cool, but like, what’s the difference between this and the aforementioned stuff?
|
|
|
|
|
|
|
|
|
-
marioSuper21
- Fighter Fly

- Posts: 33
- Joined: Thu Jul 31, 2025 8:43 am
- Pronouns: he
Postby marioSuper21 » Fri Aug 01, 2025 4:17 pm
mariobrigade2018 wrote: ↑Fri Aug 01, 2025 4:00 pm
Cool, but like, what’s the difference between this and the aforementioned stuff?
Thank you!
Excellent question indeed!
The main difference is that the Piranha Plants Ultimate pack focuses on variety and expansion.
It currently includes the Normal and Grounded types, but I'll be working on adding Fire, Jumping, and others in the future—all with a unified and organized visual style.
The goal is for the pack to be comprehensive, cohesive, and easily expandable in the future.
|
|
|
|
|
|
|
|
|
-
Shaktool
- 2025 Egg Hunter

- Posts: 538
- Joined: Thu Jul 25, 2024 5:34 am
- Flair: zip zoom
- Pronouns: male
Postby Shaktool » Sat Aug 02, 2025 6:09 am
mariobrigade2018 wrote: ↑Fri Aug 01, 2025 4:00 pm
Cool, but like, what’s the difference between this and the aforementioned stuff?
they're combined?
|
|
|
|
|
|
|
|
|
-
marioSuper21
- Fighter Fly

- Posts: 33
- Joined: Thu Jul 31, 2025 8:43 am
- Pronouns: he
Postby marioSuper21 » Sat Aug 02, 2025 7:15 am
Yes, that's one of the pack's goals: to bring together all Piranha Plant species into one organized project, unified in form, behavior, and aesthetics.
Instead of having them scattered across various sources, I've put them all in one place.
This isn't meant as an insult to other packs; without them, this pack wouldn't exist in the first place!
|
|
|
|
|
|
|
|
|
-
ShineBlaster
- Buster Beetle

- Posts: 93
- Joined: Sat Jun 28, 2025 8:27 pm
- Flair: Quiet and beginner level designer
- Pronouns: He/Him
Postby ShineBlaster » Sat Aug 02, 2025 8:34 am
That's awesome my friend! I'm looking forward to the extra stuff you'll add in the future. Keep it up!
|
|
|
|
|
|
|
|
|
-
marioSuper21
- Fighter Fly

- Posts: 33
- Joined: Thu Jul 31, 2025 8:43 am
- Pronouns: he
Postby marioSuper21 » Mon Aug 04, 2025 6:57 am
In this version: The piranha's head rotation has been updated to smoothly move toward the player instead of jumping directly to the target angle.
And new move function has also been added to match the speed of the original piranha plant.
|
|
|
|
|
|
|
|
|
-
marioSuper21
- Fighter Fly

- Posts: 33
- Joined: Thu Jul 31, 2025 8:43 am
- Pronouns: he
Postby marioSuper21 » Wed Aug 06, 2025 7:40 pm
Get ready guys, Horizontal Piranha Plant and Fire Piranha Plant are coming soon!
|
|
|
|
|
|
|
|
|
-
mariobrigade2018
- Eerie

- Posts: 712
- Joined: Wed May 24, 2023 7:00 pm
- Flair: OK in coding who dreams of making a Mario game
- Pronouns: he/him
Postby mariobrigade2018 » Wed Aug 06, 2025 10:33 pm
marioSuper21 wrote: ↑Wed Aug 06, 2025 7:40 pm
Get ready guys, Horizontal Piranha Plant and Fire Piranha Plant are coming soon!
Yay
|
|
|
|
|
|
|
|
|
-
marioSuper21
- Fighter Fly

- Posts: 33
- Joined: Thu Jul 31, 2025 8:43 am
- Pronouns: he
Postby marioSuper21 » Sat Aug 09, 2025 3:39 pm
Horizontal Piranha Plant and Fire Piranha Plant are here in v1.3.
NOTE: There's a problem with the Fire Piranha Plant in the PiranhaPlant code. When standing next to or in the middle of an NPC in idle mode, it jumps directly to hide mode (try this and you'll see). Please have someone try to fix it. If you do, please write the corrected code in the comments. Thank you for your efforts.
|
|
|
|
|
|
|
|
|
-
mariobrigade2018
- Eerie

- Posts: 712
- Joined: Wed May 24, 2023 7:00 pm
- Flair: OK in coding who dreams of making a Mario game
- Pronouns: he/him
Postby mariobrigade2018 » Sun Aug 10, 2025 3:59 am
ok so I wasn't able to fix the plants, but I was able to improve the collision of the fireball. It'll be in the spoiler tab below:
Note: this has been added since version 1.5 (Maybe 1.4 too), but I didn't download it to verify.
Code: Select all [strike]local npcManager = require("npcManager")
local fireball = {}
local npcID = NPC_ID
local fireballSettings = {
id = npcID,
gfxwidth = 18,
gfxheight = 18,
gfxoffsetx = 0,
gfxoffsety = 0,
width = 18,
height = 18,
frames = 4,
framestyle = 0,
framespeed = 4,
speed = 1,
npcblock = false,
npcblocktop = false, --Misnomer, affects whether thrown NPCs bounce off the NPC.
playerblock = false,
playerblocktop = false, --Also handles other NPCs walking atop this NPC.
nohurt = false,
nogravity = true,
noblockcollision = false,
nofireball = false,
noiceball = false,
noyoshi = true,
nowaterphysics = false,
jumphurt = true,
spinjumpsafe = false,
harmlessgrab = false,
harmlessthrown = false,
ignorethrownnpcs = true,
linkshieldable = true,
lightradius=32,
lightbrightness=1,
lightcolor=Color.orange,
ishot = true,
durability = 2,
}
npcManager.setNpcSettings(fireballSettings)
npcManager.registerHarmTypes(npcID,{HARM_TYPE_OFFSCREEN},{[HARM_TYPE_OFFSCREEN] = 10})
local function overlappingsolid(v) -- code from the bomb cannonball
-- if there are no blocks overlapping
local blocks = Colliders.getColliding{a = v,b = Block.SOLID .. Block.PLAYER,btype = Colliders.BLOCK,collisionGroup = v.collisionGroup}
if #blocks == 0 then
-- check for npcs overlapping
for _, hit in ipairs(Colliders.getColliding{a = v, b = NPC.ALL, btype = Colliders.NPC,collisionGroup = v.collisionGroup}) do
-- only care about npcs flagged as npcblock
if NPC.config[hit.id].npcblock then
-- overlapping an npc
return true
end
end
else
-- overlapping a block
return true
end
-- overlapping nothing
return false
end
function fireball.onInitAPI()
npcManager.registerEvent(npcID, fireball, "onTickNPC")
end
function fireball.onTickNPC(v)
if Defines.levelFreeze then return end
local data = v.data
if v.despawnTimer <= 0 then
data.initialized = false
return
end
if not data.initialized then
data.initialized = true
data.inBlock = overlappingsolid(v)
data.originalSpeedX,data.originalSpeedY = v.speedX,v.speedY
if v.collisionGroup == "" then
v.collisionGroup = "npc-" .. npcID
end
end
if not overlappingsolid(v) and data.inBlock == true then
data.inBlock = false
end
if not data.inBlock then
v.noblockcollision = false
end
if lunatime.tick() % 3 == 0 then
local effect = Effect.spawn(265, math.random(v.x, v.x + v.width), math.random(v.y, v.y + v.height))
effect.x = effect.x - effect.width/2
effect.y = effect.y - effect.height/2
effect.priority = -44
end
if v.speedX ~= data.originalSpeedX then
v.speedX = data.originalSpeedX
end
if v.speedY ~= data.originalSpeedY then
v.speedY = data.originalSpeedY
end
if v:mem(0x120, FIELD_BOOL) then
v:mem(0x120, FIELD_BOOL, false)
end
if not data.inBlock and (v.collidesBlockBottom or v.collidesBlockRight or v.collidesBlockUp or v.collidesBlockLeft) then
v:kill(HARM_TYPE_OFFSCREEN)
end
end
return fireball[/strike]
Last edited by mariobrigade2018 on Fri Aug 22, 2025 4:05 pm, edited 1 time in total.
|
|
|
|
|
|
|
|
|
-
marioSuper21
- Fighter Fly

- Posts: 33
- Joined: Thu Jul 31, 2025 8:43 am
- Pronouns: he
Postby marioSuper21 » Sun Aug 10, 2025 11:02 am
Oh! Thanks so much for the fireball update and sorry for bothering you with this.
|
|
|
|
|
|
|
|
|
-
dulushich_ViiU
- Koopa

- Posts: 17
- Joined: Sun Aug 27, 2023 8:08 am
- Pronouns: them
Postby dulushich_ViiU » Mon Aug 18, 2025 8:34 pm
how to fix it?
this happens when I level the piranha plant, but when I level the grounded piranha plant, everything is fine
(I'm sorry if you didn't understand me, I'm just sitting with a translator.)
|
|
|
|
|
|
|
|
|
-
marioSuper21
- Fighter Fly

- Posts: 33
- Joined: Thu Jul 31, 2025 8:43 am
- Pronouns: he
Postby marioSuper21 » Mon Aug 18, 2025 9:43 pm
Sorry for the problem, the mistake was my fault. I forgot to change config.isHorizontal to NPC.config[v.id].isHorizontal. Now change it or download the file again.
|
|
|
|
|
|
|
|
|
-
mariobrigade2018
- Eerie

- Posts: 712
- Joined: Wed May 24, 2023 7:00 pm
- Flair: OK in coding who dreams of making a Mario game
- Pronouns: he/him
Postby mariobrigade2018 » Mon Aug 18, 2025 10:24 pm
marioSuper21 wrote: ↑Mon Aug 18, 2025 9:43 pm
Sorry for the problem, the mistake was my fault. I forgot to change config.isHorizontal to NPC.config[v.id].isHorizontal. Now change it or download the file again.
Has the fire piranha plant not working while next to it has been fixed?
|
|
|
|
|
|
|
|
|
-
Shaktool
- 2025 Egg Hunter

- Posts: 538
- Joined: Thu Jul 25, 2024 5:34 am
- Flair: zip zoom
- Pronouns: male
Postby Shaktool » Tue Aug 19, 2025 1:36 pm
i wonder if Ice piranha plants can be implemented aswell, like Fire piranhas?
|
|
|
|
|
|
|
|
|
-
marioSuper21
- Fighter Fly

- Posts: 33
- Joined: Thu Jul 31, 2025 8:43 am
- Pronouns: he
Postby marioSuper21 » Tue Aug 19, 2025 4:57 pm
mariobrigade2018 wrote: ↑Mon Aug 18, 2025 10:24 pm
marioSuper21 wrote: ↑Mon Aug 18, 2025 9:43 pm
Sorry for the problem, the mistake was my fault. I forgot to change config.isHorizontal to NPC.config[v.id].isHorizontal. Now change it or download the file again.
Has the fire piranha plant not working while next to it has been fixed?
Not yet but I'm not sure if I can fix it
Shaktool wrote:
i wonder if Ice piranha plants can be implemented aswell, like Fire piranhas?
You know what, dude, you reminded me of that. I'm going to work on that in the future with the jumping piranha plant.
|
|
|
|
|
|
|
|
|
-
marioSuper21
- Fighter Fly

- Posts: 33
- Joined: Thu Jul 31, 2025 8:43 am
- Pronouns: he
Postby marioSuper21 » Fri Aug 22, 2025 3:42 pm
Jumping Piranha Plant and Ice Piranha Plant are here in version 1.5 with a fix for the Fire Piranha Plant issue.
|
|
|
|
|
|
|
|
|
-
mariobrigade2018
- Eerie

- Posts: 712
- Joined: Wed May 24, 2023 7:00 pm
- Flair: OK in coding who dreams of making a Mario game
- Pronouns: he/him
Postby mariobrigade2018 » Sat Aug 23, 2025 2:04 am
YAY! This is really good! I want to suggest some final things:
1. A fire/ice piranha plant that acts more like the yellow piranha plants in SMBX2 basegame, along with an extrasetting option to shoot towards the player, like the fire piranha plants. Here's how they act in-game for reference:

Make sure to keep the extrasettings too! Speaking of...
2. Looking at the items, it looks like you have less control over the fire piranha plants when it comes to extrasetting. Adding them back could be a good idea. Here's what they look like, for reference:
 - Basegame fire piranha plants
extrasetting for grounded fire piranha plants: show
Code: Select all {
"style" : "groupbox",
"title" : "Grounded Piranha Plant Settings",
"layout": [
{
"control": "spinBox",
"type": "int",
"name": "delay",
"title": "Spawn Time",
"tooltip": "Delay before the NPC spawns a fireball.",
"value-default": 192,
"value-min": 32,
"value-max": 1000,
"single-step": 1
}
]
}
Filename here was "npcsettings_nsmbpiranha.json", in case you were curious.
3. The Pink Mario Forever piranha plants, they act like this in the source game, and someone already made them in SMBX2:
Video: https://youtu.be/AIsBB9isreo
The SMBX2 version: viewtopic.php?t=27989
Note, the pure gold plants act like the basegame yellow plants, that’s why I didn’t mention them. Also the “volcano” jumping piranha plant is just the yellow jumping piranha plant, which is boring, so making a proper one would be nice. And there are also the pink fire piranha plants that can shoot in all 360 degrees, uh, optional I guess, because it’s kinda useless to shoot at the pipe.
4. A Jumping Piranha Plant that exists outside of pipes. Essentially, the "grounded" variant of the Jumping Piranha Plant. One already exists here:
viewtopic.php?t=29368
5. There were 4 extra plants Megadood had for his grounded plants, that being poison, inky, gold (like regular but drops coins on death, could be handled via extraseting, variants could be added), and bone(fireball immunity, could be handled via config or extraseting, variants could be added). This could probably bloat the pack, but I kinda want those variants.
There is one last suggestion I want to make, but it is the hardest, and I understand if you don't want to suffer to add this feature:
Being able to change the head and stem of the plant using extrasettings. This should, in theory, reduce the number of NPC slots you need to use, since you'd be able to condense them all into 2 regular plants, 2 basic jumping plants, 2 normal grounded plants, 2 "shooting" pipe plants, 2 "shooting" grounded plants, and 2 "shooting" jumping plants, the projectile the shooting plants use, and all other varients that were mentioned that had different AI. Of course, this is a massive undertaking, and I do not recommend doing this until you are comfortable with your coding skills.
Also, I think you skipped a version number. If my count is correct, it's supposed to be 1.4, not 1.5. It's not that big of a deal, tho. EDIT: Looks like 1.2 was skipped as well. Again not that big of a deal, just thought it was funny.
Also also, you're only meant to use the npc ID 751-1000 for custom stuff, as everything else will be NPC slots the game will use for more NPCs in future updates:
https://docs.codehaus.moe/#/concepts/custom-range
If you read my clusterfuck, thank you, I love the potential of this, and I wish you the best.
EDIT2: Bug report, the grounded fire piranha plant is spawning the fireball near the stem instead of the head. You can look at Megadood's grounded piranha plant for a potential fix. Note that this doesn't apply to the horizontal ones.

|
|
|
|
|
|
|
|
|
-
marioSuper21
- Fighter Fly

- Posts: 33
- Joined: Thu Jul 31, 2025 8:43 am
- Pronouns: he
Postby marioSuper21 » Sat Aug 23, 2025 4:44 pm
Yes, my friend, and I will add them to version 1.6 soon.
And I will answer your questions:
mariobrigade2018 wrote:
Also, I think you skipped a version number. If my count is correct, it's supposed to be 1.4, not 1.5. It's not that big of a deal, tho. EDIT: Looks like 1.2 was skipped as well. Again not that big of a deal, just thought it was funny.
At first when I wanted to release 1.3 I thought at first to name it 1.2 but I changed the idea because the package in version 1.3 added Horizontal Piranha Plant and Fire Piranha Plant, Horizontal Piranha Plant as if it came in version 1.2 and Fire Piranha Plant as if it came in 1.3 and so on but if you want to follow the Minecraft method in the versions then I have no problem
mariobrigade2018 wrote:
1. A fire/ice piranha plant that acts more like the yellow piranha plants in SMBX2 basegame, along with an extrasetting option to shoot towards the player, like the fire piranha plants. Here's how they act in-game for reference:

Make sure to keep the extrasettings too! Speaking of...
mariobrigade2018 wrote:
4. A Jumping Piranha Plant that exists outside of pipes. Essentially, the "grounded" variant of the Jumping Piranha Plant. One already exists here:
viewtopic.php?t=29368
The strange thing is that I wanted to add them to the package, but when I fixed the problem of the fire piranha plant, I was excited to release the package, so I forgot about them. As for the ground jumping piranha plant, I also wanted to add it, but I remembered that it is difficult, especially since the head of the piranha plant is separate from its body, but I will make an effort, As for the pink color, I forgot about it.
mariobrigade2018 wrote:
5. There were 4 extra plants Megadood had for his grounded plants, that being poison, inky, gold (like regular but drops coins on death, could be handled via extraseting, variants could be added), and bone(fireball immunity, could be handled via config or extraseting, variants could be added). This could probably bloat the pack, but I kinda want those variants.
Yes sir
mariobrigade2018 wrote:
Being able to change the head and stem of the plant using extrasettings. This should, in theory, reduce the number of NPC slots you need to use, since you'd be able to condense them all into 2 regular plants, 2 basic jumping plants, 2 normal grounded plants, 2 "shooting" pipe plants, 2 "shooting" grounded plants, and 2 "shooting" jumping plants, the projectile the shooting plants use, and all other varients that were mentioned that had different AI. Of course, this is a massive undertaking, and I do not recommend doing this until you are comfortable with your coding skills.
I did not understand what you meant by it. Please explain to me with a picture or something similar.
|
|
|
|
|
Return to “LunaLua”
Users browsing this forum: No registered users and 3 guests
|