Equip items in inventory to character page

Hello All,

First off I would like to say sorry if this has been posted before. I did some searching on the matter and haven’t really found what I was looking for.

A good reference of what I was curious about is an inventory and the character page like in most modern MMO’s or like the ones you see in the market place.

I would like to know how to visually remove an item from the inventory that has been equipped to the character and have that item show up on the character page in the correct slot for that item type.

I would think you would use two arrays one for the inventory and one for the equipment slots on the character. The problem that I have a hard time getting around is when you un-equip the item and remove it from the array you are changing the index of the remaining items so I can’t assign items and remove them via the array index without having the other items move around.

One idea that I am thinking about is just using an array of buttons to store the item image and an item ID and once that button is click I will search the array for the item and index number and remove it then remove the image and ID. In this way it wouldn’t matter where in the array the item is. This is just a general description of what is floating around in my head.

Any advice would be appreciated, even a general description of how to best do this.

…why use an array for something static?

You will never change the amount of slots. Each slot has a specific purpose for one type of item (body armor, trinket, weapon, etc) so a basic variable of the according type seems more appropriate.

Also since you’re using an inventory of a set size you should never use “Remove” or “Add” but instead only “Insert Into”. To add something the actor / class / item you want to add and to remove something simply insert nothing (just don’t select anything. It’s “none” by default). That way you can check when drawing if your actor is valid and if it is get it’s icon, name and what not to display in the inventory. Like that you even have set slots (put something in slot 10 and it will be in slot 10 again when you open it again and not in slot 0 just because it’s the only item in your inventory.


Thank you Erasio, I see what you are saying. I was kind of working my way to something like that. I figued a place holder in the invetory would work well but didn’t know to just place nothing in it.
I will work on this and see if I can get it working.

I got it to work with your advice, I just need to clean up the UI and it should be good to go.