> ## Documentation Index
> Fetch the complete documentation index at: https://entities.lodemc.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Skills & Flow

> Calling skills, pausing, branching, looping, timers, signals and variables.

The mechanics that run other skills, decide what happens next, and remember things. [Flow Control](https://entities.lodemc.net/flow-control.md), [Timers & Auras](https://entities.lodemc.net/timers-auras.md) and [Variables](https://entities.lodemc.net/variables.md) explain how to use them; this is the full list.

```yaml theme={null}
  effects:
  - skill{s=fireball;damage=12} +onAttack @target   # call a skill with a parameter
  - delay 1s                                        # pause the rest
  - if{cond=var.phase >= 2;then=enrage} @self       # branch
  fireball:
  - shootfireball{velocity=1.5} @target
  - damage{a=<skill.damage>} @target
```

| Mechanic | Usage | What it does |
| :- | :- | :- |
| `cancelskill` <sub>also `cancel`, `return`</sub> | `cancelskill` | Stops the rest of the current skill from running. To cancel the game event instead, use `cancelevent`. |
| `gcd` <sub>also `globalcooldown`, `setgcd`, `setglobalcooldown`</sub> | `gcd{ticks=20}` | Puts the caster on a global cooldown. Gate skills on it with the `offGCD` condition. |
| `if` <sub>also `branch`</sub> | `if{cond=<condition>;then=<effect id or {block}>;else=<effect id or {block}>}` | Runs `then` when a condition holds, else `else`. Bodies are a skill id or an inline `{…}` block. |
| `log` <sub>also `console`, `print`, `printf`</sub> | `log{message=<text>}` | Writes a message to the server console. Useful while debugging a skill. |
| `loop` | `loop{effect=<effect id or {block}>;times=<count>;every=<ticks>}` | Runs a body a number of times, back to back or one per `every`. |
| `printparenttree` | `printParentTree` | Prints the caster's parent/owner chain to the console, for debugging summons. |
| `pulse` | `pulse{onstart=<id>;ontick=<id>;onend=<id>;interval=1s;duration=10s;delay=0}` | The full form of `repeat`, with explicit `onstart`, `ontick` and `onend` skills. |
| `randomskill` <sub>also `randommeta`, `randomeffect`, `randomrun`</sub> | `randomskill{skills=<id>,<id>;fallbackskill=<id>}` | Runs one of the listed skills, picked at random. `fallbackskill` runs when none can. |
| `removepulse` <sub>also `stoprepeat`, `pulseremove`</sub> | `removepulse{name=<pulse name>}` | Stops repeats and pulses on the target (by `name`, or all), running their `onend`. |
| `repeat` <sub>also `every`</sub> | `repeat{effect=<effect id>;every=2s;for=30s\|forever}` | Runs a skill on each target on a timer: `every` how often, `for` how long (or `forever`). Give it a `name` to stop it. |
| `setskillcooldown` <sub>also `skillcooldown`, `setskillcd`, `skillcd`</sub> | `setSkillCooldown{skill=<id>;seconds=5}` | Sets the remaining cooldown of a skill on the target. |
| `signal` <sub>also `sendsignal`</sub> | `signal{signal=<name>}` | Sends a named signal to the target mob, firing its `+onSignal:NAME` lines. |
| `skill` <sub>also `metaskill`, `meta`, `run`, `effect`, `metavariableskill`, `variableskill`, `vskill`</sub> | `skill{s=<skill id or [ - inline lines ]>;<param>=<value>}` | Runs another skill, by id or as an inline `[ - … ]` list. Extra attributes become `<skill.name>` parameters inside it. `run <id>` is the short form. |
| `sudoskill` <sub>also `sudo`</sub> | `sudoskill{skill=<id>}` | Makes the target run a skill as if it were the caster. |
| `switch` | `switch{condition=<placeholder>;cases=case <value>=<skill> case <value>=<skill> case default=<skill>}` | Compares a placeholder against cases and runs the skill of the first case that matches, or `default`. |
| `throwerror` | `throwError` | Fails on purpose, for testing error reporting. |
| `var` | `var{hits+=1;phase=2;tmp=}` | Sets variables: add, subtract, set, or unset with an empty value. Prefix a name with a scope (`global.`, `target.`, …). |
| `variableadd` <sub>also `addvariable`, `varadd`, `addvar`, `incrementvariable`</sub> | `variableAdd{var=<name>;amount=1}` | Adds to a numeric variable. The long form of `var{name+=n}`. |
| `variablemath` <sub>also `varmath`, `mathvariable`, `mathvar`</sub> | `variableMath{var=<name>;equation=x*2}` | Sets a variable to the result of an equation, where `x` is its current value. |
| `variablemove` <sub>also `varmove`</sub> | `variablemove{from=<name>;to=<name>}` | Copies a variable to another name and removes the original. |
| `variableset` <sub>also `setvariable`, `setvar`</sub> | `variableSet{var=<name>;value=<value>;scope=caster}` | Sets a variable in the given scope. The long form of `var{name=value}`. |
| `variablesetlocation` <sub>also `setvariablelocation`, `setvarloc`</sub> | `variableSetLocation{var=<name>;value=@self}` | Stores a location (the target's, by default) in a variable. |
| `variablesubtract` <sub>also `variablesub`, `subtractvariable`, `subvar`, `reducevariable`, `varsubtract`, `varsub`</sub> | `variableSubtract{var=<name>;amount=1}` | Subtracts from a numeric variable. The long form of `var{name-=n}`. |
| `variableunset` <sub>also `varunset`, `unsetvariable`, `unsetvar`</sub> | `variableUnset{var=<name>}` | Removes a variable. |
| `wait` <sub>also `delay`, `waituntil`</sub> | `wait{until=<condition>;interval=1;timeout=200;cancel=false}` | With a duration, pauses the rest of the skill: `delay 0.5s`, `wait 20` (ticks). With `until`, pauses until a condition holds, checking every `interval` ticks, giving up after `timeout`. Inside a called skill it pauses only that skill. |
| `while` | `while{cond=<condition>;effect=<effect id or {block}>;every=1s;max=100}` | Runs a body every `every` while a condition holds, up to `max` times. |

## Inline skill bodies

`skill` takes MythicMobs' inline list, so a short skill doesn't need a name:

```yaml theme={null}
- skill{s=[ - particlering{p=flame;radius=3} @self - damage{a=6} @playersRadius[3] ]} +onHurt
```

`if`, `loop` and `while` take the `{…}` block form instead; see [Flow Control](https://entities.lodemc.net/flow-control.md#bodies-named-effects-or-inline-blocks).

## `cancelskill` and `cancelevent`

`cancel` is MythicMobs' short name for `cancelskill`, which stops the **skill**. To stop the **game event** that fired it (the damage, the right-click, the creeper's fuse), use `cancelevent`, before the first `delay`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.