Function to check if Slot Inventory Array is Full or Has Space?

Hello,

im not sure how i can make this function which returns TRUE (theres space in the 12 Slot Inventory) or False (Inventory is Full)

I have just started working with arrays etc, everything is relatively new

cheers

First you’ll want to create an array variable for the inventory. Use a for each loop with a break, and cycle through each slot checking if it has value. If an index in the array is empty the call the break and return the appropriate Boolean value.

I noticed in your BP you had an array, “items” it appears to be data table rows, is that correct? If this your array for “inventory”?

What I do, and would recommend, is set up an array of FName type variables, and use the table row name as the elements for your inventory array. Or like I do, I use a TMap, of FName to int, as I allow stacking of the same item. Doing this is more “lightweight” and will be easier as you progress and integrate your inventory into various functionalities, or if you decide to further develop your inventory down the road.

I hope this helps, and please say so if you need more specific advice with any of this.

Hey, thanks for helping out.

The S_Item is the Structure with all the Item Data, but its not a Data Table Row

i show you 2 more pictures which show everything before the HAS SPACE function.
The thing is, i dont even need more functionality, it will be a very small game with only a handfull Items, and i dont even want to use any stackables. I will take a look at eveything and try what you just said (for each loop with break) , hope i will do it correct