So i have this inventory code, where if i pickup an object, it adds the array by 1. For example; when I pick up a book it sets the array to 0, when I pick up a key it sets the array to 1, when I pick up a battery it sets the array to 2, so on and so forth. And i wanna have a feature to drop any item to give space for other items.
So the current code i have is whenever i press the ‘drop’ key, it spawns the item from a certain location, and removes the icon from the inventory UI. The problem arises however is i want to remove this item from the index, lets say i want to remove the key, so the desired result should be; index 0 = book, index 1 = none, index 2 = battery (the index 1 should be none so whenever i pick up a different item it works perfectly. However when i use array remove index, it instead becomes; index 0 = book, index 1 = battery.
And i could use Set Array Elem and set the item to none, but that instead makes it so whenever i pick up a new object, it would be index 0 = book, index 1 = none, index 2 = battery, index 3 = new item.
I see, but how do i make it check so that if the next array element is null (or empty) it only does that set array elem node?
For example: index 0 = book, index 1 = none, index 2 = pen; how do i make it as such so that it checks what index next is free / null and it adds to that index?
apologies for the late reply, i tried doing different stuff out, but i never managed to find how to find for a gap in the array, do you use the is valid index or a different node?