Skip to main content

~onAttack

Fires when the entity successfully hits a target with a melee attack.

Parameters

ParameterDefaultDescription
min0Minimum damage dealt to trigger
maxinfiniteMaximum damage dealt to trigger
oncefalseOnly trigger once per entity lifetime

Context Variables

  • @Target - The entity that was attacked
  • Damage amount available in context

Examples

Skills:
- animation{name=attack_heavy} ~onAttack
- damage{amount=5, type=fire} @Target ~onAttack

Common Patterns

Attack Animation

Skills:
- animation{name=swing} ~onAttack

Lifesteal Effect

Skills:
- animation{name=lifesteal} ~onAttack{min=5}

Heavy Hit Effect

Only trigger on hits dealing 10+ damage:

Skills:
- animation{name=heavy_hit} ~onAttack{min=10}
- damage{amount=3, type=fire} @Target ~onAttack{min=10}

Boss Attack Pattern

Skills:
- animation{name=slash} ~onAttack
- showbone{bone=attack_particles} ~onAttack