UInventoryBase
(UObject)
(UObject)
The Inventory class tracks and organizes InventoryItems. They have save and load built-in and are responsible for remaking the items in their contents when loading from save. Inventories can either be used directly by instantiating and managing your own with the help of the InventoryManagerSubsystem or by adding an InventoryComponent to any actor.
Add ItemTags to this array to limit what InventoryItems can be added to an Inventory.
These items will be added automatically to the Inventory if no save data is found on load. These values can be overwritten when calling InitializeInventory().
Sets the default number of slots for the Inventory. This value is overwritten if less then the number of default items or the inventory component's number of slots that spawned it.
Initialize the Inventory and overwrite the default values of the derived class. The GUID should give provided by the class initializing the inventory and always be the same for proper saving and loading.
NOTE: If this function is not called, the default values set on the derived class will be used.
Attempts to add an InventoryItem to the Inventory. This function returns three different scenarios:
Rejected = The item was not added to an item slot for various reasons and returns the item back to you.
NoRemainder = The entire item amount was added to the slot and the item returned does not need to be handled (but you may need to finish removing the item from another inventory if this was a transfer).
Leftovers = Returns the item with decreased amount because an item slot could not take all of the amount.
Swapped = Returns the item that use to be in the slot swapped out for the item you added if the item classes did not.
Attempts to add an InventoryItem to the Inventory. This function returns three different scenarios:
Rejected = The item was not added to an item slot for various reasons and returns the item back to you.
NoRemainder = The entire item amount was added to the slot. Returns all items effected.
Leftovers = Returns all effected items. The original item that still has amount needs to be handled.
Decreases the stack count of an InventoryItem in a specific slot and returns the effected item.
Decreases the first found stack count of an InventoryItem that matches the input and returns how all effected items.
Removes an InventoryItem from the specific slot in the Inventory regardless of stack count.
Removes the first InventoryItem that matches the input regardless of stack count.
Override this function to handle UI display when an InventoryItem in the inventory is explicitly destroyed.
Gets the item at the input index. Fires the false output pin if no item is at the index.
Gets the slot index of an InventoryItem in the inventory. Fires the false output pin if the item is not in the inventory.
Gets the max number of item slots the inventory has.
Override this function to check conditions that determine if the class should save.
Override this function to check conditions that determine if the class should save.
Override this function to implement saving data unique to a derived Inventory class. Always make sure to call the parent function and pass the save game object up the inheritance tree when overriding.
Override this function to implement loading data unique to a derived Inventory class. Always make sure to call the parent function and pass the save game object up the inheritance tree when overriding.
Override this function to implement removing save data when it is no longer needed.