Share and discuss custom LunaLua code and content packs for SMBX2.
Moderator: Userbase Moderators
|
|
|
|
-
RadMetalMarioSMIX
- Buster Beetle

- Posts: 86
- Joined: Sat Mar 14, 2015 6:42 pm
- Flair: What kind of grave is this?
- Pronouns: he/him
Postby RadMetalMarioSMIX » Thu May 22, 2025 10:50 pm
How would I remove Power-Ups I don't want in the inventory system? Like the Ice Flower for Example?
|
|
|
|
|
|
|
|
|
-
mariobrigade2018
- Rocky Wrench

- Posts: 650
- Joined: Wed May 24, 2023 7:00 pm
- Flair: OK in coding who dreams of making a Mario game
- Pronouns: he/him
Postby mariobrigade2018 » Thu May 22, 2025 10:56 pm
The ice flower is a basegame powerups, so I don’t think you can get rid of it.
|
|
|
|
|
|
|
|
|
-
Lurrae
- Bob-Omb

- Posts: 24
- Joined: Sun Apr 17, 2016 8:08 am
- Pronouns: he/him or they/them
Postby Lurrae » Fri May 23, 2025 12:24 am
RadMetalMarioSMIX wrote: ↑Thu May 22, 2025 10:50 pm
How would I remove Power-Ups I don't want in the inventory system? Like the Ice Flower for Example?
I'm pretty sure you should just be able to put this code in a luna.lua file:
Code: Select all local inventory = require("simpleInventory.lua")
inventory.removeSlot("iceflower")
Obviously it only removes the inventory slot for the Ice Flower, it doesn't actually delete the Ice Flower from the game as a whole, but this should work for your use case hopefully!
|
|
|
|
|
|
|
|
|
-
RadMetalMarioSMIX
- Buster Beetle

- Posts: 86
- Joined: Sat Mar 14, 2015 6:42 pm
- Flair: What kind of grave is this?
- Pronouns: he/him
Postby RadMetalMarioSMIX » Sat May 24, 2025 3:45 am
Lurrae wrote: ↑Fri May 23, 2025 12:24 am
RadMetalMarioSMIX wrote: ↑Thu May 22, 2025 10:50 pm
How would I remove Power-Ups I don't want in the inventory system? Like the Ice Flower for Example?
I'm pretty sure you should just be able to put this code in a luna.lua file:
Code: Select all local inventory = require("simpleInventory.lua")
inventory.removeSlot("iceflower")
Obviously it only removes the inventory slot for the Ice Flower, it doesn't actually delete the Ice Flower from the game as a whole, but this should work for your use case hopefully!
Well yeah, I would guess it doesn't get rid of it completely. but the Ice Flower isn't in the episode so I didn't want it's slot glaring at the player. Thank you very much! Also is there a way to make it so you have an unlimited amount of the power-ups in each slot?
|
|
|
|
|
|
|
|
|
-
Lurrae
- Bob-Omb

- Posts: 24
- Joined: Sun Apr 17, 2016 8:08 am
- Pronouns: he/him or they/them
Postby Lurrae » Sun May 25, 2025 1:34 am
RadMetalMarioSMIX wrote: ↑Sat May 24, 2025 3:45 am
Also is there a way to make it so you have an unlimited amount of the power-ups in each slot?
Yep- you can use the "creativemode" cheat! It gives you an infinite supply of all powerups until you type the cheat again, which reverts your inventory back to the state it was in before typing the cheat (so if you had 5 Super Mushrooms before enabling creativemode, those 5 Super Mushrooms will come back when you type creativemode again)
|
|
|
|
|
|
|
|
|
-
RadMetalMarioSMIX
- Buster Beetle

- Posts: 86
- Joined: Sat Mar 14, 2015 6:42 pm
- Flair: What kind of grave is this?
- Pronouns: he/him
Postby RadMetalMarioSMIX » Sun May 25, 2025 1:38 am
Lurrae wrote: ↑Sun May 25, 2025 1:34 am
RadMetalMarioSMIX wrote: ↑Sat May 24, 2025 3:45 am
Also is there a way to make it so you have an unlimited amount of the power-ups in each slot?
Yep- you can use the "creativemode" cheat! It gives you an infinite supply of all powerups until you type the cheat again, which reverts your inventory back to the state it was in before typing the cheat (so if you had 5 Super Mushrooms before enabling creativemode, those 5 Super Mushrooms will come back when you type creativemode again)
Well, I'm working on a Metroid Episode and I need it to only give infinite power-ups for the ones the player collects throughout the whole episode. Is there a way I can do that?
|
|
|
|
|
|
|
|
|
-
Lurrae
- Bob-Omb

- Posts: 24
- Joined: Sun Apr 17, 2016 8:08 am
- Pronouns: he/him or they/them
Postby Lurrae » Sun May 25, 2025 7:17 pm
RadMetalMarioSMIX wrote: ↑Sun May 25, 2025 1:38 am
Well, I'm working on a Metroid Episode and I need it to only give infinite power-ups for the ones the player collects throughout the whole episode. Is there a way I can do that?
Oh, I see! There’s not currently a good way to do that, but there is an event that triggers when an item is collected. You could set the number of items in the slot to 99 when that happens as a temporary workaround? I’ll look into adding something more official in the next update!
The code for the event would look something like this:
Code: Select all local inventory = require("simpleInventory")
function onInventoryItemAdded(eventObj, slot, quantity)
local idx = inventory.getSlot(slot)
SaveData.inventory[idx].quantity = 99
end
|
|
|
|
|
|
|
|
|
-
RadMetalMarioSMIX
- Buster Beetle

- Posts: 86
- Joined: Sat Mar 14, 2015 6:42 pm
- Flair: What kind of grave is this?
- Pronouns: he/him
Postby RadMetalMarioSMIX » Mon May 26, 2025 6:43 am
0h ok. Thank you! 
|
|
|
|
|
|
|
|
|
-
Lurrae
- Bob-Omb

- Posts: 24
- Joined: Sun Apr 17, 2016 8:08 am
- Pronouns: he/him or they/them
Postby Lurrae » Mon Jun 30, 2025 4:56 pm
Alright, finally got around to wrapping up v1.1 and released it! A download link is included in the main post, as well as a full changelog and documentation on the new stuff. v1.1 is mostly bug fixes and minor tweaks, but I did manage to add a few new settings like "metroidvaniaMode"! You can also now use a new "inventory.slotOrder" list to manually sort the entire inventory by slot name (any slots not included in the list will automatically be placed at the end of the inventory), among other changes
Added in 5 minutes 17 seconds:
I accidentally included the wrong example luna.lua file in the v1.1 download, but it should be corrected now! (same link should still work)
Sorry about that!
|
|
|
|
|
|
|
|
|
-
Tetri
- Bot

- Posts: 58
- Joined: Fri Jun 09, 2023 7:53 am
- Flair: Glory to Jesus our Lord and Savior
- Pronouns: Yumemi/Okazaki
-
Contact:
Postby Tetri » Sat Jul 05, 2025 5:56 pm
Cool one
unfortunately i have some errors
at the beginning of level
and when i try to use the feature

|
|
|
|
|
|
|
|
|
-
thiagoberaldo722
- Goomba

- Posts: 3
- Joined: Wed Sep 15, 2021 8:25 pm
- Pronouns: he
Postby thiagoberaldo722 » Sun Jul 06, 2025 1:45 am
very cool!! nice work
but i'm facing the same issue here too
it gives me two errors, the first about the maxStorage the other one in the simpleitem.lua library, line 500 showing a table nil issue message

|
|
|
|
|
Return to “LunaLua”
|