Skip to main content

Triggers

Triggers define when a skill activates. They are always prefixed with ~ and come at the end of a skill line.

Syntax

action{params} @target{params} ~trigger{params}

A skill line always ends with at least one trigger. Multiple triggers can be combined on a single line.

Quick Example

Skills:
- animation{name=idle, mode=loop} ~idle
- animation{name=walk, mode=loop} ~moving
- animation{name=hurt} ~onHurt
- animation{name=death} ~onDeath

All Triggers

Lifecycle

Triggers that fire during entity lifecycle events.

TriggerDescription
~onSpawnFires once when the entity spawns into the world
~onDeathFires once when the entity dies
~onLoadFires when an entity is loaded from save data
~onDespawnFires when an entity is removed (not death)

Combat

Triggers related to combat actions and state.

TriggerDescription
~onHurtFires when the entity takes damage
~onAttackFires when the entity hits a target with a melee attack
~onKillFires when the entity kills another entity
~onEnterCombatFires when the entity first enters combat
~onDropCombatFires when the entity leaves combat (10s no damage)
~onTargetChangeFires when the entity changes its attack target
~onShootFires when the entity performs a ranged attack
~onExplodeFires just before a creeper-like entity explodes

Utility

General purpose triggers for timers, interaction, and signals.

TriggerDescription
~onTimerFires repeatedly at a specified interval
~onInteractFires when a player right-clicks the entity
~onSignalFires when the entity receives a signal

State

Continuous triggers that fire while a condition is true.

TriggerDescription
~idleFires while the entity is not moving
~movingFires while the entity is moving
~healthFires based on health percentage thresholds

Pet

Triggers for tameable entities. Require the Taming module.

TriggerDescription
~tamedFires while the entity is tamed
~untamedFires while the entity is not tamed
~sittingFires while the entity is ordered to sit

Common Parameters

Most triggers support these common parameters:

ParameterTypeDescription
oncebooleanOnly trigger once per entity lifetime

Some triggers have additional parameters documented on their individual pages.

Combining Triggers

You can combine state triggers on a single line:

Skills:
# Different idle animations based on tame status
- animation{name=happy_idle, mode=loop} ~idle ~tamed
- animation{name=wary_idle, mode=loop} ~idle ~untamed

# Different movement at low health
- animation{name=limp, mode=loop} ~moving ~health{below=25}
- animation{name=walk, mode=loop} ~moving

Skill Order

Skills are evaluated in order. For state triggers, the first matching skill wins:

Skills:
# More specific conditions first
- animation{name=sprint, mode=loop} ~moving{speed=0.5}
- animation{name=run, mode=loop} ~moving{speed=0.3}
- animation{name=walk, mode=loop} ~moving
- animation{name=idle, mode=loop} ~idle