# Weapons

> Arm an enemy: build a weapon Blueprint, drop it in the starting loadout, and the enemy spawns holding it and fighting from its moveset.

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

> An enemy that spawns with its weapon in hand, sweeping from the blade, fighting from the moveset the weapon brings. Give the same skeleton a bow instead and it fights like an archer.

## Set it up (60 seconds)

1. **Make the weapon Blueprint**

   Right-click in the Content Browser, **Blueprint Class**, **All Classes**, and pick **SEC Weapon Base**. Name it `BP_Sword`.

   Add a **Static Mesh** component for the blade and drag it onto **DefaultSceneRoot** so the mesh is the root. The weapon attaches by its root, so a mesh whose pivot sits where the hand grips it needs no offset.
2. **Set the hand it sits in and the moveset it brings**

   Open **Class Defaults**. **Attach Socket** is the socket on the enemy's mesh the weapon hangs from, `hand_r` out of the box. **Weapon Action Set** is the moveset the enemy fights from while holding it.

   In **BP_Sword**, under Weapon, set:

   | Property | Value |
   | --- | --- |
   | Attach Socket | hand_r |
   | Weapon Action Set | DA_ActionSet_Sword |

   *Attach Socket has to exist on the enemy's skeletal mesh. Leave the set empty to keep the enemy's own moveset.*
3. **Tell it where it cuts**

   Add sockets to the weapon mesh at the hilt and the tip, then add one entry to **Trace Sockets** spanning them.

   In **BP_Sword**, under Trace Sockets, set:

   | Property | Value |
   | --- | --- |
   | ID | Blade (replaces None) |
   | Shape | Capsule Two Point (replaces Sphere) |
   | Socket or Bone Name | blade_start (replaces TraceStart) |
   | End Socket or Bone Name | blade_end (replaces TraceEnd) |

   *Equipping the weapon registers these on the wielder. Releasing it takes them away again.*
4. **Put it in the enemy's loadout**

   Open the enemy Blueprint, select its **SEC Equipment Component**, and add one entry to **Starting Loadout** naming the weapon class.

   In **BP_Enemy**, under Starting Loadout, set:

   | Property | Value |
   | --- | --- |
   | Equippable Class | BP_Sword |
   | Use as Weapon | true |

   *One entry per thing the enemy carries. Use as Weapon marks the one it fights with, and Socket Override left empty uses the socket the weapon names itself.*
5. **Play, and watch it swing**

   Press Play. The weapon arrives in the enemy's hand, its trace sockets register, and its sets reach the enemy. Run `SEC.Debug.Melee.DrawTracing 1` in the console to see the blade sweep.

> **Warning**
>
> **Use as Weapon** on the loadout entry decides whether any of the weapon reaches the enemy. With it off the weapon still spawns, attaches, and looks correct in the hand, while its moveset, its reactions and its animation layer go nowhere. One entry can be the weapon; mark two and the later one takes the slot, releasing the earlier one through **Swap Disposal**, which destroys it by default.

For the swings to deal damage, the attack montage also needs a trace window. See [Melee Trace](https://rigbak.com/docs/soulslike-combat/melee-trace).

---

## What the weapon gives its wielder

**Details panel: Weapon Defaults** (Blueprint, in BP_Sword)

**Category: SEC > Weapon**

| Property | Value |
| --- | --- |
| Attach Socket | hand_r |
| Attach Offset | Identity |
| Weapon Action Set | DA_ActionSet_Sword |
| Weapon Reaction Set | None |
| Weapon Defense Set | DA_SwordGuard |

**Category: SEC > Animation**

| Property | Value |
| --- | --- |
| Anim Layer to Use | ABP_Sword |

**Category: SEC > Trace**

| Property | Value |
| --- | --- |
| Trace Sockets | 1 Array element |

*Class Defaults on the weapon Blueprint. Leave a set empty to keep the enemy's own.*

| Field | Does |
| --- | --- |
| **Attach Socket** | The socket on the enemy's mesh the weapon hangs from, `hand_r` by default. A socket that does not exist attaches the weapon at the mesh root and says so in the log. |
| **Attach Offset** | Nudges the weapon from that socket. Leave it at identity when the mesh is authored with its pivot at the grip. |
| **Weapon Action Set** | The moveset the enemy fights from while holding this. |
| **Weapon Reaction Set** | The reactions it can answer with, for a parry that exists because it is carrying something to parry with. |
| **Weapon Defense Set** | How the wielder answers an incoming hit while holding this: the parry, the block, the resistance the weapon brings. |
| **Anim Layer to Use** | An animation layer linked onto the wielder, for locomotion and idles that belong to the weapon rather than the character. Only the equipped weapon's layer links, so an off-hand item does not replace it. |

**Weapon Action Set** and **Weapon Reaction Set** replace what the [AI Config](https://rigbak.com/docs/soulslike-combat/action-system#which-moveset-an-enemy-uses) gives. While the enemy holds the weapon its sets win; put the weapon down and the AI Config answers again. A runtime override set from Blueprint still outranks both. Leave either empty and the enemy keeps its own.

**Weapon Defense Set** adds instead of replacing, since a weapon's parry and a pawn's own armor are both in force at once. Everything held answers, so a shield in the off hand guards alongside the sword, and what the weapons bring runs ahead of the pawn's own responses. A pawn with no defenses of its own gains these by picking the weapon up. The plugin's enemy character gathers the sets off what it holds; a pawn built from scratch does that gathering itself through **Get Defense Sets**. See [Defense System](https://rigbak.com/docs/soulslike-combat/defense-system).

### Where its swings sweep from

**Trace Sockets** is where the weapon's swings sweep from. Add sockets on the weapon mesh first (`blade_start`, `blade_end`), then one array entry per contact point.

**Details panel: Trace Socket** (Blueprint, in Trace Sockets (weapon Blueprint))

**Category: Trace**

| Property | Value |
| --- | --- |
| ID | Blade |
| Source Component Tag | None |
| Shape | Capsule Two Point |
| Socket or Bone Name | blade_start |
| End Socket or Bone Name | blade_end |
| Radius | 15 |
| Override Trace Filter | false |

*One entry in the weapon's Trace Sockets array. Equipping registers it on the wielder.*

A socket that names no source of its own sweeps from the weapon's mesh, which is its skeletal mesh when it has one and its static mesh otherwise. Equipping registers these onto the wielder's **SEC Melee Trace Component**, so a wielder without one registers nothing and the blade sweeps nothing. Per-attack damage comes from the montage notify or the trace component default rather than from the weapon; [Melee Trace](https://rigbak.com/docs/soulslike-combat/melee-trace) covers the sweep shapes, the damage config and the montage window.

---

## Arming the enemy

The plugin's enemy character already carries an **SEC Equipment Component** and an **SEC Melee Trace**. A pawn built from scratch needs both: the equipment component to hold the weapon, the trace component for the weapon's trace sockets to register on.

**Details panel: SEC Equipment Component** (component, in BP_Enemy)

**Category: SEC > Loadout**

| Property | Value |
| --- | --- |
| Starting Loadout | 1 Array element |
| Equip Starting Loadout on Begin Play | true |
| Attach Mesh Component Tag | None |

**Category: SEC > Equipment**

| Property | Value |
| --- | --- |
| Swap Disposal | Destroy |
| Teardown Disposal | Destroy |
| Drop Lifetime | 0 |

*Spawns and holds the pawn's equipment. Enemy Character Base carries one already.*

Each **Starting Loadout** entry is one thing the enemy carries.

**Details panel: Equip Loadout Entry** (Blueprint, in SEC Equipment Component (Starting Loadout))

**Category: Loadout**

| Property | Value |
| --- | --- |
| Equippable Class | BP_Sword |
| Socket Override | None |
| Use Transform Override | false |
| Use as Weapon | true |

*One entry spawns one actor and equips it. Turn Use as Weapon off for an off-hand item.*

**Equippable Class** is the weapon Blueprint. **Socket Override** left empty uses the socket the weapon names itself. Tick **Use Transform Override** to offset this entry from its socket instead of using the offset authored on the weapon, which an off-hand item usually needs. **Use as Weapon** marks the one the enemy fights with, so a shield or a torch goes in with it turned off.

**Attach Mesh Component Tag** picks which of the pawn's meshes equipment hangs off, by component tag. Empty uses the pawn's own skeletal mesh. Untick **Equip Starting Loadout on Begin Play** to hold the list as data and arm the enemy later with **Equip Starting Loadout**.

While a weapon is equipped the enemy holds `SEC.Weapon.Equipped`. Put that in an action's **Requires Tags** so an unarmed enemy cannot swing a sword it is not holding.

> **Note**
>
> Equipping runs on the server. The weapon actor replicates, and so does which held actor is the weapon, so a client sees the right thing in the right hand and relinks the animation layer itself.

<details>
<summary>How often a weapon replicates (Multiplayer)</summary>

**SEC Weapon Base** sends updates ten times a second, and at once when it is equipped or released. A weapon Blueprint whose own replicated variables change often can raise **Net Update Frequency** in its Class Defaults.

</details>

---

## Swapping and dropping

**Spawn and Equip** puts a new weapon in the hand, **Equip Actor** equips one that already exists, and **Unequip Actor** takes one out. **Set Equipped Weapon** chooses which of the things already held the enemy fights with, and clearing it hands both sets back to the AI Config.

Two fields decide what becomes of a weapon the pawn is done with.

| Choice | What happens to it |
| --- | --- |
| **Destroy** | Removed from the level. The default for both fields. |
| **Leave In World** | Detached and left standing where it was, no physics. |
| **Drop** | Left in the level and asked to drop itself. The weapon's own **On Unequipped** event receives **Should Drop** and **Suggested Lifetime**, and turning on physics and setting a lifespan there is a couple of nodes. |

**Swap Disposal** covers the outgoing weapon when a new one replaces it. **Teardown Disposal** covers what the component spawned when the pawn is destroyed, which is what a game wants when a corpse despawns and its sword stays lying there. A weapon handed in through **Equip Actor** belongs to whoever made it, so it is released rather than destroyed.

**Drop Lifetime** on the equipment component is how many seconds a dropped weapon should stay in the level, so fallen weapons do not pile up over a fight. It reaches an **SEC Weapon Base**'s **On Unequipped** as **Suggested Lifetime**, or the unequip context's **Physics Drop Lifetime** on a weapon built on **SEC Equippable Interface**, and the weapon sets its own lifespan from it, as the demo weapons do. 0, the default, asks it to stay for good. The demo enemies drop theirs for 5 seconds.

Death releases the enemy's equipment through the **SEC Combat Controller Component** on the AI controller. **Drop Weapon on Death** on that component is on by default and releases with **Drop**; turn it off and death releases with **Leave In World** instead. Reviving does not re-arm the enemy, so call **Equip Starting Loadout** on the way back.

**On Equipped Weapon Changed** fires on the server and on every client when the weapon changes, for a marker on the HUD or an ability that reads a socket. **On Equipped** and **On Unequipped** on the equipment component fire on the server for anything held, each handing over the actor it concerns.

---

## Debug it

```
SEC.Debug.Melee.DrawTracing 1    // Draw the sweeps the weapon's sockets make
```

Equipping reports its own problems into the Output Log under **LogSECEquipment**. Filter on it and the log names the entry with no class, the pawn with no mesh to attach to, the socket that does not exist on the wielder's mesh, and the weapon carrying trace sockets that found no melee trace component to register on.

<details>
<summary>It equips, but the enemy fights the same (Advanced)</summary>

- **Use as Weapon is off** on the entry. The weapon attaches and contributes nothing.
- **Weapon Action Set is empty**, so resolution falls through to the AI Config, which is the point of leaving it empty.
- **A runtime override is set** on the pawn's action set component. It outranks the weapon until it is cleared.
- **The weapon answers nothing for this role.** A weapon overriding the per-role event and returning none for the enemy's current combat role leaves that role on its AI Config set.
- **A later entry took the weapon slot.** A second entry marked **Use as Weapon** replaces the first and releases it through **Swap Disposal**, which destroys it by default, so the enemy fights from the last one in the list.

</details>

<details>
<summary>It swings, but the blade sweeps nothing (Advanced)</summary>

- **The wielder has no SEC Melee Trace component.** The weapon carries its sockets and finds nothing to register them on, and says so in the log.
- **The weapon has no mesh.** A socket that names neither a source component nor a **Source Component Tag** is pointed at the weapon's own mesh, so a weapon with none registers nothing.
- **The socket names do not match the mesh.** **Socket or Bone Name** and **End Socket or Bone Name** have to exist on the weapon mesh.
- **The montage window names a different ID.** **Socket IDs** on the trace window has to match a socket **ID** exactly. Leave it empty to sweep everything registered.
- **You are watching a client.** Only the machine that detects hits sweeps, which is the server unless a project overrides **Should Detect Hits**. The trace component accepts sockets on any machine, so a socket that registered says nothing about whether this machine sweeps it.

</details>

<details>
<summary>A different set per combat role (Advanced)</summary>

**Weapon Action Set** and **Weapon Reaction Set** answer the same set for every [combat role](https://rigbak.com/docs/soulslike-combat/combat-roles). To vary them, override **Get Weapon Action Set for Role** or **Get Weapon Reaction Set for Role** on the weapon and branch on the incoming role tag. Return nothing for a role to leave that role on its AI Config set.

The equipment component asks again whenever the pawn's combat role changes, so a per-role answer stays current. **Refresh Weapon Sets for Role** does the same ask by hand, which a pawn driving its own equipment can call with an empty role to get the weapon's default answer.

**Weapon Defense Set** has no per-role form. **Get Weapon Defense Set** answers the same for every role, and what it returns composes with the pawn's own instead of replacing it.

</details>

<details>
<summary>A weapon that is not a SEC Weapon Base (Alternative)</summary>

A weapon can be a plain **Actor**. Each interface it adds in Class Settings earns it one more thing, and adding none still gets it attached and released with the rest of the pawn's equipment.

| Interface | What the weapon gains |
| --- | --- |
| none | Attaches at the socket the entry names, and is released on death and on teardown. |
| **SEC Equippable Interface** | Its own socket, offset, mesh, trace sockets and animation layer, and control of how it attaches. |
| **SEC Weapon Action Set Provider** | Gives the enemy its moveset while equipped. |
| **SEC Weapon Reaction Set Provider** | Gives the enemy its reactions while equipped. |
| **SEC Weapon Defense Set Provider** | Gives the enemy its parry, block or resistance while equipped, on top of the pawn's own. |

An actor implementing **SEC Equippable Interface** attaches itself, so call **Apply Standard Equip** from its **On Equipped** event for the ordinary behavior. A weapon that places its own pieces, a bow with a quiver for instance, skips that node and does the attaching itself.

Trace sockets register through that interface, so an actor that implements none of it contributes no sweeps.

The actor needs a root component. Attaching moves an actor's root, so one without a root is refused and logs why.

Tick **Replicates** in its Class Defaults as well. **SEC Weapon Base** sets that itself, and a plain Actor that leaves it off never reaches a client's hand.

</details>

<details>
<summary>Equipping without the component (Alternative)</summary>

Nothing requires the equipment component. The nodes under **SEC | Equip** in the Blueprint palette carry the same act, so a pawn can drive its own equipping instead.

**Equip Actor to Wielder** asks the weapon to equip itself, and **Set Equipped Weapon** on the equipment component points combat resolution at it. A pawn with no equipment component pushes the sets itself through **Set Provided Action Set** and **Set Provided Reaction Set** on its action and reaction set components, which sit above the AI Config and below a runtime override. Those slots read no weapon, so anything can drive them.

Apply `SEC.Weapon.Equipped` yourself on this path, since the component is what adds and removes it.

Call the nodes once per item, so a sword in one hand and a shield in the other are two calls. Branch on **Has Authority** first, since the nodes do what they are told wherever they run.

**Apply Standard Equip** is the ordinary act on its own: take ownership, make the weapon visible, attach it at the socket, and register the trace sockets it carries. It reports which sockets took, and **Apply Standard Unequip** needs that list back to remove exactly those.

</details>

---

## Related

| Page | Why |
| --- | --- |
| [Melee Trace](https://rigbak.com/docs/soulslike-combat/melee-trace) | The component the weapon's sockets register on, the montage window that opens them, and the damage config. |
| [Action System](https://rigbak.com/docs/soulslike-combat/action-system) | The moveset **Weapon Action Set** replaces, and how resolution ranks the weapon against the AI Config. |
| [Reaction System](https://rigbak.com/docs/soulslike-combat/reaction-system) | What **Weapon Reaction Set** gives the enemy to answer an incoming blow with. |
| [Defense System](https://rigbak.com/docs/soulslike-combat/defense-system) | **Weapon Defense Set**, and how a held item's guard composes with the pawn's own. |
| [Combat Roles](https://rigbak.com/docs/soulslike-combat/combat-roles) | The role tag a per-role weapon set branches on. |

Previous page: [Melee Trace](https://rigbak.com/docs/soulslike-combat/melee-trace). Next page: [Vitals](https://rigbak.com/docs/soulslike-combat/vitals)
