Skip to content

Initial Setup

The project setup starts by adding the necessary components to your base character or player state.

Installation

  1. Download the plugin from the Epic Launcher.
  2. Enable the plugin in your project.
  3. Restart the Engine when requested.
Optionally move the plugin into your project

Since the Epic Launcher may automatically download updates, it's recommended that you move the plugin into your project's /plugin folder and then remove the version installed in the engine, using the launcher.

Ability System

The Inventory Framework uses the Gameplay Ability System to perform certain tasks, represented by Gameplay Abilities. The system also uses an Attribute Set to determine overall data such as wealth, encumbrance and equipment level, along with the Gameplay Effects to modify them.

This means you will need to configure the Gameplay Ability System in your project before moving on to the Inventory System.

  1. Your Pawn must provide access the Ability System Component via the AbilitySystemInterface. It does not matter where the Ability Component actually is, so you can decide between the Pawn or the Player State.

  2. If you want to use the default Inventory Attributes, then add the NinjaInventoryAttributeSet to your pawn as well. The WeightLimit Attribute is the only one that could need initialization. You are free to initialize the Wealth Attribute too.

  3. For now, we won't add any Gameplay Abilities as we'll have to configure them later on and they won't be necessary anyway during the first few steps with the system.

C++ Only

Unfortunately, the Gameplay Ability System does not provide a way to add Attribute Sets to your character using Blueprints. If you are uncomfortable with C++, you can look into an external plugin, like the GAS Companion!

Data Assets

Register the following assets in your Asset Manager Configuration:

  1. UNinjaInventoryContainerDataAsset
  2. UNinjaInventoryItemDataAsset
  3. UNinjaEquipmentDataAsset
  4. UNinjaEquipmentSlotDataAsset

C++ Modules

If you plan on using the system in C++, then make sure to add the appropriate modules to your Build.cs file.

public MyGame(ReadOnlyTargetRules target) : base(target)
{
    PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
    PublicDependencyModuleNames.AddRange(new []
    {
        // ...
        "GameplayAbilities",
        "GameplayTags",
        "GameplayTasks",
        "NinjaInventory",
        "NinjaInventoryEquipment",
        "NinjaInventoryGameplay",
        "NinjaInventoryUI",
        "StructUtils",
        // ...
    });
}

Inventory

The Inventory Manager Component must be added to your Pawn or Player State, depending on how persistent you need your inventory items to be, related to player respawns. Generally, you would have it in the same location as your Ability System Component.

Add the NinjaInventoryManagerComponent to the proper actor, Pawn/Character or Player State and add the InventoryManagerProviderInterface. We'll talk about this interface in more details later on, but for now, just implement the GetInventoryManager function, providing the Inventory Manager Component that you just added.

Equipment

The Equipment Manager is always added to the actual pawn or character, also know as the "Inventory Avatar".

Add the NinjaEquipmentManagerComponent to the proper actor and add the EquipmentManagerProviderInterface and implement the GetEquipmentManager function, providing the Equipment Manager component that you just added.