Skip to content

Variable Types ​

Skill variables support several types, each field has its own use, and they resolve at runtime. Skill variables (variables) define values that change by skill level; you write them under variables in the skill definition

Types ​

TypeAliasesDescription
expression—Math expression that can reference context variables such as %level%. The most common type
stringstr, textString value
random_textrandom_text_lines, random_lines, random_line, text_linesRandomly selects one of the candidate lines
random_charrandom_chars, char_random, chars_randomPicks one candidate with equal probability
weighted_random_charweighted_random_chars, weighted_char, weighted_chars, weighted_char_randomPicks one candidate by weight
conditional_charcondition_char, case_char, if_charPicks one candidate by condition branch
booleanbool, flagBoolean value with expression support
constantconst, fixedFixed value. Unrecognized type values also fall back to this
range—Range value
uniform—Uniform random number (equal probability across min~max)
gaussiannormalGaussian random number
skew_normalskewnormalSkew-normal random number
triangle—Triangle distribution random number

No need to worry about case or separators in aliases: they are lower-cased and have - turned into _ before matching, so spellings such as Random-Text also work

Keep in mind: string, random_text, random_char, weighted_random_char, conditional_char, and boolean are non-numeric types; min, max, and decimals do not apply to them

Automatic type inference without a type ​

ConditionResolved type
lines is presentrandom_text
Both min and max are presentrange
Any other mapping formconstant
The variable is written as a scalar (damage: "10 + %level%")string, with the scalar as the value

Fields ​

yaml
variables:
  damage:
    type: expression
    value: "10 + %level% * 5"
    min: 10
    max: 100
    decimals: 0
FieldTypeRequiredDefaultValuesDescription
typestringNoinferred as above, ultimately constantEvery type and alias in the tableVariable type
valuestringNo""Expression or textstring / boolean read this key directly; other types pass the whole section into evaluation with value as one of its keys
mindoubleNono clampingAny doubleLower bound; a result below it is raised to min
maxdoubleNono clampingAny doubleUpper bound; a result above it is lowered to max
decimalsintegerNo0≥ 0, negatives become 0Decimal precision. 0 rounds to an integer; values above 0 print the double as-is
defaultstringNo""—Fallback value when parsing fails; boolean also uses it as the default boolean test
lineslist<\string>No[]—Candidate lines for random_text; also used for automatic type inference

Variable names are id-normalized. Keys starting with emaki_ are skipped so they cannot collide with the built-in injected variables

Examples ​

expression ​

yaml
variables:
  damage:
    type: expression
    value: "10 + %level% * 5"
    min: 10
    max: 100
    decimals: 0
  radius:
    type: expression
    value: "3 + %level% * 0.5"
    max: 10
    decimals: 1

uniform ​

yaml
variables:
  bonus_damage:
    type: uniform
    value: "5~15"
    decimals: 0

random_text ​

yaml
variables:
  cast_message:
    type: random_text
    lines:
      - "<red>Flame Burst!"
      - "<red>Burn!"
      - "<red>Flame power!"

The candidate list key is lines

Remember: random_text reads only lines. Writing values raises no error but leaves the candidate list empty. Conversely, providing lines without a type makes the type resolve to random_text automatically

boolean ​

yaml
variables:
  is_aoe:
    type: boolean
    value: "%level% >= 5"

Scalar shorthand ​

yaml
variables:
  ignite_ticks: "40 + (%level% - 1) * 6"
  empowered: "%level% >= 5 && %has_target% == 1"

The shortest form: a scalar is parsed as string, and the value is still the expression text

Using variables in scripts ​

You reference resolved variables in action lines, phase conditions, and text with %var.<name>%:

yaml
script:
  actions:
    cast:
      - 'trigger | damage amount=%var.damage%'
      - 'trigger | where %var.is_aoe%==true | spawn_particle particle=EXPLOSION count=10'

Variables resolve in the order you declare them, so a later variable may reference an earlier one:

yaml
variables:
  damage:
    type: expression
    value: "10 + %level% * 5"
  hit_message: "<red>Dealt %damage% damage"

Two different reference scopes

The two scopes use different spellings, so do not mix them up: inside variables, one variable references another as %name% (no var. prefix). In script lines, phase conditions, and text it is %var.name%. Context variables follow the same split: %var.level% in scripts, but %level% inside a variable expression

Context variables ​

When you write an expression or another non-string type, its evaluation can read these context values:

VariableDescription
%level%Current skill level. During an upgrade preview this is the level before the target (the current level)
%target_level%Upgrade target level
%max_level%Maximum skill level
%skill_id%Skill id
%trigger_id%Trigger id
%is_passive%Whether the skill is passive (1 / 0)
%player_level%The player's vanilla experience level
%player_health%The player's current health
%player_max_health%The player's maximum health
%sneaking%Whether the player is sneaking (1 / 0)
%has_target%Whether there is a target (1 / 0)

MythicMobs injection ​

Resolved variables are injected into MythicMobs skill metadata and you read them in a MythicMobs skill as <skill.var.name>. Five built-in variables are always injected: emaki_skill_id, emaki_skill_level, emaki_trigger_id, emaki_is_passive, and emaki_has_target

Inside native scripts the same built-ins are visible as %var.emaki_skill_id% and so on (see Native scripting)