Ninja Bear Studio Plugins Help

Create Melee Attacks

This how-to will show you how to create your first Attacks, using a Melee Weapon.

Add the Melee Scan Sockets

  • Open the Static Mesh for the Sword and add three sockets along the blade.

    Make sure to prefix your sockets with sScan. The prefix will be used shortly.

    Sword Sockets

Create the Animation Montage for a light attack

  1. Create an Animation Montage based on an appropriate Animation Sequence that represents the Light Attack.

  2. In the Animation Montage, add the Melee Scan Notify State along the frames where the scan should happen.

  3. In the Notify State Details, set the Source to Weapon and your Scan Channel to Weapon.

    Melee Scan Notify State
  4. Configure the Weapon query, so it will obtain the sword from the Weapon Manager.

    Melee Scan Notify Query

Create the Animation Montage for a heavy attack

  • Repeat the same steps from the previous procedure, this time for a heavy attack.

Create the Light Attack Ability

  1. Create a new Gameplay Ability for your Light Attack, using the CombatAbility_Attack as the base.

  2. In the Details Tab, enable the Is Melee Attack and disable Is Ranged Attack flags.

  3. Set the first Animation Montage for the Light Attack to the Default Animation Montage.

  4. Disable the Motion Warping functionality.

  5. Add Ability.Attack.Primary to the Ability Tags, so it can be used for the activation.

    Add Ability.Attack.Secondary to the list of Block Abilities with Tag, to ensure your attacks won't interrupt each other.

  6. When you are done, your Light Attack Ability should be similar to the following image.

    Light Attack Ability

Create the Heavy Attack Ability

  1. Create a new Gameplay Ability for your Heavy Attack, using the CombatAbility_Attack as the base.

  2. In the Details Tab, enable the Is Melee Attack and disable Is Ranged Attack flags.

  3. Set the first Animation Montage for the Heavy Attack to the Default Animation Montage.

  4. Disable the Motion Warping functionality.

  5. Add Ability.Attack.Secondary to the Ability Tags, so it can be used for the activation.

    Add Ability.Attack.Primary to the list of Block Abilities with Tag, to ensure your attacks won't interrupt each other.

  6. When you are done, your Heavy Attack Ability should be similar to the following image.

    Heavy Attack Ability

Add your Abilities to your character

  1. Create an Ability Bundle for the player and add the new abilities to it.

    Ability Bundle Ability
  2. Add the Ability Bundle to the Ability System in the Player State.

    Ability Bundle Ability

Configure your Player Inputs

  1. Create an Input Action for the Light Attack. Add a Pressed trigger. Map this Input Action to your Input Mapping Context, assigning the Left Mouse Button as the key.

  2. Create an Input Action for the Heavy Attack. Add a Pressed trigger. Map this Input Action to your Input Mapping Context, assigning the Right Mouse Button as the key.

  3. Add two Input Handlers to your Input Setup Data Asset, using the Activate Ability by Tags as the base.

  4. Set the correct Input Actions for each attack, and the correct Ability Tags defined earlier: Ability.Attack.Primary and Ability.Attack.Secondary.

  5. When you are done, your Input Setup Data Asset should be similar to the following image.

    Melee Attack Inputs

Execute your melee attacks

  1. Click the Play button.

  2. Press the buttons assigned to your attacks, Left and Right Mouse buttons. Your attacks should execute.

    Light and Heavy Attacks

Enable the Attack Debug

  1. Open your Attack Abilities and check Enable Debug property.

  2. Click the Play button.

  3. Press the buttons assigned to your attacks, Left and Right Mouse buttons, you should see the melee traces. When you are done, uncheck the Enable Debug property from the Attack Abilities.

    Light and Heavy Attacks with Debug
Last modified: 15 August 2024