I have a simple gathering system in my game and when you either cut down a tree or break a rock you get materials.i have also set up an inventory system so it will display how much of each you have but the problem is that when you gather one material it will display that in the inventory but if you gather the other material it sets the value of the previous one to 0 so it is impossible to have both display at the same time as one will always be set to 0… any ideas???
Don’t set it to 0, I guess?
Is the problem that you have a single struct, containing all of the inventory values? If so, you need to “break struct” to get the initial values, and then add whatever is gathered, and then “make struct” with the sum of the old values and the addition.
However, I’d suggest doing inventory as an actor with separate properties (variables) for each resource. That makes network replication better, if you’re interested in that, and it makes it easier to manage in other ways, too.
Are you using a struct of arrays of arrays for this? These are currently (at last count) not working in blueprint. As Jwatte mentions it may be easier to have separate variables rather than a struct. They are great in principal but not always reliable.
Sounds like it is a matter of wrongful targeting of the inventory individual item. Are you sure that what you’re doing is something along the lines of:
find it in the inventory
if found and stackable, update the amount
else add to first empty slot to inventory?
Keep in mind, if you use “Set Members in” whatever-structure-here, you should ONLY check the items that you are changing, and then do what you need to in order to re-update the amount shown for that item.