FOA Inventory System
This project was based off of Alex Shammas' IP called Fall of A.D.A.M.M. He created all the art assets and sound samples for the project, which consists of a fully functional inventory system I built in Unreal Engine 4. In a 1 week time period I created a small Inventory system in which players can use items to heal, apply stat changes to their character, equip weapons and armors, use key cards to unlock doors, drop items, and even reorganize their inventory.
An inventory system would not exist or even be needed without items. An inventory system needs to be rigid, which means that the creation of the item could not be done carelessly. I created a data table with all of the items' possible variables in the columns. I then numbered each row with an index number; this number is important because when I reorganize the inventory I need to reference this number, although Unreal automatically numbers the item rows, it is not efficient if I need to remove or add an item in the middle of the list. This data table holds all the possible items' stats and data needed in order for these items to be stored, organized and used.
I then created an Actor Blueprint with a simple collision for the player to overlap with, and a rotating sprite that would display the item in the world. These items have a list of variables similar to the data table above. The only variable you can change on the blueprint is the index number, this number will then pick the row and overwrite all of the blueprints' variables with the variables from the data tables. This system makes sure that everything the inventory will need can all be contained in one concise sheet.
The inventory system is a separate blueprint placed in the level, it reads and stores all of the data of the inventory system and even handles if an item should be picked up or dropped back into the world. When a player overlaps with an item data is sent to the inventory system confirming the item's identity. The system then checks if the inventory is full or not and then checks to see if the item is "stackable" or not. Multiple stackable items like keys and consumables may exist in one slot. If the item is stackable then the system checks if the stack is a full capacity or not, if it is it will then create a new slot to store the items in the inventory.
All items can be dropped, used, or equipped. Consumables are used while armor and weapons are equipped. In the image on the upper right we can see the inventory system to the right of the screen; with the items' sprites and quantity. When those items are selected there is a pop-up box containing the options for that item. Dropping an item will remove it from the inventory and spawn the item in the world in front of the player. If consumed it will apply bonus stats or heal the player. If gear is equipped it will appear on the left side of the UI, which contains a representation of the player's body. This image shows what gear is currently equipped; gears can also be selected and unequipped on this menu.
Screenshot of in-game UI representing the Inventory System
Screenshot of the Inventory's Blueprint
The inventory system has multiple tasks it can execute depending on the item that the mouse cursor is hovering over. The Inventory System is essentially an array of 30 slots, each slot gets filled in order as a player picks up items in the world. Stackable items can be stored in the same slot. Based off of the inventory system and the slot number, when a user clicks an item an option box will pop up with the possible interactions.
"Use" can only be seen for consumable items. When at item is used it is removed from the inventory, if this action empties a inventory slot than other items will adapt and fill in the empty space (also for Items that are equipped or dropped) When an item is consumed it can apply stat boosts, heal the player, etc.
"Equip" is an action that is used for equipment type items such as weapons and armor. When an item is equipped it disappears from the inventory and enters into the "equipped" state. When in that state the armor can apply permanent stat boost, weapons would affect the players damage and potentially skills. If an item is equipped over another item in the same slot
(IE: A helmet) the items will be swapped in the inventory.
"Sort" is a special button located at the bottom right of the inventory above the Exit button. When sort is used it reorganizes the items in the inventory in a cleaner way. The way it works is by creating a temporary version of the current inventory. The players inventory is then cleared and rewritten, by checking if an item of each index from the data table exists in the temporary inventory. Once rewritten it deletes the temporary Inventory.