Ninja Bear Studio Plugins Help

Configure Equipment for Stored Items

This how-to will show how to configure Equipment for Items that were previously created. Specifically, the Sword and the Shield.

Currently, these items are automatically assigned to their preferred Containers. These Containers are configured to set the default Equipment State to Deactivated. Therefore, an Equipment Definition should be introduced to properly represent these Items.

In this topic, you will see a Static Mesh being used to represent the stored weapons, so make sure to have those ready before getting started.

Configure Equipment Slots in the Character

  1. Open your character's Skeleton Asset.

  2. Add a socket named sSword_RH to the Right Hand bone. Adjust the location and rotation as necessary.

  3. Add a socket named sShield_LH to the Left Hand bone. Adjust the location and rotation as necessary.

  4. Add two sockets to the Spine 03 bone: sSword_Stored and sShield_Stored. Adjust their location and rotation as necessary.

  5. Open your character's Blueprint.

  6. Add a Static Mesh Component, child of the character's Mesh, set the Parent Socket to sSword_Stored, and add Equipment.Slot.Back.Weapon.A.Right to the list of Component Tags.

  7. Add a Static Mesh Component, child of the character's Mesh, set the Parent Socket to sShield_Stored, and add Equipment.Slot.Back.Weapon.A.Left to the list of Component Tags.

Add the Equipment Manager to the Character

  1. Add the Equipment Manager component to your Character.

    In Blueprints, go to your Components, search for Equipment and add Ninja Equipment Manager Component.


    Add the Equipment Manager Component

    Create a variable for the of UNinjaEquipmentManagerComponent in your class.


    #pragma once #include "CoreMinimal.h" #include "GameFramework/Character.h" #include "PluginLabsPlayerCharacter.generated.h" class UNinjaEquipmentManagerComponent; UCLASS() class PLUGINLABS_API APluginLabsCharacter : public ACharacter { GENERATED_BODY() public: APluginLabsCharacter(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get()); private: /** Hard reference to the Equipment Manager Component used by the player. */ UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Components", meta = (AllowPrivateAccess = true)) TObjectPtr<UNinjaEquipmentManagerComponent> EquipmentManagerComponent; };

    Create an instance of UNinjaEquipmentManagerComponent in your constructor.


    #include "GameFramework/PluginLabsCharacter.h" #include "Components/NinjaEquipmentManagerComponent.h" APluginLabsCharacter::APluginLabsCharacter(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) { static const FName EquipmentComponentName = TEXT("EquipmentManager"); EquipmentManagerComponent = CreateOptionalDefaultSubobject<UNinjaEquipmentManagerComponent>(EquipmentComponentName); }
  2. Add the Equipment Manager Provider Interface to your Character.

    Open your Class Settings, navigate to the list of Implemented Interfaces and add the interface.


    Add the Equipment Manager Component

    In the My Blueprint panel, under Interfaces, expand Equipment Manager Provider and double-click Get Equipment Manager.

    In the Blueprint Graph, drag your Equipment Manager into the Return Value.


    Add the Equipment Manager Component

    Add IEquipmentManagerProviderInterface to your class declaration, and override GetEquipmentManager.


    #pragma once #include "CoreMinimal.h" #include "GameFramework/Character.h" #include "APluginLabsPlayerState.generated.h" class UNinjaEquipmentManagerComponent; UCLASS() class PLUGINLABS_API APluginLabsCharacter : public ACharacter { GENERATED_BODY() public: APluginLabsCharacter(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get()); // -- Begin Equipment Provider implementation virtual UNinjaEquipmentManagerComponent* GetEquipmentManager_Implementation() const override; // -- End Equipment Provider implementation private: /** Hard reference to the Equipment Manager Component used by the player. */ UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Components", meta = (AllowPrivateAccess = true)) TObjectPtr<UNinjaEquipmentManagerComponent> EquipmentManagerComponent; };

    Implement GetEquipmentManager, so it returns the Equipment Manager.


    #include "GameFramework/PluginLabsCharacter.h" #include "Components/NinjaEquipmentManagerComponent.h" APluginLabsCharacter::APluginLabsCharacter(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) { static const FName EquipmentComponentName = TEXT("EquipmentManager"); EquipmentManagerComponent = CreateOptionalDefaultSubobject<UNinjaEquipmentManagerComponent>(EquipmentComponentName); } UNinjaEquipmentManagerComponent* APluginLabsCharacter::GetEquipmentManager_Implementation() const { return EquipmentManagerComponent; }

Create the Sword Equipment Definition

  1. In your Content Browser, navigate to your equipment data folder. If you are creating a new folder, it should match the configuration in your Asset Manager.

  2. Right-click in any empty area, select the Inventory category and then Equipment Definition.

  3. Name your new container asset Equipment_Sword and open it.

  4. Add a new State Configuration and set the State Tag to Equipment.State.Deactivated.

  5. In the Deactivated State Configuration, add a new entry to the Static Meshes array. Set the Static Mesh that represents your sword to the Mesh.

  6. Set Equipment.Slot.Back.Weapon.A.Right to the Slot Tag and sSword_Stored to the SocketName.

  7. When you are done, your Sword Equipment Definition should be similar to this.

    Sword Equipment Definition with the Deactivated state

Update the Sword Item Definition

  1. Open the Sword Item Definition and add an Equipment Fragment

  2. Set the Equipment_Sword to the Equipment Data.

    Sword Item Definition with the Equipment Fragment

Create the Shield Equipment Definition

  1. In your Content Browser, navigate to your equipment data folder. If you are creating a new folder, it should match the configuration in your Asset Manager.

  2. Right-click in any empty area, select the Inventory category and then Equipment Definition.

  3. Name your new container asset Equipment_Shield and open it.

  4. Add a new State Configuration and set the State Tag to Equipment.State.Deactivated.

  5. In the Deactivated State Configuration, add a new entry to the Static Meshes array. Set the Static Mesh that represents your shield to the Mesh.

  6. Set Equipment.Slot.Back.Weapon.A.Left to the Slot Tag and sShield_Stored to the SocketName.

  7. When you are done, your Shield Equipment Definition should be similar to this.

    Shield Equipment Definition with the Deactivated state

Update the Shield Item Definition

  1. Open the shield Item Definition and add an Equipment Fragment

  2. Set the Equipment_Shield to the Equipment Data.

    Shield Item Definition with the Equipment Fragment

Check your Inventory in the Gameplay Debugger

  1. Hit Play, open the Gameplay Debugger and activate the Inventory category.

  2. Confirm that the Sword and Shield now show Deactivated in the Equipment column, meaning that an Equipment Instance is present.

    Your Sword and Shield meshes should be properly attached to your character.

    Equipment in the Gameplay Debugger
Last modified: 23 August 2024