Checking if a item with a specific name exists in the array

Hey Guys,

so i do know this is a very simple thing but i just cant get this to work. my function only works if the item is the last or first item of the array. i use for loop btw. can someone help me out?. i basically have a array with some items in it. i want to check if a item with a specific name exists in the array and to get its specific index. its a array for inventory. and the items are stackable so i will have to check if the item stack size is < item max stack size but i can do that myself. just want to know how i would go about doing this and also being able to find if the item is in between the indexes.

im assuming that your inventory is a array of structs yes? if thats the case then its really not too difficult to do and was actually covered a bit in a post a few days ago. basically all you need to do is to run a for each loop on the inventory array, then for each index get the name and comparing to the item your looking to add. if the name matches then you do what your looking to do (add item to inventory, increment qty, etc). if the loop completes and you havent found a valid index then you know it doesnt exist in the inventory. using this method you will end up with all the items information including the index so it should hit all the wickets so to speak.

yes im actually using a struct. i will take a look at it

Hello, so i didnt had much time to look at the bps before but now that i check the post its pretty much similar but with some extra things. here are my bps:

This is where is Check for the item:

& this is where is where i add to inv / add to stack, Sorry this one is a little messy rn. ill fix it up if u cant understand because of the mess :P:

271819-itemstackaddtoinv2.png