Weapons and melee

The Combat plugin's hitscan, projectile and beam weapons defined in .weapon assets, melee combos with block and parry, surface-aware impacts and pickups.

Last updated Oct 26, 2026Edit this pageVersion 1.0.0

Weapons and melee come with the Combat, Interaction & RPG plugin. It is off by default; enable it for your project in the Plugins window. The plugin also provides interaction, inventory, crafting, zones, the utility grid and RPG progression; see Interaction and inventory and Zones and utility grids. The Shooter template is built on it. Engine/Plugins/Combat/Combat.mplugin

Weapon assets

Everything a gun is lives in a .weapon asset.

BlockFields
Rootfire_mode (Hitscan, Projectile, Beam, Custom), trigger_mode (Semi, Auto, Burst), burst_count, burst_interval, damage, damage_type, fire_rate, range, penetration, world_mesh
Spreadbase, bloom_per_shot, max, recovery in degrees, and an optional fixed Offset pattern
RecoilKick entries (pitch and yaw) and a recovery rate
Projectilespeed, gravity_scale, lifetime, radius, bounce_count, restitution, explode_on_impact and explosion radii and minimum damage
Ammoclip_size, reserve, reload_time, optional ammo_item taken from the inventory
EffectsMuzzle flash, tracer, impact_table and impact_tag, fire, reload and empty sounds, reload_montage
Noisereport and loudness for AI hearing; raise_situation with radius and severity raises a Gunshot situation
Crosshairbase_size, spread_scale for the HUD

Beam traces every tick while held and deals no damage unless you set damage; use it for scanners and lasers. Custom fires events and effects without a built-in trace.

Use a weapon

A pawn carries a Weapon component. The weapon system runs an idle, firing, reloading and empty state machine.

Function on MWeaponStaticsEffect
EquipWeapon(path), UnequipWeapon()Equip a .weapon
StartFire(), StopFire()Trigger press and release; semi fires once, auto repeats, burst queues
Reload()Refill from the reserve or from the inventory
GetClip(), GetReserve(), GetSpread(), IsWeaponEquipped()Read state
SetWeaponEnabled(bool)Disable firing
  • Hitscan traces through the spread cone, penetrates up to penetration bodies, and applies point damage through the damage pipeline with the pawn as instigator.
  • Projectile spawns a swept projectile with gravity, bounces and lifetime, dealing point or radial damage on impact.
  • Recoil kicks the pawn's camera and recovers toward the original aim; spread blooms per shot and recovers while the trigger is up.
  • Firing reports a noise to AI hearing and can raise a Gunshot situation.

In multiplayer, clients ask the server to fire; the server checks the fire rate (weapon.ServerRateSlack) and the clip, rewinds other players to where the shooter saw them for a hitscan, and plays the effects on every client. See Multiplayer.

The HUD can bind to weapon.equipped, weapon.clip, weapon.reserve, weapon.ammotext, weapon.spread, weapon.crosshair, weapon.state and weapon.reloading.

Impacts

An impact table (.impact) maps each surface type to a decal, a particle effect, a sound and optional camera shake, with a Default entry as fallback. FImpactEffects::SpawnImpact(surface, position, normal, tag) spawns one; the project's default table is Content/Impacts/Default.impact. From Visual Scripting use MImpactStatics::SpawnImpactAtHit. Runtime decals come from a fixed pool and expire on their own. FImpactEffects MImpactStatics

Melee

A MeleeWeapon component makes a pawn fight up close. Hits go through the same damage pipeline as guns.

FieldMeaning
damage, damageTypeTag, impactTagBase damage per swing, its damage type and impact effects
attackMontageMontage played per swing
comboLength, comboWindow, heavyMultiplierA chain of swings; the last does extra damage
swingArcDegrees, range, attackRateThe sweep in front of the attacker and the swing rate
staminaCostPaid from the Stamina attribute when the pawn has one
knockbackImpulsePushes physics bodies
blockDamageScale, parryWindow, staggerDurationBlocking takes reduced damage; a block raised just in time parries and staggers the attacker

Each swing has a windup, an active window and a recovery. During the active window the arc is swept every tick, and each target is hit at most once per swing. FMeleeSystem::RequestAttack(pawn) buffers the next combo step and SetBlocking(pawn, bool) raises a block. AI uses the MeleeAttack native behavior-tree task.

Pickups and targets

ActorDoes
AWeaponActorInteract to equip its .weapon
AMeleeWeaponActorInteract to equip a melee weapon with the actor's stats
AAmmoPickupActorInteract for reserve ammo or ammo items
ATargetDummyActorA target with health that falls over and respawns

Engine sources

This page describes behavior implemented in these files of the engine repository, checked against commit 5922e6e5e.

  • Engine/Plugins/Combat/Combat.mplugin
  • Engine/Source/Runtime/Game/Public/Gameplay/ImpactEffects.h
  • Engine/Source/Runtime/Game/Public/Game/MImpactStatics.h

Page feedback

Was this page helpful?