Overview
The Generic Inventory System (GIS) offers a highly flexible pickup and drop system for items. This document provides a detailed explanation of their usage and how to extend their functionality.
Pickup System
GIS provides three default pickup systems: Item Pickup, Inventory Pickup (Loot), and Currency Pickup. All of these inherit from GIS_PickupComponent, each with their own configurations and logic. The pickup logic can be executed by calling the Pickup function.
1. Item Pickup
- Purpose: Used for picking up a single item at a time, such as weapons or armor dropped on the ground.
- Implementation:
- Add
GIS_WorldItemComponentandGIS_ItemPickupComponentto anyActorto create anItemPickupActor. - Component Details:
WorldItemComponent: Creates and holds an item instance in the world.ItemPickupComponent: Adds the referenced item fromWorldItemto the interactor's inventory.
- Add
2. Inventory Pickup (Loot)
- Purpose: Used for picking up multiple items at once, such as treasure chests or enemy drops after death in the game.
- Implementation:
- Add
GIS_InventoryPickupComponentto anyActorwith anInventorySystemcomponent to create anInventoryPickupActor. - Component Details:
InventorySystemComponent: Configures all items that can be picked up.ItemPickupComponent: Transfers items from the specified collection to the interactor's inventory.
- Add
3. Currency Pickup
- Implementation:
- Add
GIS_CurrencySystemComponentandGIS_CurrencyPickupComponentto anyActorto create aCurrencyPickupActor. - Logic Details:
- Upon pickup, all currency from the picked-up object's
CurrencySystemcomponent is removed and added to the picker’sCurrencySystemcomponent.
- Upon pickup, all currency from the picked-up object's
- Add
Case Study: BP_GIS_ItemPickup Blueprint
Simply using pickup components is not sufficient for a complete game experience. In practical applications, the pickup system needs to integrate with interaction, UI, and item visual effects to provide full functionality. The GIS companion project comes pre-configured with these features, ready to use out of the box.
Using the blueprint BP_GIS_ItemPickup provided in the companion project as an example:
- Place this blueprint in your level and configure it as needed.
- The blueprint includes the following components:
StaticMeshComponent: Controls the visual appearance of the pickup.PickupComponent: Specifies which inventory collection the item will be picked up into and manages success/failure audio feedback.SmartObjectComponent: Defines the interaction entry point for thePickupActor. Actors with interaction system components (e.g., players or AI) can search and interact with it to trigger pickup.WorldItemComponent: Configures an item definition and its quantity, creating and holding the item instance at runtime. Upon successful pickup, the item instance is added to the player's specified inventory collection.
- This blueprint is reusable, and you can also refer to it to create your own version, such as using particle effects instead of
StaticMeshfor visual representation.
Drop System
GIS provides two drop systems, each generating different types of PickupActor based on configuration.
- All drop systems inherit from
GIS_DropperComponentand can specify the generatedPickupActorClassfor drops. - Any
Actorintended to be a pickup must implement theGIS_PickupActorInterfaceto be selectable in theDropperComponent.
1. Item Drop
- Implementation:
- Add
GIS_ItemDropperComponentto enemies, NPCs, or scene objects (e.g., jars) that already have an inventory component. - Call the
Dropfunction on theDropperComponentwhen the enemy/NPC dies or the jar breaks to generate pickups based on configured rules.
- Add
- Configuration Options:
- Which inventory collection to drop items from.
- Drop type:
InventoryPickup(singleActor, pick up all at once) orItemPickup(multipleActors, requiring individual pickups). - Random radius variation during drop and drop origin (can be the dropper's position or another
Actor's position).
2. Currency Drop
- Implementation:
- Add
GIS_CurrencyDropperComponentto anActor. - Call the
Dropfunction at the appropriate time to generate the corresponding currency pickupActor.
- Add
Custom Extensions
- The core functionalities and API interfaces of both pickup and drop systems are encapsulated in component form.
- Developers can inherit from
GIS_DropperComponentandGIS_PickupComponentvia Blueprint or C++ and explore inheritable options to implement custom drop or pickup types.
