simpleInventory.lua [v1.0] - Yet another Bowser's Fury-inspired inventory!

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

Moderator: Userbase Moderators

RadMetalMarioSMIX
Swooper
Swooper
Posts: 76
Joined: Sat Mar 14, 2015 6:42 pm
Flair: What kind of grave is this?
Pronouns: he/him

Re: simpleInventory.lua [v1.0] - Yet another Bowser's Fury-inspired inventory!

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
Rocky Wrench
Posts: 625
Joined: Wed May 24, 2023 7:00 pm
Flair: OK in coding who dreams of making a Mario game
Pronouns: he/him

Re: simpleInventory.lua [v1.0] - Yet another Bowser's Fury-inspired inventory!

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
Bob-Omb
Posts: 23
Joined: Sun Apr 17, 2016 8:08 am
Pronouns: he/him or they/them

Re: simpleInventory.lua [v1.0] - Yet another Bowser's Fury-inspired inventory!

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
Swooper
Swooper
Posts: 76
Joined: Sat Mar 14, 2015 6:42 pm
Flair: What kind of grave is this?
Pronouns: he/him

Re: simpleInventory.lua [v1.0] - Yet another Bowser's Fury-inspired inventory!

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
Bob-Omb
Posts: 23
Joined: Sun Apr 17, 2016 8:08 am
Pronouns: he/him or they/them

Re: simpleInventory.lua [v1.0] - Yet another Bowser's Fury-inspired inventory!

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
Swooper
Swooper
Posts: 76
Joined: Sat Mar 14, 2015 6:42 pm
Flair: What kind of grave is this?
Pronouns: he/him

Re: simpleInventory.lua [v1.0] - Yet another Bowser's Fury-inspired inventory!

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
Bob-Omb
Posts: 23
Joined: Sun Apr 17, 2016 8:08 am
Pronouns: he/him or they/them

Re: simpleInventory.lua [v1.0] - Yet another Bowser's Fury-inspired inventory!

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
Swooper
Swooper
Posts: 76
Joined: Sat Mar 14, 2015 6:42 pm
Flair: What kind of grave is this?
Pronouns: he/him

Re: simpleInventory.lua [v1.0] - Yet another Bowser's Fury-inspired inventory!

Postby RadMetalMarioSMIX » Mon May 26, 2025 6:43 am

0h ok. Thank you! :)


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 0 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari