Skip to content

Native Script System

EmakiSkills includes a native script system in addition to MythicMobs casting. Native scripts define effects directly in skill configuration and do not require external plugins.

Global script engine configuration

yaml
script_engine:
  enabled: true
  default_mode: "native"
  stop_on_failure: true
  max_lines_per_phase: 64
  max_targets_per_action: 16
  debug: false
FieldDescription
enabledWhether native skill scripts are enabled.
default_modeDefault mode when a skill does not declare one.
stop_on_failureWhether later actions stop after a failed action.
max_lines_per_phaseMaximum action lines in one phase.
max_targets_per_actionMaximum targets one action may process.
debugWhether script debug output is enabled.

Script modes

ModeAliasDescription
nativeRun only built-in script actions.
mythicmythicmobsRun only the MythicMobs skill from mythic_skill.
hybridbothRun both native script and MythicMobs skill.

An unrecognized mode falls back to script_engine.default_mode.

Phases

PhaseWhen it runs
castWhen the skill is cast.
hitWhen the skill hits a target.
missWhen the skill misses.
failWhen casting fails.

Phase keys accept only the names above; prefixed forms such as on_cast are not supported.

The script block also accepts an enabled field. When it is not set explicitly, the script counts as enabled if any phase exists under actions.

Example

yaml
id: flame_strike
trigger_type: active
display_name: '<red>Flame Strike'
script:
  mode: native
  stop_on_failure: true
  actions:
    cast:
      - 'sound sound=ENTITY_BLAZE_SHOOT volume=1 pitch=1.5'
      - 'particle particle=FLAME at=target count=20 speed=0.1'
      - 'damage amount=%fire_damage% damage_type=spell'
    hit:
      - 'ignite ticks=60'
      - 'message text="<red>Burning!"'
    fail:
      - 'message text="<gray>Skill failed."'

Context variables

Common variables include %level%, %skill_id%, %trigger_id%, %has_target%, %target_name%, %target_uuid%, %target_world%, %target_x%, %target_y%, and %target_z%.

Built-in actions

ActionPurpose
damageDeal damage to a target.
healHeal a target.
igniteSet a target on fire.
messageSend MiniMessage text.
soundPlay a sound.
particleSpawn particles.
rayRay trace and store the result in shared state.
aoe_damageDeal damage to entities in an area.
projectileLaunch a custom projectile with tick-by-tick simulation.
mythicCast a MythicMobs skill.

aoe_damage

Deal damage to entities in an area. Writes aoe_hit_count to shared state.

ParameterRequiredDefaultDescription
amountYesDamage amount.
radiusNo5Area radius in blocks.
centerNotargetCenter point: caster, target, or look.
shapeNosphereArea shape: sphere or cylinder.
filterNohostileTarget filter: hostile (excludes players) or all.
max_targetsNo20Maximum hit count.
exclude_casterNotrueWhether to exclude the caster.

projectile

Launch a custom projectile with tick-by-tick simulation. Sets the context target entity on hit.

ParameterRequiredDefaultDescription
speedNo1.5Blocks per tick.
gravityNo0.05Gravity per tick.
lifetimeNo60Max lifetime in ticks.
hit_radiusNo0.5Hit detection radius.
pierceNo0Number of entities to pierce through.
homingNofalseEnable homing toward target.
homing_strengthNo0.1Homing turn strength.
particleNoFLAMETrail particle type.
damageNo0Damage on hit (0 = no damage).
directionNolookInitial direction: look or target.

Actions can use modifiers:

yaml
actions:
  - '@if="%has_target% == 1" damage amount=20'
  - '@chance=30% ignite ticks=100'
  - '@delay=20 message text="<gray>Fires one second later."'
PrefixDescription
@if='%expr%'Run only when the expression is true. An invalid expression fails the line.
@chance=%n%%Run with the given probability. A miss marks the line as skipped.
@delay=<time>Delay the line by the given time. Accepts ms, s, and t suffixes; a bare number is parsed as ticks.

Modifiers are evaluated in the order @if@chance@delay, so a line that fails the condition or the chance roll is skipped without waiting for the delay.

Skill variables

variables define runtime values that can be referenced by action lines, conditions, and text with %variable% syntax:

yaml
variables:
  fire_damage:
    type: expression
    value: "10 + %level% * 5"
  is_enhanced:
    type: boolean
    value: "%level% >= 5"