Skip to content

Skill Triggers

The skills section in a mob definition binds lifecycle trigger events to CoreLib action pipelines. Requires EmakiSkills to be installed.

Trigger list

TriggerWhen it firesKey context variables
on_spawnMob spawned (fired immediately in MobFactory)self
on_deathMob diesself, killer (may be null)
on_targetMob acquires a new targetself, target
on_damage_giveMob deals damage to its targetself, target, damage
on_damage_takeMob receives damageself, attacker (may be null), damage
on_killMob kills an entityself, victim
on_shootMob fires a projectileself
on_explodeMob explodes (e.g. Creeper)self
on_teleportMob teleportsself
on_transformMob transforms (e.g. zombie → drowned)self

Action string format

Each trigger maps to a list of CoreLib action pipeline strings:

[selector |] action_name [key=value ...]

Common selectors

SelectorDescription
selfThe mob that fired the event
targetThe target entity for this event
killerPlayer who killed the mob (on_death)
victimEntity killed by this mob (on_kill)
attackerEntity that damaged this mob (on_damage_take)
nearby radius=<n> type=playerAll players within radius blocks

Action examples

yaml
skills:
  on_spawn:
    # Send a message to all players within 20 blocks
    - "nearby radius=20 type=player | send_message text='<red>Elite Zombie has arrived!'"
    # Spawn particles at the mob's location
    - "self | spawn_particle particle=FLAME count=30 offset_x=0 offset_y=1 offset_z=0"

  on_death:
    # Give experience to the killer
    - "killer | give_exp amount=80"
    # Broadcast defeat message to nearby players
    - "nearby radius=50 type=player | send_message text='<green>Elite Zombie defeated!'"

  on_damage_give:
    # Apply slowness to the target
    - "target | give_potion_effect type=SLOWNESS level=1 duration=3s"

  on_damage_take:
    # Spawn flame particles when hurt
    - "self | spawn_particle particle=FLAME count=10 offset_x=0 offset_y=1 offset_z=0"

  on_target:
    # Play a sound when acquiring a target
    - "self | play_sound sound=minecraft:entity.skeleton.ambient volume=1.0 pitch=0.7"

NOTE

The full list of available actions and their parameter syntax is provided by EmakiCoreLib. Refer to the CoreLib documentation for all supported actions.