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:
      - 'self | play_sound sound=ENTITY_BLAZE_SHOOT volume=1 pitch=1.5'
      - 'trigger | spawn_particle particle=FLAME count=20'
      - 'trigger | damage amount=%fire_damage%'
    hit:
      - 'trigger | ignite duration=3s'
      - 'self | send_message text="<red>Burning!"'
    fail:
      - 'self | send_message text="<gray>Skill failed."'

Context variables

Script execution injects %level%, %skill_id%, %trigger_id% and %has_target% (0 or 1), plus five synonyms for MythicMobs to read: %emaki_skill_id%, %emaki_skill_level%, %emaki_trigger_id%, %emaki_is_passive% and %emaki_has_target%.

Expressions inside a variables block may additionally reference %max_level%, %is_passive%, %player_level%, %player_health%, %player_max_health% and %sneaking%. These take part in variable evaluation only; they are not injected as script-line placeholders.

Script actions

Script lines are compiled and executed by CoreLib's action engine, so the available action stages are exactly those in the CoreLib registry plus the skill stages EmakiSkills registers. EmakiSkills has no separate private action IDs.

  • The full list of CoreLib's own stages and their parameters is in CoreLib Actions.
  • The stages EmakiSkills adds (cast_skill, cast_mythic_skill, level/slot/cooldown/unlock) are in CoreLib Actions.

Use the registered stage IDs

A stage ID must match its registered name exactly. A line with a wrong ID is dropped at compile time and recorded as a diagnostic; it does not fail at runtime. Common mistakes:

WrongCorrect
messagesend_message
soundplay_sound
particlespawn_particle
mythiccast_mythic_skill

ray and aoe_damage are not registered stages and have no equivalent.

Targets are not selected through an action parameter but with the pipeline's source | stage syntax. Sources commonly used in skill scripts are self, trigger (the entity named by the trigger context), looking_at, nearby, nearby_players, and player_by_name.

ActionPurposeParameters
damageDeal damage to a target.amount (required)
healHeal a target.amount (required)
igniteSet a target on fire.duration (default 5s)
send_messageSend MiniMessage text.text (required)
play_soundPlay a sound.sound (required), volume, pitch
spawn_particleSpawn particles.particle (required), count, offset_x, offset_y, offset_z, extra
projectileLaunch a custom projectile with tick-by-tick simulation.See below

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.

Conditions, chance, and delay

Conditions, chance rolls, and delays are gate stages placed between pipes, not line-leading @ prefixes:

yaml
actions:
  cast:
    - 'trigger | where %has_target%==1 | damage amount=20'
    - 'trigger | chance 30% | ignite duration=5s'
    - 'self | after 20t | send_message text="<gray>Fires one second later."'
GateDescription
where <condition>Clears the target stream when the condition is false, so later stages do not run.
chance <n>%Passes with the given probability.
after <time>Delays the following stages. Accepts ms, s, and t suffixes.

The @ prefix form is obsolete

The old line-leading @if=, @chance= and @delay= prefixes are no longer parsed. The replacements are @chance=25%chance 25%, @delay=20tafter 20t, and @if=<condition> → an if <condition> [ ... ] branch or where <condition>. @ignore_failure has no equivalent. Full syntax is in CoreLib Actions.

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"