Ninja Bear Studio Plugins Help

Activate Equipment via Inventory Abilities

This how-to guide will expand on the Equipment Definition setup, enabling weapons to be activated.

Part 1: Configuring the Equipment

In this first part, you will create Actors to represent the Active Equipment and update the previously created Equipment Definitions to support the Activated state.

Create the Sword Actor

  1. In your Content Browser, navigate to your Blueprint folder.

  2. Create a new Blueprint using NinjaEquipmentActor as the parent. Name it BP_Weapon_Sword.

  3. Add a new Static Mesh Component and set your Sword's mesh to it.

  4. Navigate to the component's Collision settings and set the Collision Preset to No Collision.

Create the Shield Actor

  1. In your Content Browser, navigate to your Blueprint folder.

  2. Create a new Blueprint using NinjaEquipmentActor as the parent. Name it BP_Weapon_Shield.

  3. Add a new Static Mesh Component and set your Shield's mesh to it.

  4. Navigate to the component's Collision settings and set the Collision Preset to Custom, ensuring it only blocks your projectile channel, if applicable.

Configure the Equipment for the Sword

  1. Add a new State Configuration and set the State Tag to Equipment.State.Activated.

  2. In the Activated State Configuration, add a new entry to the Actors array. Set BP_Weapon_Sword as the Actor Class.

  3. Set Equipment.Slot.MainHand as the Slot Tag.

Configure the Equipment for the Shield

  1. Add a new State Configuration and set the State Tag to Equipment.State.Activated.

  2. In the Activated State Configuration, add a new entry to the Actors array. Set BP_Weapon_Shield as the Actor Class.

  3. Set Equipment.Slot.OffHand as the Slot Tag.

Configure Virtual Slots in your Equipment Manager

  1. Go to your character's Equipment Manager and configure the following Virtual Slots:

  2. Create a Main Hand Slot by mapping the Gameplay Tag Equipment.Slot.MainHand to the sSword_RH socket.

  3. Create an Offhand Slot by mapping the Gameplay Tag Equipment.Slot.OffHand to the sShield_LH socket.

  4. When you are done, your Equipment Manager configuration should look like this:

    Virtual Sockets for Equipment

Part 2: Configuring the Gameplay

In this second part, you will configure the Animations, Abilities, and Input to enable equipment to be equipped and stored.

Configure your Animation Montages

  1. Select the Animation Sequence representing the Activate action. Create an Animation Montage from it and name it M_WeaponAndShield_Equip.

  2. Open your Animation Montage and add the Send Equipment Event Animation Notify to the frame where the Sword should be equipped.

  3. In the Notify, set the Event Tag to Inventory.Event.Animation.Activate and add Inventory.Item.Weapon.Sword to the Equipment Tags.

  4. Add another Notify to the frame where the Shield should be equipped.

  5. In the Notify, set the Event Tag to Inventory.Event.Animation.Activate and add Inventory.Item.Weapon.Shield to the Equipment Tags.

  6. Repeat these steps to create another Animation Montage named M_WeaponAndShield_Store, representing the Deactivate event. In the Animation Notify, set the Event Tag to Inventory.Event.Animation.Deactivate.

Configure the Animation Table

  1. In your Content Browser, navigate to your data folder and create a new Data Table using InventoryAnimationTableRow as the Row Structure. Name it TB_Inventory_Animations.

  2. Open your new Data Table and add a new row. Set the Montage To Play to M_WeaponAndShield_Equip.

  3. Set the Montage Query to be compatible with an Activation event involving a shield and other one-handed weapons.

    Equip Weapon Montage Query
  4. Add another row and set the Montage To Play to M_WeaponAndShield_Store.

  5. Set the Montage Query to be compatible with a Deactivation event involving a shield and other one-handed weapons.

    Store Weapon Montage Query

Create the Activate Equipment Ability

  1. In your Content Browser, navigate to your ability folder and create a new Gameplay Ability using InventoryAbility_ActivateEquipment as the parent. Name it GA_Equip_PrimaryItems.

  2. Open your new ability and configure the Equipment Query as shown below:

    Equip Weapon Ability Query
  3. Set TB_Inventory_Animations as the Montage Table and choose Wait For Gameplay Event as the Animation Strategy.

  4. Add Ability.Equipment.Primary.Activate to the Ability Tags.

  5. When you are done, your Ability should look like this:

    Equip Weapon Ability

Create the Deactivate Equipment Ability

  1. In your Content Browser, navigate to your ability folder and create a new Gameplay Ability using InventoryAbility_DeactivateEquipment as the parent. Name it GA_Store_PrimaryItems.

  2. Open your new ability and configure the Equipment Query as shown below:

    Store Weapon Ability Query
  3. Set TB_Inventory_Animations as the Montage Table and choose Wait For Gameplay Event as the Animation Strategy.

  4. Add Ability.Equipment.Primary.Deactivate to the Ability Tags.

  5. When you are done, your Ability should look like this:

    Store Weapon Ability

Map your Inputs to Activate Abilities

  1. Create an Input Action to activate the Equipment.

  2. Add the action to an Input Mapping Context assigned to the Player Character and map it to an appropriate key.

  3. Create the Input Handling logic to activate the Equipment. For simplicity, it will attempt to activate both abilities, but the one with an invalid query result won't activate.

    Default input for activating equipment

Test your Results and Check the Gameplay Debugger

  1. Hit the Play button and press the key you set to activate the equipment. Your animation should play, and the sword and shield should be equipped. Press the key again, and they should be stored.

    Equip and Store weapons
  2. As you equip and store the weapons, notice that the Equipment column in the Gameplay Debugger will alternate between states.

Last modified: 12 August 2024