# Character Setup

> Make a character of your own fight without changing its parent class: the components to add, the settings they need, the ready signal and the interface that answers hits.

Markdown version of https://rigbak.com/docs/universal-player-combat/character-setup, a page of the Universal Player Combat documentation. Link that page when citing it.

The quick start uses the demo's fists, made for the demo mannequin's skeleton and its `hand_r` and `hand_l` bones. On another skeleton, make your own punch montages and give each hand a hit volume as [Build Your First Combo](https://rigbak.com/docs/universal-player-combat/first-combo) does for the sword. For a right hand bone named `RightHand`, add a **Trace Sockets** row to the fists item's **Equippable** fragment, and put a **UPC Melee Trace Window** naming the same **ID** on the punch montage:

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

| Property | Value |
| --- | --- |
| ID | FistR (replaces None) |
| Socket or Bone Name | RightHand (replaces TraceStart) |

*An empty Source Component Tag traces the body mesh. The punch's trace window lists FistR under Socket IDs.*

Make the fists item by duplicating `Item_UPC_Unarmed`, point its **Equippable** **Action Graph** at a graph whose montages fit your skeleton, and set it as the Equipment Manager's **Default Item**. Set the Equipment Manager's **Body Places** to your hand bones too (defaults `hand_r` and `hand_l`; [Equipment](https://rigbak.com/docs/universal-player-combat/equipment)). A character free to change its parent can [reparent to UPC Character Base](https://rigbak.com/docs/universal-player-combat/character-setup#use-the-character-base-instead) instead.

## Set it up (10 minutes)

1. **Add ten components**

   Press **Add** in your Character Blueprint's Components panel.

   Components panel of **BP_MyCharacter**:

   - Capsule Component (inherited)

     - Mesh (inherited)
   - Ability System (add)
   - UPC Action Graph (add)
   - UPC Input Mapping (add)
   - UPC Inventory (add)
   - UPC Equipment Manager (add)
   - UPC Melee Trace (add)
   - UPC Anim Manager (add)
   - UPC Vitals (add)
   - UPC Defense (add)
   - UPC Team (add)

   *Names as the Add list shows them.*
2. **Fill in four settings**

   - **UPC Vitals**: add a **Vitals** row with **Vital Tag** `UPC.Vital.Health` and **Max Value** `100`. A Vitals component added by hand has none.
   - **UPC Team**: **Team Id** `0`, the demo player's side. A new Team component starts on 1, the demo enemies' side.
   - **UPC Equipment Manager**: **Default Item** `Item_UPC_Unarmed`, the demo's fists, which give the moves when nothing else is in hand (on another skeleton, your fists item).
   - **Mesh**: the **Component Tags** `UPC.Montage`, where montages play, and `UPC.Attachment.Body`, where items hang. With no `UPC.Attachment` tag, items spawn unattached.
3. **Send the ready signal**

   Call **Notify Ability System Ready** from **Event BeginPlay** and **Event Receive Controller Changed**. It grants the abilities that need no key: hit confirmation, draws and put-aways, the paired role and the interactor's payload ability. Abilities a key starts (lock-on, interact, sprint) come from an ability set ([below](https://rigbak.com/docs/universal-player-combat/character-setup#what-each-component-does)). Begin Play covers the ability system; the controller call covers the Default Item, which adds its keys once a player controller holds the character.

   Blueprint graph, nodes in reading order:

   - **Comment box: BP_MyCharacter · Event Graph**

     - **Event BeginPlay** (event)
     - **Notify Ability System Ready** (function); inputs: Avatar = self, Ability System
     - **Event Receive Controller Changed** (event); outputs: Old Controller, New Controller
     - **Notify Ability System Ready** (function); inputs: Avatar = self, Ability System
4. **Answer incoming hits**

   In **Class Settings**, add the **UPC Damageable** interface. Its **Handle Incoming Damage** returns **Resolve Defense and Apply Damage**, with the **UPC Defense** component as **Defense** and **Health Vital Tag** `UPC.Vital.Health`.

   Blueprint graph, nodes in reading order:

   - **Comment box: BP_MyCharacter · UPC Damageable interface**

     - **Handle Incoming Damage** (event); outputs: Damage Info
     - **UPCDefense** (variable)
     - **Resolve Defense and Apply Damage** (function; Target is UPC Defense Statics); inputs: Defense, Damage Info, Health Vital Tag = UPC.Vital.Health; outputs: Return Value
     - **Return Node** (function); inputs: Return Value
5. **Check the Animation Blueprint**

   Your Animation Blueprint needs a **Slot** node for `DefaultSlot`, where the punches play, then **UPC Hit Stop** and **Inertialization** after it, or the log warns once ([The Animation Blueprint](https://rigbak.com/docs/universal-player-combat/character-setup#the-animation-blueprint) lists the rest).
6. **Press Play and punch**

   Make your character your game mode's **Default Pawn Class**, point a copy of `LVL_UPC_Demo`'s **GameMode Override** at that game mode, and press Play. Punch a training dummy with the left mouse button.

---

## What each component does

| Component | Does |
| --- | --- |
| **Ability System** | Plays each move as a gameplay ability. |
| [**UPC Action Graph**](https://rigbak.com/docs/universal-player-combat/action-graph) | Picks the next move: the current node, its action window, a press waiting to chain. |
| [**UPC Input Mapping**](https://rigbak.com/docs/universal-player-combat/input) | Turns keys into input tags for the graph. Drawn items add their keys here. |
| [**UPC Inventory**](https://rigbak.com/docs/universal-player-combat/inventory) | What the character owns, starting with its **Starting Items**. |
| [**UPC Equipment Manager**](https://rigbak.com/docs/universal-player-combat/equipment) | Draws and puts away items, hands the character the drawn item's graph and keys, and falls back to the **Default Item**. |
| [**UPC Melee Trace**](https://rigbak.com/docs/universal-player-combat/melee-trace) | Sweeps drawn items' hit volumes during trace windows, passing over teammates. |
| [**UPC Anim Manager**](https://rigbak.com/docs/universal-player-combat/animation-integration) | Names the mesh items hang on, links item animation layers, mirrors montages to extra meshes, holds the pose on hits. |
| [**UPC Vitals**](https://rigbak.com/docs/universal-player-combat/vitals) | Health, and any pool you add, such as stamina. |
| [**UPC Defense**](https://rigbak.com/docs/universal-player-combat/defense) | Parries, blocks, invulnerability. Empty, it lets each hit land in full until a drawn item lends it rules. |
| [**UPC Team**](https://rigbak.com/docs/universal-player-combat/targeting#leave-teammates-out) | The character's side. |

### Add more for more features

| Feature | Add |
| --- | --- |
| [Attacks that turn and close the gap](https://rigbak.com/docs/universal-player-combat/attack-steering) | **UPC Targeting** with a **Targeting Config**, **UPC Attack Approach**, **Motion Warping** |
| [Lock on](https://rigbak.com/docs/universal-player-combat/targeting) | Those three, and a lock press (below) |
| [Be locked onto](https://rigbak.com/docs/universal-player-combat/targeting) | **UPC Targetable** |
| [A combat style for rotation, targeting and camera](https://rigbak.com/docs/universal-player-combat/combat-styles) | **UPC Combat** with a **Combat Style** |
| [Doors, chests and pickups](https://rigbak.com/docs/universal-player-combat/interaction) | **UPC Interactor**, and an interact press (below) |
| [Sprint on a held button](https://rigbak.com/docs/universal-player-combat/sprint-and-speed) | **UPC Sprint**, and its ability (below) |
| [Put-away items shown on the body](https://rigbak.com/docs/universal-player-combat/equipment#show-carried-items-on-the-body) | **UPC Stow Visual** |
| [Flinching bones, a ragdoll on death](https://rigbak.com/docs/universal-player-combat/physical-reactions) | **UPC Physical Reaction** |
| [Warnings over an enemy's swing](https://rigbak.com/docs/universal-player-combat/telegraphs) | **UPC Telegraph Viewer** |
| [Footsteps and effects from animation](https://rigbak.com/docs/universal-player-combat/animation-integration) | **UPC Anim Effects** with an **Anim Effect Bank** |

**UPC Character Base** creates every component on this page but Motion Warping, UPC Sprint, UPC Stow Visual, UPC Physical Reaction and UPC Telegraph Viewer.

**Lock-on, interact and sprint are abilities on a key**, separate from the ready signal's. UPC Character Base grants them from its **Starting Ability Set**; your Blueprint has no such slot, so an item grants them instead: on the Default Item they work bare-handed, on a sword only while it is drawn. For lock-on:

1. Create a **UPC Ability Set** (right-click in the Content Browser, **UPC**, **Actions**, **Ability Set**). Add a **Granted Gameplay Abilities** row: **Ability** `UPC Lock On Ability`, **Input Tag** `UPC.Input.LockOn`, **Input Action** `IA_UPC_LockOn`.
2. Add the set to **Ability Sets to Grant** on the **Equippable** fragment of each such item. For the demo fists, duplicate `Item_UPC_Unarmed` and make the copy the Default Item.
3. Give `IA_UPC_LockOn` a key: `IMC_UPC_Default`, which `BP_UPC_PlayerController` adds, maps it to the middle mouse button. With a controller of your own, map it in a context that controller adds.

Interaction and sprint take a row each in the same set: `UPC Interact Ability` on `UPC.Input.Interact` and `IA_UPC_Interact`, `UPC Sprint Ability` on `UPC.Input.Sprint` and `IA_UPC_Sprint`.

---

## Draw items from a belt

1. Add [**UPC Quick Bar**](https://rigbak.com/docs/universal-player-combat/quick-bar) to your player controller, or use **UPC Player Controller**, which carries one.
2. On your own controller, bind **On Possessed Pawn Changed** and call the Quick Bar's **Initialize for Pawn** with a valid **New Pawn**, on the server and the player's machine alike.
3. Tick **Auto Populate from Inventory** and list items in the inventory's **Starting Items**: each takes the first free slot, and the first that fits comes to hand.

A character with no belt, such as an AI, draws on the server with **Equip Item** or **Draw With Reach**.

---

## The Animation Blueprint

- **A Slot node** for each slot the montages use: `DefaultSlot` unless you pick another. The demo's montages also use `UpperBody` for draws, parries and pickups.
- **UPC Hit Stop** after the slot, then **Inertialization**: freezes the pose briefly on a hit.
- Optional **Linked Anim Layer** nodes take a drawn item's animation layer (its own walk, say); without them the layer is ignored. The demo's layers fit `ABP_UPC_MannequinBase` or a child.

<details>
<summary>What only the character base does (Advanced)</summary>

| The base | On your character |
| --- | --- |
| Moves with **UPC Character Movement**: smoother corrections under lag, and a **Grace Tag** that keeps the server from pulling a dashing player back | C++, since a Blueprint cannot change the movement component's class; every feature works on the engine's Character Movement |
| A **Health** row on its Vitals | Step 2 |
| Draws its starting items, unless a belt that takes new items does | **Equip Item** for each, on the server, from Begin Play |
| **Ignore Camera Collision**: the camera's spring arm passes through characters | The Camera channel on **Ignore** on the capsule and mesh |
| No character can stand on its head | The capsule's **Walkable Slope Override**, **Walkable Slope Behavior** **Unwalkable** |

</details>

---

## Debug it

```
UPC.Debug.Actions 1      // Each character's node, window and waiting press
UPC.Debug.Anim 1         // The meshes found, and which plays montages
```

<details>
<summary>Leaving a component out (Advanced)</summary>

- **Ability System:** no move runs, and setting a graph warns.
- **UPC Input Mapping:** no key reaches a move unless your input calls the graph's **Process Action Input**.
- **UPC Melee Trace:** no hits; an item with hit volumes warns as it is drawn.
- **UPC Anim Manager:** montages play, but items do not attach, and item layers and hit stop do not run.
- **UPC Team:** teamless; enemies still target it, and teammates' swings still hit it.
- **Motion Warping:** an attack with a warp window plays its own motion and steers nothing; the log warns once per class.

</details>

<details>
<summary>Use the character base instead (Alternative)</summary>

**File**, **Reparent Blueprint**, **UPC Character Base**, then delete the components your Blueprint added that the base creates, a UPC Team among them. Set **Team Id** on the base's **Team Component**, which starts on no team (255), tag the mesh and set the Default Item. The demo player, `BP_UPC_Character`, is built this way.

</details>

<details>
<summary>Multiplayer</summary>

- **The ability system stays on the character**; a Blueprint cannot put it on the PlayerState. Added in Blueprint, it replicates in **Full** mode, which suits players and AI.
- **The ready signal is safe on every machine**: only the server grants abilities.
- **Without the ready signal**, a client player's hits do not reach the server, and that client logs it.
- **A graph set with Set Action Graph** goes on every machine: it does not replicate, and the owning player predicts with it.

</details>

<details>
<summary>C++</summary>

- A C++ pawn may host its ability system on the PlayerState, as `AUPCCharacterBase` does. It calls `InitAbilityActorInfo(Owner, this)` on possession and when the PlayerState arrives, `RefreshAbilityActorInfo()` from `NotifyControllerChanged` (a client can receive the PlayerState first), and `UUPCAbilitySystemReady::NotifyAbilitySystemReady(this, AbilitySystem)` after each.
- `IUPCDamageable::HandleIncomingDamage_Implementation` makes one call, `UUPCDefenseStatics::ResolveAndApplyIncomingDamage(Defense, DamageInfo, HealthVitalTag)`.
- `UUPCAbilitySet::GiveToAbilitySystem` and `RegisterInputMappings` grant an ability set and its keys. `UUPCInputMappingComponent::BindInputs`, from `SetupPlayerInputComponent`, binds the component's own Input Mappings.
- `SetDefaultSubobjectClass<UUPCCharacterMovementComponent>(ACharacter::CharacterMovementComponentName)` gives a character UPC Character Movement. A C++ child of the base passes its own movement class to the protected constructor `AUPCCharacterBase(const FObjectInitializer&, TSubclassOf<UCharacterMovementComponent>)`.
- A movement component of your own takes UPC Character Movement's fixes by copying from `UUPCCharacterMovementComponent`:

  - `FUPCSavedMove` (`Clear`, `SetMoveFor`, `CanCombineWith`, `PrepMoveFor`, `PostUpdate`, `GetCompressedFlags`), its casts pointed at your component; unchanged, it treats every run as predicted. The prediction data's `AllocateNewMove`.
  - `AddReferencedObjects`, `GetPredictionData_Client`, `ClientUpdatePositionAfterServerUpdate`, `ClientHandleMoveResponse`, `UpdateFromCompressedFlags`, `MoveAutonomous`, `SimulatedTick`, `TickCharacterPose`, and `ServerCheckClientError`, `ServerShouldUseAuthoritativePosition` and `ServerMoveHandleClientError` as the overloads taking `FMovementBaseInterfaceData*` from UE 5.8, `UPrimitiveComponent*` before.
  - `FUPCMoveResponseData` with its `CorrectedMove` fields and two overrides, set in the constructor with `SetMoveResponseDataContainer` and returned by `GetUPCMoveResponseData`.
  - Every member those bodies use, among them `FUPCMovementSettings` with its `static_assert`, and the file-local `FindStraightGlideTarget` and `HoldToLine`.

</details>

<details>
<summary>Troubleshooting (Advanced)</summary>

**The character does nothing when the key is pressed**

- **No Default Item, or one with no Action Graph:** `UPC.Debug.Actions 1` shows no graph.
- **No key reached it:** the Default Item adds its keys once a player controller holds the character, so check the controller-changed call.
- **No montage plays:** the Animation Blueprint lacks the montage's Slot, or the montage is for another skeleton.
- **The press is refused:** the character carries a **Global Block Tags** tag of the UPC Action Graph, `UPC.State.ActionsBlocked` by default.

</details>

---

Previous page: [Build Your First Combo](https://rigbak.com/docs/universal-player-combat/first-combo). Next page: [AI Agent Guide](https://rigbak.com/docs/universal-player-combat/agents)
