When Weapon Hits
Fires when a swing actually connects with a target.
Introduction
When Weapon Hits is an event in the Melee Weapon group of World Events. It fires when a swing actually connects with a target. Like every event, it does nothing by itself. It waits for the right moment, then runs all the actions connected to it. Use it for the moment of impact: spark bursts, hit stop, damage numbers, or a satisfying clang. This event belongs to the Melee Weapon component. Open the Melee Weapon component guide to see everything the component itself can do. Melee contact is personal: after When Melee Used reports the swing, this event confirms the hit, and When Melee Critical Hit elevates the best ones. The damage lands in the health family via When Health Decreases , and knockback plus hit effects are configured in the Melee Weapon guide. When Weapon Hits event in the Uni editor Image The When Weapon Hits event in the Script Editor.
Parameters
Object the object the swing connected with Parameter Description
How to Access
How to Access - Event When Weapon Hits
How to Use
Select the weapon in the right panel , then click its Propertie (the blue equalizer icon) and scroll to the bottom of the properties panel — the When Weapon Hits event is already listed there. Press the + button below the event to add a script, then press Edit on that script to open the script editor and build the actions that should run when the event fires. Press Play and hit a target with the melee weapon, then check that the actions run.
Example
When weapon hits: Set Self Melee Weapon.Crit Multiplier Add 0.01 when-melee-hit-example.png Bumps the weapon's crit multiplier by 0.01 with every landed hit. caption
Common Uses
Impact sparks and hit sounds Hit-stop or screen shake on contact Combo counters that only count real hits
Tip
The Objects parameter lists everything the swing touched. Loop over it when each struck target needs its own reaction.