Can’t figure out how to remove item from inventory based on item IDs when pressing key. When 0 is pressed, its getting away ID1, but when I press 1, just my ID2 is turning to ID1. Hope someone can help me out…
The code you are showing has no mistake.
The problem is the way you add and remove item in your inventory. With the code you shown, it is impossible to help you to fix your issue.
This code is weird. You have a “select” node hooked up to “inventory 1” which you then use to choose which brush texture you have. So by that logic you must have inventory 1 = 2 before you get the “Mana” brush. At inventory 1 = 0 you get a blank brush which would explain why the first time you pick up any item it doesn’t register. **notice the first red ball you collect doesn’t go to your inventory (no brush is set) Only when you collect the second red ball does an item appear in the inventory. Same thing happens when you clear the inventory of “health” brushes (and presumably inventory 1 then = 0) the first blue ball you pick up doesn’t go to inventory because the brush is set based on the inventory 1 item value. This is a really bad way to do you inventory. You need a separate integer variable for your select node. This variable should be set based on the item picked up, “health” sets the variable to 1, “mana” to 2 etc. This code is really bad I am sorry.