So i just started creating a inventory for myself but i am running into some problems, if someone can help me that would be amazing.
Whenever my character picks up a item a event is called and different required stuff is done. The event however is called every time i pick a item up. this is that event:
The event gives me the item info i just picked up using a Struct with different info like item name, can stack, currentstack, max stack, weight.
i cant figure out how to do the stacking part however… i tried a lot but could not do it correctly. im calling a function using this event. the function is in my character bp this event is in my character bp aswell. the item pickup system is in my inventory aswell.
what i want to do is to check if my inventory has a item if not add the item i picked up to a array in my character bp. if it does ill check to see if a item i already have in my inventory is the same as the item i just picked up.which i want to do using the item names in the structs if it is same i execute something else. if not i just add the item to array. if anyone can give me a screenshot of doing this in bp please help me. i want to learn it.
Not really sure what the picture is for, it doesn’t really help anyone understand how or what you are doing with your inventory items. But regardless, your issue seems rather straightforward. Just have a “for each loop” check each time an item is picked up and compare the item’s name to the names in the inventory array (you can get the name pulled out from the struct), if it does not exist you add to the array, if it does exist change the value of how many of that item is stored. Depending on your set-up you can even use the “add unique” node and if the item is not added (because it is a duplicate) then loop through the array and see which item is a duplicate and increase the number of that item carried. This will save you from doing a for each loop every time you pick something up.
Sorry for that and by the way i was trying to to this stacking for a while now and i seem to have got it myself after so much time i did do the same thing that you are saying before i made this question post but there was always something that became a error but regardless of that i fixed it all… i did it with with the help of some macros and it seems to be working but thanks for replying anyway.