Way to manage items

Sorry for the vague title. I don’t know how to phrase it correctly…

I’m looking for some help on ways to manage items the player has on hand, and has in storage.

There are lots of tems/equipment, and they all have various characteristics, some unique some common, like:

  1. Name

  2. Type (feet equipment, leg equipment,
    torso equipment, torso+leg
    equipment, weapon, right/left
    hand equipment, )

  3. Amount

  4. Equipped (whether it’s equipped or
    not)

  5. Value (amount of money it can be sold for, varies by location)

  6. Price (amount of money it can be bought for, varies by location)

  7. Visibility

  8. 2D image

  9. 3D model

Right now all the different types are all lumped into the same arrays (Items_on_hand, items_in_storage) where the index serves as the Type identifier and value is the amount. I have a Name, 2d image, price, value, array (in global game vars) where all their respective values are matched by index. It’s really easy to save the player’s inventory with system, because I need only save 2 arrays (on_hand, and in_storage).

But now that I’ve started implementing an item equip screen (wanting to make it so only certain items can be equipped to certain slots), and I’m finding was perhaps a stupid way to do it.

Anyone know of any tutorials I could look at that might help streamline my item management?

I was thinking, maybe I should have created 1 single actor with a bunch of variables (i.e. type, amount, value, price, etc.) in it?

Thanks in advance for any help or suggestions in these regards.

Your idea of creating a single actor “with a bunch of variables” seems logical.

An Item actor could hold variables pertinent to every item. Should more specific variables be needed, add then to a derived actor (eg. only weapons would have a damage variable).

Then just make those arrays hold Item actors and you should be good to go.

Thanks for the help blkhouse_vlucki. I never thought about just straight out saving an array of Item Actors. Likely because “actor” brings to mind something that takes up a more than 1 meg of space; so an array of 25 item actors would make the save data way too big. hehe