Skip to content

Variable Types

Skill variables (variables) define values that can change by skill level and can be referenced by scripts, costs, and display templates.

Types

TypeAliasesDescription
expressionMath expression using variables such as %level%.
stringstr, textString value.
random_textrandom_lines, random_line, text_lines, random_text_linesRandomly selects one line.
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.
rangeRange value.
uniformUniform random number.
gaussiannormalGaussian random number.
skew_normalskewnormalSkew-normal random number.
triangleTriangle distribution random number.

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.

Fields

FieldDescription
typeVariable type.
valueValue or expression.
minLower clamp.
maxUpper clamp.
decimalsDecimal precision; 0 means integer-like output.
defaultFallback value when parsing fails.

Examples

yaml
variables:
  damage:
    type: expression
    value: "10 + %level% * 5"
    min: 10
    max: 100
    decimals: 0
  bonus_damage:
    type: uniform
    value: "5~15"
    decimals: 0
  cast_message:
    type: random_text
    lines:
      - "<red>Flame Burst!"
      - "<red>Burn!"
  is_aoe:
    type: boolean
    value: "%level% >= 5"

The candidate list key is lines

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.

Using variables in scripts

Variables can be referenced in action lines, conditions, and text with %var.name% syntax:

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

Variables resolve in declaration order, so a later variable may reference an earlier one:

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

MythicMobs injection

Resolved variables are injected into MythicMobs skill metadata and can be read 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.