🎒Inventory Component

Overview

Handles the main inventory logic, storage, slot restrictions, and multiplayer replication.

Replicated Fields:

  • Inventory: Array of s.FItem

  • MaxSlotsInInventory: Maximum allowed slots.

  • SlotRestrictions: Optional restrictions per slot (allowed item types).

Blueprint Delegates:

  • FOnItemAdded

  • FOnItemRemoved

Core Functions:

  • TryAddItem(...): Adds an item (stack or new slot).

  • RemoveItem(...): Removes quantity from a slot.

  • RemoveItemByDefinition(...)

  • GetItemAtSlot(int32)

  • HasItem(UItemDefinition*)

  • FindEmptySlot()

  • FindSlotWithItem(UItemDefinition*)

Replication & Prediction:

  • ServerRequestPickupItem()

  • ClientConfirmPickup()

  • ClientRejectPickup()

  • ServerModifyInventory()

Slot Restriction Example

FInventorySlotRestriction Restriction;
Restriction.bAcceptAllTypes = false;
Restriction.AllowedItemTypes = { FGameplayTag::RequestGameplayTag("Item.Weapon") };

Last updated