Slots

What are Slots?

Slots are how we store our items when they are not spawned in the world. Slots are defined, managed and stored in the AC_Inventory_Storage component. Each storage component instance has its own set of slots, each capable of holding an item.

Slots are tracked by a simple integer, starting from 0. You will find the slot ID used and provided at various points throughout this system. When you see this integer variable it is a reference to what slot on the source, the storage component, the item is in. If we know the slot and the source we can get the info and its dynamic data by calling the getItemInSlot function

Specialty Slots let us define criteria the item must meet to store it in the slot. Buyable Slots let us offer our player optional, purchasable slots. Temp Slots let us dynamically change the slot counts at runtime, like with equipment.

Get the Slot Count

Call the getNumSlots function on the AC_Inventory_Storage component to get the current slot count. This value is dynamically calculated based on 4 variables. The default SlotCount integer variable, the purchased Buyable Slots, Temp Slots, and any Perm Slot Count Changes (see below).

Changing Slot Count

If you are looking to change the default slot count for the Player Inventory, Hotbar, or Banker see those chapters for instructions. For everything else you can change the slot count for any instance of AC_Inventory_Storage component by editing the SlotCount integer variable.

You can only change the value of SlotCount variable from the editor, treat this as your default number of slots. You can't change this variable directly at runtime by default, and you really shouldn't.

Instead, if you would like to make a perm change at runtime that doesn't go through the Buyable Slots or Temp Slots system you can use the changePermSlotCount function by an amount provided through the input. This perm change amount is setup to save between sessions but also doesn't effect the default SlotCount variable.

For help changing Buyable Slots, and Temp Slots view those chapters.

Get Notified when the Slot Count Changes

For single player, and from the server in multiplayer you can bind into the onSlotCountChange event dispatcher on the AC_Inventory_Storage to get notified whenever the calculated total slot count changes.

From the client in multiplayer you can bind into the onSlotCountChangeUI event dispatcher on the AC_Inventory_Storage to get notified whenever the calculated total slot count changes.


Ready to dive into Slots? Choose a topic to continue: