I have an inventory system that I made by following a tutorial but I’m having trouble trying to figure out how to add items to it. I already have an interaction system where I can press E on an item to get it to fire a function, all I need to know now is figure out how to add items now.
In my inventory component I have a map variable that is essentially the inventory, it’s a map of name values to int keys, so essentially item name and quantity. So on event interact, i get player character, get inventory component, and then add to or remove from the map.
Yo I appreciate the reply, you think you could elaborate on what a map variable is? I’m not 100% sure what that is, also if you could send a screenshot on how that would look that would be helpful too
I’m at work right now, but to setup a map, make a variable(id recommend name or string), click on it and go to the variables details, find where it says single, and change that to map, then a second variable type pops up, assign that to int id recommend. If you Google c++ maps you can find details on what they do and how to use them
Sorry for the late reply, but when you say I should use a TMap would I have to remove my whole inventory system that I already have in place to implement this?
No just add a TMap to your system, I guess that kind of depends on how your running it, but instead of accessing an array or whatever may be the core variable for storing *inventory items" swap it out with a map, I coded my inventory functionality in c++ so I just call add/remove/query functions from BP, essentially I use a data table and an inventory item class that assigns its mesh and other values from a data table row, so my inventory component is a TMAP of names, Wich are the data table row names, to int for quantity…idk if that makes sense or helps …always welcome to hmu on discord for help : roflmaster.(With period)