Skip to content

Inventory

Jack Brett edited this page Sep 2, 2024 · 5 revisions

The Inventory System gives you all you need to create inventories, items, display them, and plug them into your game.

Our 'Demo' prefab includes an Inventory object already to help you get started.

Using Inventories with LUTE

The Inventory sytem is ideal for allowing players to store Items which can be used in conjunction with Achievements, puzzles and Dialogues.

The most simple use case of the Inventory is to either toggle if on/off or use it with the InventoryMenu order to create an icon in your experience which will toggle the inventory canvas on or off. To do so:

  1. Create a new Node and ensure this is 'Activated' by start game.
  2. Add an InventoryMenu Order to this Node and supply this Order with a specific Icon to use with this button and the inventory you wish to toggle on and off.

inventoryMenuOrder

  1. Head into play mode and you should see your Inventory toggle button which is used to turn the inventory canvas on/off.

inventoryIcon

All Inventories can be customised and cloned with ease to help fit your themes and needs!

Adding Items to Inventories

Adding Items to Inventories is simple using the AddItem Order. Simply:

  1. Create a new Node with the starting activation property.
  2. Add the Add Item Order to your new Node.

addItemNew

  1. Select an Item (these are contained in the project as scriptable objects rather than in the scene itself), the total amount you wish to add and if you wish to any Feedbacks upon the player receiving the item.

Persistent Items

Items can be saved to your save files and are therefore persistent during mulitple play sessions. You can tick the checkmark on the Order to ensure that item will not be reset on reloading into the game as well ensuring that the item does not get added if it is already included in the inventory (which may be quite often if the items are persistent).

Using Inventories in Condition Checks

In some experiences, you may wish to check if the player has collected a specific item and execute certain behaviours depending on whether they have or not.

We can do this by using the Inventory system in conjunction with thte conditional statement system:

  1. Add a new Node which activates when the game starts.
  2. Add an If Order to the Node.

inventoryCheck

  1. Head over to your Flow Engine and then add a new variable of the type 'Inventory'. In this case we are using the inventory found in our scene (in the demo scene) and giving it the same name as the Inventory.

inventoryVar

  1. Head back to your If Order and then select the Inventory from the Variable list. You will notice that we are not comparing two Inventories but the Order requires us to supply an Inventory Item. In this conditional check we are asking whether or not a specific Item is in the player's Inventory.

inventoryCheckOrder

  1. Add an Order to to execute when this check passes true and then an Else Order to execute another Order if this is not true.

inventoryCheckOrderFull

  1. Jump into Play Mode and check to see if this conditional statement worked.

inventoryCheckGame

Clone this wiki locally