forked from nisovin/MagicSpells
- Notifications
You must be signed in to change notification settings - Fork 72
LoopSpell
JasperLorelai edited this page Jul 16, 2026
·
21 revisions
spell-class: ".targeted.LoopSpell"| Value | Supported |
|---|---|
entity | true |
location | true |
entity_from_location | false |
delayed- Plays the effect at the loop's location when the loop ends.
The LoopSpell allows for the caster to repeatedly cast spells at either a target, the target's location or their own location for some duration of time and a certain amount of iterations. The LoopSpell can also be used without a target or location if the targeted option is set to false.
Since 4.0 Beta 13 some of these options support dynamic values through numeric or string expressions.
| Option | Description | Type | Default | Supports expressions |
|---|---|---|---|---|
delay | Defines how long, in ticks, before the loop starts. Since 4.0 Beta 13: With negative values, the iterations are done immediately, instead of at the beginning of the next tick. | Long | 0 | true |
duration | Defines how long, in ticks, the loop will last. If less than or equal to 0, the loop will last indefinitely unless iterations are specified. | Long | 0 | true |
interval | Defines how long, in ticks, the interval between casting the spells. Since 4.0 Beta 13: When <=0, all of the iterations of the loop are done at once. | Long | 20 | true |
iterations | Defines how many total iterations the loop will do. If less than or equal to 0, the loop will last indefinitely unless duration is specified. | Integer | 0 | true |
y-offset | Vertical offset when casting at a location | Double | 0 | true |
targeted | If true, depending on require-entity-target and point-blank, the loop will target an entity or location. If false, spells will be cast without an entity or location target. | Boolean | true | true |
point-blank | When true and require-entity-target: false, the spell will be cast on the caster's location. When false, the spell will be cast on the targeted block. | Boolean | false | true |
stop-on-fail | If true, if a spell fails to cast, the loop will stop. | Boolean | false | true |
only-count-on-success | If true, an iteration of the loop only counts towards iterations if all of the subspells in spells succeed. | Boolean | false | true |
pass-targeting | When false, sub-spells will recheck their individual can-target lists. | Boolean | true | true |
cancel-on-death | If true, dying will cancel the loop. Will always cancel if targeting a non-player entity. | Boolean | false | true |
require-entity-target | If true, targets an entity for the loop. | Boolean | false | true |
cast-random-spell-instead | If true, the loop will instead randomly cast one spell in spells each iteration. | Boolean | false | true |
skip-first | If true, skips loop-modifiers, variable-mods-loop, loop-target-modifiers, loop-location-modifiers and variable-mods-target-loop on the first iteration of the loop. | Boolean | false | true |
skip-first-loop-modifiers | If true, skip loop-modifiers on the first iteration of the loop. Uses the value of skip-first as its default. | Boolean | skipFirst | true |
skip-first-variable-mods-loop | If true, skip variable-mods-loop on the first iteration of the loop. Uses the value of skip-first as its default. | Boolean | skipFirst | true |
skip-first-loop-target-modifiers | If true, skip loop-target-modifiers on the first iteration of the loop. Uses the value of skip-first as its default. | Boolean | skipFirst | true |
skip-first-loop-location-modifiers | If true, skip loop-location-modifiers on the first iteration of the loop. Uses the value of skip-first as its default. | Boolean | skipFirst | true |
skip-first-variable-mods-target-loop | If true, skip variable-mods-target-loop on the first iteration of the loop. Uses the value of skip-first as its default. | Boolean | skipFirst | true |
str-fade-self | Message sent to the caster when the loop ends. | Rich Text | true | |
str-fade-target | Message sent to the target when the loop ends. | Rich Text | true | |
spell-on-end | Sub-spell casted when the loop ends. | String | false | |
spells | List of sub-spells casted on each iteration of the loop. | String List | false | |
variable-mods-loop | List of variable modifications performed on the caster on each iteration of the loop. Performed before loop-modifiers and loop-target-modifiers are checked. | String List | false | |
variable-mods-target-loop | List of variable modifications performed on the target on each iteration of the loop. Performed before loop-modifiers and loop-target-modifiers are checked. | String List | false | |
loop-modifiers | List of modifiers checked at the beginning of each iteration of the loop. Checked after variable-mods-loop and variable-mods-target-loop are performed. | String List | false | |
loop-target-modifiers | List of target modifiers checked at the beginning of each iteration of the loop. Checked after variable-mods-loop and variable-mods-target-loop are performed. | String List | false | |
loop-location-modifiers | List of location modifiers checked at the beginning of each iteration of the loop. Checked after variable-mods-loop and variable-mods-target-loop are performed. | String List | false |
Strikes targeted entity with lightning for up to 200 ticks (10 seconds). If the entity dies before the duration of the LoopSpell ends, the loop will cancel.
PerpetualLightning:
spell-class: ".targeted.LoopSpell"delay: 10duration: 200require-entity-target: truecancel-on-death: truestr-fade-self: "The foe has been slain, thus the lightning strikes cease."spells: - lightningIncrements a variable by 1 each time a loop occurs. When the variable reaches its maximum value, the loop ends.
variables:
increasingvar:
type: playerpermanent: falsedefault: 0min: 0max: 10IncreasingVariableLoop:
spell-class: ".targeted.LoopSpell"require-entity-target: falsevariable-mods-loop: - increasingvar +1str-fade-self: "The variable has reached its maximum value of %var:increasingvar%"spells:
- IncreasingVarDummy(mode=full)loop-modifiers:
- variable increasingvar=10 deniedIncreasingVarDummy:
spell-class: ".targeted.DummySpell"target-self: truestr-cast-self: "The current value of the variable is %var:increasingvar%"helper-spell: true