So I've been wanting to make an action-adventure game for a couple of years now, and now that I feel confident enough in my skills as a programmer, I've started the process of making it. I decided that the only way to truly know if I were actually capable would be to try, so I decided to start making the inventory system, as I want it to be a core feature.
I started by putting this into a Script.
Inventory = {
KeyItems = { --stuff the player uses that is important; keys and stuff; can't be deleted
},
Consumables = { --stuff the player uses and causes it to be gone or semi-depleted; potions/food/etc.
},
Equipment = { --stuff your player can equip; swords and stuff
},
Misc = { --stuff that doesn't go in above categories; possibly sell-items like treasure or jewelery
},
Gold = { --literally just money
}
}
I want to run a sanity check to see if this really works, and I was just about to, when something crossed my mind--how in the world am I going to add items to this thing?
This is the standstill. I'm not sure how I'm going to be able to add items to my inventory. I was thinking of using a ModuleScript with the function AddItem. Here's something I had in mind:
local module = {
AddItem = function(item,amount)
print("Added " .. amount .. " " .. item .. " to player inventory")
end
}
return module
The "amount" parameter would be an integer and the "item" parameter would be a string. I would use the value of "item" to determine the type and location of the thing I would put into the inventory. How would I pull this off?
More importantly, is there a better method than what I thought of?
This game is intended to be a single-player game, so you don't need to worry very much about client-server relations, as there will be only one Player that needs to see anything.

1 comment
What DataStores? If things happen on the client side, saving data would be an issue