# Enemies That Parry, Dodge and Counter

> Make AI enemies in Unreal Engine 5 that parry, dodge and counter-attack the player's swings, set up in Blueprint with no C++.

Markdown version of https://rigbak.com/docs/soulslike-combat/enemy-parry-dodge-counter, a page of the Soulslike Enemy Combat documentation. Link that page when citing it.

> You swing and the enemy parries. You swing from the side and it dodges. Soulslike Enemy Combat does this with one Reaction Set asset, a trigger rule, and a marker on your attack animation.

## The problem

Enemies in most Unreal Engine projects take hits. A Behavior Tree picks an attack, plays it, and never looks at what the player is doing. The player learns to swing at will, and the fight has no back and forth.

Souls-like and action games fix this with enemies that **react**. The player winds up a blow, the enemy sees it coming, and it picks an answer: parry it, dodge it, block it, or hit back. Different swings get different answers, and the enemy does not answer every swing the same way.

Building that by hand means a way for attacks to warn nearby enemies, a rule for which warning gets which answer, a way to pick between answers, and cooldowns so an enemy cannot parry every hit of a fast combo. Soulslike Enemy Combat ships all of it as the Reaction System, and the counter-attack comes from the enemy's moveset.

---

You need an enemy built from the plugin's AI Config. If you have none, [Getting Started](https://rigbak.com/docs/soulslike-combat/getting-started) builds one in a few minutes.

## Set it up (5 minutes)

1. **Create a Reaction Set**

   Right-click in the Content Browser, **SEC**, **Actions**, **Reaction Set**. It opens on its own card canvas.
2. **Add a Parry and a Dodge**

   Right-click the canvas and choose **Add Reaction** twice. Name the first card's **Reaction ID** `Parry` and the second `Dodge`. On each, set **Ability Class** to **GA_SEC_MontageAbility**, which ships with the plugin, then set its **Montage** to the matching animation.

   In **DA_ReactionSet_Grunt**, under Execution, set:

   | Property | Value |
   | --- | --- |
   | Ability Class | GA_SEC_MontageAbility |
   | Montage | AM_Parry |

   *The shipped ability plays whatever montage the reaction names.*
3. **Say which event each answer fits**

   Right-click the canvas and choose **Add Trigger**. Set its **On Stimulus** to `SEC.Stimulus.AttackTelegraphed`, which means a swing is winding up nearby. Drag from the trigger's right pin to the left pin of each reaction card the rule may pick.

   > **Tip: One rule, two answers**
   >
   > Put an Incoming Angle Gate on Parry and give Parry the higher Priority. A frontal blow gets parried, and a blow from the side falls to the dodge with no second rule.
4. **Stop it from answering every swing**

   On the trigger, set **Chance** between 0 and 1. At 0.3 the enemy answers roughly a third of the swings. Set **Min Interval** (seconds) so it cannot answer every hit of a fast combo. Give each reaction a **Cooldown Duration** and a **Randomization (%)** so a pack does not parry in lockstep.
5. **Point the AI Config at it**

   Open the enemy's **Enemy AI Config** and set **Default Reaction Set** to the asset. Leave **Manage Reaction Sets Automatically** ticked.

   In **EnemyConfig_Grunt**, under Reaction Sets, set:

   | Property | Value |
   | --- | --- |
   | Manage Reaction Sets Automatically | true |
   | Default Reaction Set | DA_ReactionSet_Grunt |

   *Default Reaction Set covers every role, so one entry is enough to start.*
6. **Make the attack announce itself, and play**

   Open the player's attack montage and drag a **SEC Telegraph Window** across the wind-up frames. That window tells nearby enemies a blow is coming.

   Press Play, swing at the enemy, and run `SEC.Debug.LogReactions 1` to read which rule answered and which reaction won.

> **Warning**
>
> An attack montage with neither a **SEC Telegraph Window** nor a one-frame **SEC Telegraph** sends no warning. No rule runs, and the enemy stands there taking hits. Run `SEC.Debug.Stimulus.Draw 1` to see whether anything goes out. See [Telegraphs](https://rigbak.com/docs/soulslike-combat/attack-telegraphs).

An enemy answers a warning whether or not it has a combat target, so a patrolling enemy can parry the first swing of an ambush. One reaction runs at a time; a second request is refused while the first plays.

---

## Choose the answer for each kind of swing

Add more trigger rules to give different swings different answers: parry only heavy attacks, dodge what cannot be parried, or skip a parry that cannot start in time. Rules run highest **Rule Priority** first, so put the specific ones on top. [Reaction System](https://rigbak.com/docs/soulslike-combat/reaction-system#say-what-answers-each-event) lists the conditions for each.

---

## Hit back after a parry

A counter is an attack, so it lives in the enemy's **Action Set** next to its other moves. Add an action with **Action ID** `Counter`, then under its **Tag Score Multipliers** add `SEC.State.Staggered` with a value of 2.5. Multipliers read tags on the enemy, on its target and on the world, so the counter is worth two and a half times as much while the player is reeling, and the enemy reaches for it first.

Set **Action Recovery Time** to 0.8 under **Recovery** on the **Enemy AI Config** to leave a beat between its own attacks: it keeps strafing and parrying through that window and starts nothing new. The [duelist recipe](https://rigbak.com/docs/soulslike-combat/patterns#the-duellist) has the full numbers.

---

## Common questions

**What decides parry versus dodge?** The trigger rule and the gates on it. An Incoming Angle Gate sends frontal blows to the parry and the rest to the dodge. Weighted random picks between reactions that tie.

**Does a parry stop the damage by itself?** The reaction plays the animation. What the blow is worth when it lands comes from the [Defense System](https://rigbak.com/docs/soulslike-combat/defense-system): a Defense Rule Set with a **SEC Guard** response, whose **Required Defender Tags** the parry has to hold while it plays.

**Does the enemy cancel its own attack to react?** Yes, by default. **Cancel Current Action** is on, and unticking it lets a flinch play over the top.

**Do I need C++?** No. Every step on this page is a Data Asset, an AI Config value or a montage marker.

**The attack lands and the enemy does nothing.** Run `SEC.Debug.LogReactions 1`; it names the stage that refused. [Reaction System](https://rigbak.com/docs/soulslike-combat/reaction-system#debug-it) lists each cause in the order worth checking.

---

## Related

| Page | Why |
| --- | --- |
| [Reaction System](https://rigbak.com/docs/soulslike-combat/reaction-system) | Every rule and reaction field, scoring, and which set an enemy uses |
| [Defense System](https://rigbak.com/docs/soulslike-combat/defense-system) | What a parry or block is worth once the blow arrives |
| [Telegraphs](https://rigbak.com/docs/soulslike-combat/attack-telegraphs) | How an attack warns nearby enemies |
| [Reaction Set Editor](https://rigbak.com/docs/soulslike-combat/reaction-set-editor) | The canvas the rules and reactions are wired on |
| [Action System](https://rigbak.com/docs/soulslike-combat/action-system) | The attacking side, and the scorers and gates both share |
