[Closed] [SOLVED] Remove one of multiple of the same item from array

Alright, I’m having trouble with this - I’ll do my best to explain it without over complicating things:

Lets say i have 5 health potions in my inventory. I want to be able to press a button and drink a single potion and remove it from the array. The problem I’m running into is that when i remove that potion from the array, it removes ALL 5 of them. Right now I have it set up so when I click the button to check if the inventory array contains the item, then if it does, play a sound and remove it from the array. How can I get it so it only removes a single one of those items?

Thanks,

your using remove item, but if you have many of the same item then it will remove all of them since they are not unique. instead i would try using the remove index node which will target a singular index in the array to remove. in this case you would use the find node to locate the index containing the item, use the item, then remove the index that you found earlier.

1 Like

Hey, that was easy!! Works great, too!

Thank you so much!

1 Like

your welcome glad i could help