Ninja Bear Studio Plugins Help

Loot Management

The Loot System in the Ninja Inventory plugin enables actors to grant items to a requesting inventory—such as looting a defeated enemy, opening a chest, or collecting a reward.

The system supports both instanced items and default items, enabling flexible generation and transfer workflows.

Loot Workflow

Loot flows between a requester and a source Inventory Manager.

  1. The requester initiates the process by invoking GenerateLoot on a source Inventory Manager.

  2. Loot is generated by a loot selector configured on the source, returning a list of InventoryDefaultItem entries.

  3. Loot is sent to the requester via ReceiveLoot, which stores the loot for validation and broadcasts events that can be tracked by the user interface.

  4. Loot is visualized by the UI using the appropriate Inventory Loot ViewModel. It will convert loot entries into the UI-oriented UNinjaInventoryDetachedItemView object.

  5. Selected loot is transferred back to the requester using TransferLoot. This can also be done via the ViewModel.

Loot Generation

Loot is generated by a class that implements InventoryLootSelector. These classes are responsible for gathering potential loot options and presenting them back to the requester.

You can define the Loot Generation Strategy in the Inventory Manager. The system provides the following predefined strategies:

Strategy

Description

DataTable

Selects loot based on a data table containing predefined items, drop chances, and loot costs. Uses the InventoryLootTableRow structure.

InventoryItems

Selects loot from the Inventory Manager’s existing items. Selection is based on the Loot Fragment.

LootableContainers

Selects loot from containers that have the lootable trait.

You can create custom strategies by extending InventoryLootSelector and implementing the GenerateLoot function.

When creating the resulting InventoryDefaultItem array, follow these rules:

  • Always set the Source Inventory in each entry, which is required to enable the transfer operation.

  • If the loot originates from an actual Inventory Item, also set the Source Item reference in the entry.

Loot Events

The Inventory Manager broadcasts the following events to support gameplay systems, UI, and scripting integration:

Event

Description

Inventory.Event.Loot.ItemsDiscarded

Broadcast when loot is discarded by the receiver (but can be used later).

Inventory.Event.Loot.ItemsReceived

Broadcast when loot is received by the requester (both authority and local client).

Inventory.Event.Loot.ItemsSelected

Broadcast after loot is selected for a player.

Inventory.Event.Loot.ItemsTransferred

Broadcast after loot is successfully transferred from the source.

All loot events will provide the following properties:

  • Requester: Inventory that requested the loot.

  • EventTag: Gameplay Tag representing the loot event.

  • Loot: Array containing the selected loot, if applicable.

Last modified: 31 July 2025