English
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
| Type | Aliases | Description |
|---|---|---|
expression | — | Math expression that can reference context variables such as %level%. The most common type |
string | str, text | String value |
random_text | random_text_lines, random_lines, random_line, text_lines | Randomly selects one of the candidate lines |
random_char | random_chars, char_random, chars_random | Picks one candidate with equal probability |
weighted_random_char | weighted_random_chars, weighted_char, weighted_chars, weighted_char_random | Picks one candidate by weight |
conditional_char | condition_char, case_char, if_char | Picks one candidate by condition branch |
boolean | bool, flag | Boolean value with expression support |
constant | const, fixed | Fixed value. Unrecognized type values also fall back to this |
range | — | Range value |
uniform | — | Uniform random number (equal probability across min~max) |
gaussian | normal | Gaussian random number |
skew_normal | skewnormal | Skew-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
| Condition | Resolved type |
|---|---|
lines is present | random_text |
Both min and max are present | range |
| Any other mapping form | constant |
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| Field | Type | Required | Default | Values | Description |
|---|---|---|---|---|---|
type | string | No | inferred as above, ultimately constant | Every type and alias in the table | Variable type |
value | string | No | "" | Expression or text | string / boolean read this key directly; other types pass the whole section into evaluation with value as one of its keys |
min | double | No | no clamping | Any double | Lower bound; a result below it is raised to min |
max | double | No | no clamping | Any double | Upper bound; a result above it is lowered to max |
decimals | integer | No | 0 | ≥ 0, negatives become 0 | Decimal precision. 0 rounds to an integer; values above 0 print the double as-is |
default | string | No | "" | — | Fallback value when parsing fails; boolean also uses it as the default boolean test |
lines | list<\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: 1uniform
yaml
variables:
bonus_damage:
type: uniform
value: "5~15"
decimals: 0random_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:
| Variable | Description |
|---|---|
%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)