Item System API


1 BP_ItemEntityBase_USG


1.1 Propeties


  • PickupClass: The pickup entity class for this item entity.

  • GenPickupWhenDiscard: If true, a pickup actor(using PickupClass) will be generated on the groud after discarding this item.

  • ItemID: The id of this item.

  • InstanceID: The unique instance id of this item.

  • Count: The current item count.

  • ItemDefinition: The cache item definition from item table.

  • InventoryMgr: The reference of item manager.

  • OwnerActor: The owner actor of this item.


1.2 Functions


  • OnGained: When obtaining items, you can do some initialization operations.

  • OnCountChanged: The Callback function when current item count changed.

  • TryUseItem: The interface triggered when item used.

  • TryDisuseItem:The interface triggered when item disused.

  • TryDiscardItem:The interface triggered when item discarded.


2 BP_PickupEntity_USG


2.1 Propeties


  • DefaultPickupList: The list of item id that can be picked up. The item id is configured at the item table.

  • IsAutoPickup: If true, the items will be auto picked up when the player overlap this pickup actor.

  • IsDestroyAfterPickup: If true, this pick up actor will be destroyed after all items are picked up.

  • Sphere: Config the sphere radius for overlapping. Listening to this event to show display ui.

  • RepPickupList: The replicated list to maintain available items as different players can pick up items from the same pickup entity actor.


2.2 Functions


  • GetBeginOverlapDistance: Return the begin overlap distance between character and pickup actor.

  • GetEndOverlapDistance: Return the end overlap distance between character and pickup actor. Generally, this distance should be larger then begin overlap distance to avoid trigger overlap too frequently.

  • AddPickupItem: Add an available item for this pickup actor at runtime as player can pick up more than one item from a pickup entity.


3 BP_InventoryManager_USG


3.1 Propeties

  • DepotCapacity: The depot capacity for storing all items.

  • VerifyPickupDistance: The distance to verify if a pick up action is valid.

  • ItemDefinitionTable: The item definition table reference.

  • LogicItemList: The replicated List of all items, mainly stored all items ID and status and used to synchronize items to the clients.

  • AllItemEntities: All items entities, which are only existing on the authorization side, please do not use this list on the client.

  • PickupEntities: All pickup entities nearby the character.

  • ItemClassCache: The map to cache the item entity class.

  • ItemDefinitions: The map to cache all item definitions.


3.2 Functions


  • AddItem: Add one single item (authorization side only).

  • AddItems: Add multiple items (authorization side only).

  • TryUseItem: Try use the item and this function will notify server if calling from client.

  • TryDisuseItem: Try disuse the item and this function will notify server if calling from client.

  • TryDiscardItem: Try discard the item and this function will notify server if calling from client.

  • GenerateItemEntity: Generate item entity instance.

  • GetItemDefinition: Get item difinition from cache or table.

  • GetRuntimeDataByItemID: Get the first item runtime data from the item list by item id.

  • GetRuntimeDataByInstanceID: Get the unique item runtime data from the item list by instance id.

  • GetItemCount: Get item count by item id and instance id.

  • IsCapacityEnough: Is the capacity enough to add current item.

  • GetUsedDepotCapacity: Return the used depot capacity.

  • IsItemInUse: Return if the item is inused (equipped).

  • HasItem: Check if the item is existing in the inventory.

  • CanUseItem: Check if the item can be used.

  • AddPickupEntity: Add an available pick up entity.

  • RemovePickupEntity: Remove the pick up entity while endoverlapping.

  • GeneratePickupEntity: Generate pick up entity instance.

  • ServerPickupItem: The server rpc function to pick up one item.

  • OnServerPickup: Call while player pick up item from server.


3.3 Events


  • OnPickupsChanged:The event that will be called when the pickups changed.

  • OnItemsChanged: The event that will be called when the item list changed.

  • OnAddItemFinished: The event called after adding item.

  • OnUseOrDisuseItemFinished: The event called after use or disuse item.