Legacy/Blueprint Inventory

Blueprint Inventory This wiki page will teach you how to make a simple inventory system. I based my initial work off the forum post found [! here]. The core features of this system are: Extendible ...

Blueprint Inventory

This wiki page will teach you how to make a simple inventory system. I based my initial work off the forum post found [! here]. The core features of this system are:

  • Extendible BaseInventory class
    • Inventory weight and max slot size
  • Extendible BaseItem class
    • Item weight
    • Stackable (optional)
  • Structures for inventory slots

BaseItem

Create an Actor Blueprint and give it a name of BaseItem (or something else if you want).

Add a sphere collision component and rename it to PickUpRadius:

File:BluePrintInventory_ItemSphere.png
File:BluePrintInventory_ItemSphere.png

Add a static mesh component and rename it to ItemMesh:

File:BlueprintInventory_ItemMesh.png
File:BlueprintInventory_ItemMesh.png

Create the following variables:

File:BlueprintInventory_ItemVariables.png
File:BlueprintInventory_ItemVariables.png

InventorySlot

Create a Structure Blueprint, name it InventorySlot and add the following two variables:

File:BlueprintInventory_Slot.png
File:BlueprintInventory_Slot.png

BaseInventory

Create an Actor Blueprint and give it a name. We will use BaseInventory. Add a StaticMesh component and make it the root component.

Add the following variables:

File:BlueprintInventory_InventoryVariables.png
File:BlueprintInventory_InventoryVariables.png

Macros

File:BlueprintInventory_CanItStack.png
File:BlueprintInventory_CanItStack.png
File:BlueprintInventory_CurrentWeight.png
File:BlueprintInventory_CurrentWeight.png
File:BlueprintInventory_HasInventorySpace.png
File:BlueprintInventory_HasInventorySpace.png
File:BlueprintInventory_HasPartialStack.png
File:BlueprintInventory_HasPartialStack.png

Functions

File:BlueprintInventory_AddItemToInventory.png
File:BlueprintInventory_AddItemToInventory.png

Pick-up Functionality

BaseItem

File:BlueprintInventory_SphereCollisionEvent.png
File:BlueprintInventory_SphereCollisionEvent.png

Your Character

On your character blueprint, add the following variable so that the character has an inventory we can reference.

File:BlueprintInventory_CharacterInventory.png
File:BlueprintInventory_CharacterInventory.png

Then, spawn an instance of BaseInventory (preferably on BeginPlay) and assign it to the variable we created above.

File:BlueprintInventory_InventorySpawn.png
File:BlueprintInventory_InventorySpawn.png

Testing

Place a BaseItem inside your level, and press play. When you walk over the item, you should see a printed message:

File:BlueprintInventory_ItemAdded.png
File:BlueprintInventory_ItemAdded.png
Hoodini Hoodini Bot MothDoctor Last updated on