find items and amount in struct array(BP)

Ello everyone thanks for taking the time to read

im currently working on a crafting system, I currently have a stacking inventory i can pickup and drop items. But i seam to be having trouble when it comes to the crafting bit. It seams contains/find do not work on a struct array(or maybe im doing something wrong. I can run a foreach/break the inventory and run a = to see if the item name is in the array and that does work, but im unable to get the amount and index of those items

any help with this tidbit would be greatly appreciated

Thanks again

Lordevilpoptart

You have to store the found value in a variable because the Element pin of the loop node is no longer valid after the loop exits.
See here, the found column structure (which contains substructures) is stored in “FoundColumn” which is then used in the “Completed” branch.
(Ignore the error on the “PlaceElements nodes”… They are unrelated)

thanks for the reply
The way i currently have it setup when i click my recipe it gets the class associated with that and i cast to my masteritemBP. from there i can grab the struct of required ingredients. I need to compare that to what is in my inventory then remove the ingredients from the inventory when i click build
maybe im just tired, or im not advancing as well as i though i would, but i don’t see how i’m going to get the number of say ingredient 1, and ingredient 2 that i need and be able to remove them from my array. My struct is not sub structures. It contains Name(string) a thumb nail, some bools, the item class etc.

I understand the passing it to a new variable(as you said once the loop is done its not valid anymore) I have the loop body checking a bool of isingredient and passing true into the new variable if i use that variable to do a print sting it prints the last item i picked up,

Do i have to run this for each ingredient im trying to find? for testing purposes im trying to build a spiked bat requiring 1 bat and 4 nails. ive done quite abit on my own and some with help of tutorials, but i just cant wrap my head around this part.

I recommend you add an ID integer to the master item class to make it easy to find objects by an integer ID (although you could do this with text if you wanted the ID to be specific like IE4300, IE4301, etc… I haven’t gotten around to trying this method out myself yet). For quantity, you can make an integer on the master item class called Quantity to keep track of how much of that object exists.

The “Name” type should be equally fast, as its just comparing the indices of thes strings in a table…
More info: https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/StringHandling/index.html

Ok so im messing around with it and i can get an item of the name and set it to the variable and print how many there are, and i can do this for each item i need. however when i print it out it works fine if i have one item in my inventory but if i have mutiple things in the inventory it prints the item X the number of things i have total but for the amount the second and third print multiples the number

[attach=con[attach=config]43078[/attach]fig]43077[/attach]

all figured out!!! i now have a working crafting system