Melee Counter Attack

The Melee Counter Attack ability is a subclass of the Use ability and will allow the character to perform a melee counter attack after the character has blocked the opponent’s attack. The ability will start after the following requirements are met:

  • The character blocked a melee attack. The Block ability is required in order to block an attack.
  • The character has a melee weapon.
  • The opponent is within the Attack Distance.
  • The ability is started within the Counter Attack Timeframe after an attack has been blocked.

The Animator’s Item Substate Index value will be a unique ID that indicates which counter attack animation should be played. This ID is up to a nine digit number that has the following format:

AAABBBCCC

AAA: First three digits indicate the Item ID of the melee weapon that was blocked by the Block ability. The ID is an integer so any leading zeros will be truncated.
BBB: Middle three digits indicate the substate index of the use state that was blocked.
CCC: Last three digits indicate the substate index for the current ability. This is retrieved from the Use Animator Audio State Set on the Usable Item.

For an example lets say that the opponent has a sword which has an Item ID of 22. The opponent’s Use ability is playing an animation with an Item Substate Index of 1. Finally, the Use Animator Audio State Set on the melee weapon returns a value of 2. The resulting ID of this sequence of values will be 22001002.

When the Melee Counter Attack ability plays it will notify the opponent’s Counter Attack Response ability if it has been added to the opponent character. The Counter Attack Response ability allows the opponent to play a full body animation in response to the counter attack.

Setup

  1. Select the + button in the item ability list under the “Item Abilities” foldout of the Ultimate Character Locomotion component.
  2. Add the Melee Counter Attack ability.
  3. Add a new Melee Weapon component with a unique Action ID that should transition to the correct melee attack animation when the ability is active. As an example the Sword item has a Melee Weapon component with an Action ID of 4.
  4. Assign the Action ID specified within step 3 to the Action ID field of the Melee Counter Attack ability.
  5. Ensure the hit character is in the character’s EnemyLayer mask within the Character Layer Manager component.

Inspected Fields

Attack Distance

The maximum distance away from the opponent that the counter attack can start.

Counter Attack Time Frame

The counter attack can start if the character blocked an attack within the specified amount of time.