Register a Weapon and Land a Melee Hit
Give the player a sword that hits a practice target only during the swing. Start with two combatants and a swing montage that plays on the character.
Register the sword
Create a Blueprint based on
NinjaCombatWeaponActor. Give it a mesh and add a socket namedsScannear the middle of the blade. Return this mesh fromGetMeleeMesh. Give the weapon an identifying gameplay tag such asCombat.Weapon.Sword.Add
NinjaCombatWeaponManagerComponentto the character and return it fromGetWeaponManagerComponent. Add the sword Blueprint to Default Weapon Classes. In Weapon Socket Mapping, map that class to a hand socket that exists on the character mesh.
Time the hit to the swing
On the swing montage, add a Melee Scan notify state covering the contact frames. In the notify's Request Data, select Weapon as the source and give Weapon Query a rule matching the sword tag. Select Box Sweep, enter
sScanas the scan socket, and size the box to cover the blade. Use the combat trace channel from your collision setup.Create an ability based on
CombatAbility_MeleeAttack. Keep the melee attack trigger on Gameplay Event, assign the swing montage, and set its melee damage effect to a child ofCombatEffect_MeleeHit. Give the attacker positive Base Damage.Grant the ability to the player. For a first test, call Try Activate Ability by Class on the player's Ability System Component from a button press. Enable debug on the attack ability so you can see the sweep.

Use the Same Move for an Unarmed Strike
For a punch, implement ICombatMeleeInterface on the character and return its mesh from GetMeleeMesh. Select Owner on the notify and use a sphere sweep at a hand socket. If the character already has a dedicated hit shape, return it from GetMeleeOverlap and select the overlap scan mode.
For a weapon with its own hit effect, implement GetHitEffectClass on the melee source. To react after an effect was applied, override HandleMeleeGameplayEffectApplied on the ability in Blueprint or HandleMeleeGameplayEffectApplied_Implementation in C++. The hit result identifies the target and contact point.
Try It in Play
Swing once in range and check that the target loses health during the scan. Swing again just out of reach. The montage should still play and the target should keep its health. If the box appears at the wrong location, inspect the socket on the mesh returned by the melee source.