Skip to content
Back to wiki

Author a Melee Attack

A

Author

Author

Created: Oct 21, 2026Updated: Oct 21, 2026

Table of contents

Author a Melee Attack

This page builds the smallest melee hit: one attack definition, one Trace, a sweep during the open window, then UGCS_CombatFunctionLibrary writes the attack definition into the Effect Context and applies a Gameplay Effect. The target's Combat Flow collects that into an Attack Result.

Related pages: if the Flow still has no Result, start with Register the First Attack Result. The request model is in Attack Definitions and Requests; window behavior is in Traces and Hit Windows.

Prerequisites

  1. You attached UGCS_CombatSystemComponent and UGCS_TraceSystemComponent and implemented the combat-entity interface from Attach Combat Components. The target Flow already registers a Result from the attribute callback, as in Register the First Attack Result.
  2. The authority already called InitializeAbilitySystem.
  3. You have an instant Gameplay Effect that changes a target attribute. For local predicted feedback, add UGCS_GEComponent_PredictivelyExecute to that effect.
  4. Attacker and target collision channels can sweep each other.

1. Author the attack definition

Create a Data Table with row type GCS Attack Definition (FGCS_AttackDefinition). Fill one row:

  • AttackTags such as melee or light attack. Those tags become dynamic AssetTags on the Effect Spec.
  • TargetEffectClass: the instant GE from above. Add TargetEffectContainer when you need more effects; both apply independently when set.
  • Leave knockback, cues, and extensions empty for this page.

Save the Data Table row handle. UGCS_AttackRequest_Melee points at it later.

2. Author the Trace definition

Create another Data Table with row type FGCS_TraceDefinition:

  • TraceTag: the identifier the window uses to start this Trace.
  • CollisionShape: a static sphere or capsule large enough for the swing.
  • SweepSetting: the channel, object types, or profile must match the target collision. The default Visibility channel often misses a character capsule.

Put that TraceTag in the melee request's TracesToControl. StartTraces only starts tags listed in the container.

3. Fill the melee request

Create UGCS_AttackRequest_Melee, or embed it on the notify:

Field

This page

AttackDefinitionHandle

The attack-definition row from step 1

TracesToControl

The TraceTag from step 2

The request describes which row this window uses and which Traces to open. It is not a runtime executor.

4. Open the window with the Task

In the combat ability:

  1. Call HandleCollisionTraces to get UGCS_AbilityTask_CollisionTrace.
  2. At window start, AddMeleeRequest(Request, SourceObject). SourceObject can be the weapon or the pawn; it correlates the Trace handle.
  3. Bind OnTargetsFound. On a hit, use UGCS_CombatFunctionLibrary to write AttackDefinitionHandle into the Effect Context (Set Attack Definition Handle or AddAttackHandleToGameplayEffectSpec), then apply the GE to the target.
  4. Call RemoveMeleeRequest when the window ends. Destroying the Task also stops leftover Traces.

You can place GCS_ANS_AttackTrace on the montage and fill the same melee request. The notify only stores the request. The Collision Trace Task still has to read it and call AddMeleeRequest. An ANS without a Task never sweeps.

Expected result

While the window is open, the Debugger Trace section shows the handle as active. A sweep broadcasts OnTargetsFound. After you apply a GE with the attack handle, the target's Attack Result section shows the latest result.

Verify

  1. In PIE, open the Combat category of Gameplay Debugger: Shared already has the combat component; after one hit, Trace shows the handle and active state.
  2. Attack Result shows the latest result plus prediction and replication flags.
  3. Get Attack Definition Handle on the Effect Context returns the row from this page.
  4. Set LogGCS_Trace / LogGCS_Combat to Verbose to see sweeps and resolution.
  5. In multiplayer PIE, confirm the server produces a result before checking that LocalPredicted processors on the AutonomousProxy run only once.

Common failures

Symptom

Check first

Animation plays, no hit

Trace component present; ANS is only a data container and the Task never started; AddMeleeRequest ran inside the window

Task warns No any trace started

TracesToControl matches the Trace table TraceTag; SourceObject is valid

Sweep hits nothing

SweepSetting channel or object types match the target; shape radius is large enough

Effect has no attack context

CombatFunctionLibrary wrote the handle; Globals class is GGA

Window never opens

RemoveMeleeRequest ran too early, or the ability ended before the notify began

Next

After the melee loop works, continue with Author a Ranged Attack, or put this hit in a combo table with Configure Combo and Weapon. Failures: Debugging and Troubleshooting.