# Seam Patterns

> What the enemy layer and the player layer do together: an enemy fighting with the player's weapon, one damage path both ways, enemies reading the player's guard, telegraphs both ways, targeting both ways, a reaction cutting a combo, and an enemy the player executes.

Markdown version of https://rigbak.com/docs/universal-combat-framework/seam-patterns, a page of the Universal Combat Framework documentation. Link that page when citing it.

> The enemy layer and the player layer share one set of combat systems, so a hit, a guard, a telegraph and a lock work the same in both directions. Each pattern below names the demo assets that show it and the settings that make it work.

Every pattern names the assets to open. They sit in the plugin's content under `Demo`; turn on **Show Plugin Content** in the Content Browser's settings to see them.

> **Warning**
>
> **Build on copies of the demo assets.** A plugin update replaces the plugin's content and drops any edit made in place, so a change you mean to keep belongs on a copy: duplicate the asset into your own content, change the copy, and point your enemy or character at it.

## Pick a pattern

| Pattern | See it in the demo | What makes it work |
| --- | --- | --- |
| [An enemy that fights with the player's weapon](https://rigbak.com/docs/universal-combat-framework/seam-patterns#an-enemy-that-fights-with-the-players-weapon) | The Over Shoulder arena and the dual-sword boss in `LVL_UCF_Demo` | An item drawn through the enemy's **Loadout**, and actions that play its graph |
| [One damage path, both ways](https://rigbak.com/docs/universal-combat-framework/seam-patterns#one-damage-path-both-ways) | Any hit, either way | One receiving side for every hit |
| [Enemies that read the player's guard](https://rigbak.com/docs/universal-combat-framework/seam-patterns#enemies-that-read-the-players-guard) | Built on the combo enemy's set | One state tag both layers use |
| [Telegraphs, both ways](https://rigbak.com/docs/universal-combat-framework/seam-patterns#telegraphs-both-ways) | The baton's and the fists' attacks | One announcement with two listeners |
| [Targeting, both ways](https://rigbak.com/docs/universal-combat-framework/seam-patterns#targeting-both-ways) | Lock on to a combo enemy | **UCF Enemy Targetable** and one team check |
| [A reaction that cuts a combo](https://rigbak.com/docs/universal-combat-framework/seam-patterns#a-reaction-that-cuts-a-combo) | Hit a combo enemy mid-combo | **Cancel Current Action** on the reaction |
| [An enemy the player executes](https://rigbak.com/docs/universal-combat-framework/seam-patterns#an-enemy-the-player-executes) | The dual-sword boss | The player layer's finisher on the enemy, and an AI that holds still for it |

---

## An enemy that fights with the player's weapon

**In the demo:** the Over Shoulder arena of `LVL_UCF_Demo` holds six combo enemies, `BP_UCF_ComboEnemy_RandomWeapon`. Each draws the baton, the sword or its fists as it spawns, the same items the player carries, and plays combos from that item's action graph. The Soulslike arena's dual-sword boss holds two of the player's swords and plays strings from the sword's graph. The Freeflow arena's bare-handed crowd plays the ability attacks of its Action Sets, for comparison.

**What makes it work:**

1. The enemy holds the item through its **Loadout**: **Starting Items** or **Random Starting Items** name it, and its **UCF Equipment Manager** draws it the way the player's character draws. The item hands the enemy its action graph, its animation layer and its trace sockets, exactly as it does for the player. **UCF Enemy Character Base** carries the Loadout, the Equipment Manager and a **UCF Anim Manager**; [Enemy Weapons](https://rigbak.com/docs/universal-combat-framework/enemy-weapons) covers them.
2. The enemy carries a **UCF Action Graph** component, which runs the graph, and **UCF Enemy Attack Steering**, which aims each move at the target the AI fights. [Action Graphs in Action Sets](https://rigbak.com/docs/universal-combat-framework/action-graphs-in-action-sets#what-the-enemy-needs) lists each piece.
3. The Loadout's **Item Sets** rows hand the AI an Action Set per item. The baton's, `ActionSet_UCF_ComboEnemy`, mixes ability attacks with **Action Graph Combo** actions that press the baton's inputs, and with **Action Sequence** actions that string both together; the sword's and the fists' play strings from their own graphs.

Change the item and the enemy's combos follow it: a combo with **Action Graph** left empty plays whatever graph the drawn item carries.

---

## One damage path, both ways

**In the demo:** hit a combo enemy with the player's sword, then let it hit you with the baton.

Every swing ends in the same place, whichever side swings. Both swing the same **UCF Melee Trace** and pass their hits through the same confirmed hit step: a player's machine reports its hits and the server checks them, and an enemy's swings are swept on the server. Both then go through one function: it builds the damage from the swing's **Damage Config** and hands it to the struck actor's **UCF Damageable** answer. Both character bases answer through the same defense step, which walks their defense responses and then drains their vitals. One consequence each:

| What | Works both ways because |
| --- | --- |
| A **Damage Config** | It describes the hit, whichever side deals it: one config serves a player's sword and an enemy's. |
| A **Defense Rule Set** | An enemy's guard blocks a player's sword the way a player's guard blocks an enemy's club. |
| Health | `UCF.Vital.Health` is one tag, the pool both sides lose. |
| A dodge | Both melee traces pass through a victim holding `UCF.State.Intangible`, so one **UCF State Tag Window** on a dodge montage dodges either side's swings. |
| Teams | Both traces ask one team check: with **Team Filter** on **Enemies Only**, a swing passes over teammates on either side. The player's trace and the one on **UCF Enemy Character Base** start there; **Enemy Character Base** starts on **No Filter**. |

> **Note**
>
> Two names stay apart, one for each layer, and a project picks one of each. Damage kinds: the enemy layer's sit under `UCF.Damage.*`, which the ready-made configs in `Core/Damage` name, and the player layer's under `UCF.DamageType.*`, which every demo weapon's config names, the enemies' swings included. Answer tags a defense response reports: the enemy layer's `UCF.Defense.*` and the player layer's `UCF.DamageResult.*`. Every demo set reports `UCF.DamageResult.*`, and every demo asset that reads an answer reads that family. A resistance or a hit effect that waits on an answer matches whichever family its attacks and responses carry.

[Melee Trace and Damage](https://rigbak.com/docs/universal-combat-framework/melee-trace-and-damage) and [Defense](https://rigbak.com/docs/universal-combat-framework/defense) cover each side in full.

---

## Enemies that read the player's guard

**Build it on** a copy of `ActionSet_UCF_ComboEnemy`.

A player raising a guard holds `UCF.State.Blocking`, and an enemy's block holds the same tag: both layers name it the same way. An enemy's action reads tags through **Tag Score Multipliers**: an entry counts while the exact tag sits on the action's target, on the enemy itself or on the world, so the action can answer what the player is doing.

1. Open the combo enemy's Action Set and select the action that should wait out a guard, such as **LightCombo**.
2. Under **Scoring**, add an entry to **Tag Score Multipliers**: `UCF.State.Blocking` at `0.3`. The combo scores 0.3 times as high while the player guards.
3. Select an action that breaks a guard, such as **HeavyCombo**, and add `UCF.State.Blocking` at `2.0`. It is twice as likely against a raised guard.

An entry cannot tell those three apart: an enemy holding `UCF.State.Blocking` through its own block reaction counts the entry too, at a decision made while that reaction still holds the tag.

---

## Telegraphs, both ways

**In the demo:** the baton's attack montages, `AM_UCF_TwoHanded_SingleAttack`, `_DoubleAttack` and `_TripleAttack`, and the fists' combo carry a **UCF Telegraph Window**, so an enemy swinging them raises a marker, whether its AI plays them as ability attacks or through the item's action graph. The player character, `BP_UCF_Character`, carries a **UCF Telegraph Viewer** set to `TelegraphStyle_UCF_Default`.

A telegraph window on an attack announces the attack once, and two listeners hear it:

- **A player sees an enemy's attack.** Each player's **UCF Telegraph Viewer** shows the marker its style set picks for the attack, on that player's own machine. An enemy playing a baton combo raises the same markers a player swinging it would show to another player.
- **An enemy hears a player's attack.** The server passes the announcement to every enemy inside the window's shape as the stimulus `UCF.Stimulus.AttackTelegraphed`, and an enemy's Reaction Set can answer it with a parry or a dodge before the blow lands. The demo's `ReactionSet_UCF_TwoHanded` carries a rule on that stimulus.

Neither direction needs wiring beyond the window and the listener. **Show Marker** on a **UCF Telegraph Subject** shows a marker to players only; **Report Area Stimulus** reaches enemies only. [Telegraphs](https://rigbak.com/docs/universal-combat-framework/telegraphs) covers the window, the marker styles and the stimulus.

---

## Targeting, both ways

**In the demo:** walk up to a combo enemy in `LVL_UCF_Demo` and lock on. The player soft-targets and locks the enemy while the enemy picks the player and attacks; put both on one team and they leave each other alone; kill the enemy and it drops out of targeting.

**What makes it work:**

1. **The enemy is a target the player can pick.** **UCF Enemy Character Base** carries a **UCF Enemy Targetable** component, so the player's targeting finds it and can lock it. It turns off when the enemy dies, so a lock lets go of a dead enemy, and goes back to its earlier setting when the enemy is revived. An enemy on **Enemy Character Base** gets the same by adding **UCF Enemy Targetable**.
2. **One team check decides who fights whom.** The player's targeting asks it through its config's **Target Teams**, an enemy through its own team. Each side carries a **UCF Team** component as `TeamComponent`: an enemy's starts on team 1, and a character on **UCF Character Base** starts on no team until its **Team Id** is set, which every **Enemies Only** filter treats as hostile. The demo player is on team 0. Give the player the enemies' **Team Id** and both sides leave each other alone.
3. **The enemy keeps its distance.** Set **Keep Distance** to **On** on the enemy's **UCF Approach** component and its ability attacks stop short of the target they aim at, as a player's attacks stop short of an enemy.

[Targeting](https://rigbak.com/docs/universal-combat-framework/player/targeting) covers the player's side, and [Targeting System](https://rigbak.com/docs/universal-combat-framework/enemy/targeting-system) the enemy's.

---

## A reaction that cuts a combo

**In the demo:** hit a combo enemy in the middle of a combo. Its reaction starts, the combo ends with the **Interrupted** reason, and the enemy's action graph stands back at idle, free for the reaction.

**What makes it work:** a reaction's **Cancel Current Action**, under its **Execution** settings behind **Advanced**, is ticked by default. When the reaction fires it stops the running action, and an **Action Graph Combo** stopped early cuts the move its graph is running. Nothing else is needed: every reaction cuts a combo the way it cuts an ability attack.

Untick **Cancel Current Action** on a reaction that should play over the combo, such as a shout, and the combo plays on.

---

## An enemy the player executes

**In the demo:** in the Soulslike arena, bring the dual-sword boss's health low. It staggers and stays down, and a light attack beside it plays the sword execution: the player knocks one of its swords away, kills it and throws it.

**What makes it work:**

1. **The enemy carries the player layer's finisher.** `BP_UCF_DualSwordBoss` answers hits through the player layer's character rule set, `DefenseRuleSet_UCF_Character`, whose health floor stops its health at 150 and opens its finisher stun, `GA_UCF_FinisherStun`, which holds `UCF.State.Finishable`. Its own tag, `UCF.Enemy.SoulslikeBoss`, is the one the sword's execution set asks for. [Getting Started](https://rigbak.com/docs/universal-combat-framework/getting-started#the-dual-sword-boss) lists every piece.
2. **The enemy needs no paired setup.** The execution gives the enemy its role as it plays, the same way it does for any character.
3. **The AI holds still for it.** While the player layer stuns, flinches or recoils an enemy on **UCF Enemy Character Base**, or plays it in a paired action, the base stops the action and reaction the enemy is running and holds its actions and reactions, so its next attack cannot break the stun and its parry or dodge cannot cut the execution short. An enemy on **Enemy Character Base** needs the same: put `UCF.Action.BlockActions` and `UCF.Reaction.BlockReactions` on it while it holds `UCF.State.PairedAction`.

[Paired Actions](https://rigbak.com/docs/universal-combat-framework/player/paired-actions) builds an execution, and [Hit Reactions](https://rigbak.com/docs/universal-combat-framework/player/hit-reactions) the stun and the flinch.

---

## Debug it

| Run | Shows |
| --- | --- |
| `UCF.Debug.EnemyActions 1` | Each enemy's actions above its head, the running one in yellow. |
| `UCF.Debug.Actions 1` | The node each character's action graph stands in, enemies included. |
| `UCF.Debug.Melee.DrawTracing 1` | Every melee sweep, either side's. |
| `UCF.Debug.Stimulus.Draw 1` | The ground each announcement covers, and a sphere on every pawn it reached, colored by what that pawn did with it. |
| `UCF.Debug.Teams 1` | The team each pawn fights for, above its head. |
| `UCF.Debug.Paired.Draw 1` | Both roles' spots while an execution plays. |

Previous page: [Sequences and Random Options](https://rigbak.com/docs/universal-combat-framework/sequences-and-random-options). Next page: [Vitals](https://rigbak.com/docs/universal-combat-framework/vitals)
