Passive Spell

The passive spell is a special type of spell that is never cast manually, and has no effect of its own. Instead, it can be triggered by certain configurable events, and when it is triggered it simply calls other spells.

Spell Power is passed to the spells it uses.

Configuration

Option Description Default
triggers A list of triggers that activate this spells' effects. See below for more information. (empty)
chance The chance that this spell will activate when the trigger happens. Should be a number between 1 and 100. 100
cast-without-target If you use targeted spells but the trigger does not have a target, they will normally not be casted. If you would like them to cast anyway, set this option to true. Note that the External Command Spell is considered a targeted spell. false
send-failure-messages Whether to send failure messages, like on cooldown and missing reagents. false
delay The number of ticks to delay spell activation after the trigger is detected. A value of -1 means that the spells will activate at the same time as the trigger (often means just before), a value of 0 means the spells will activate immediately after the trigger, and any value greater than 0 is the number of ticks to wait before activating the spells. -1
spells A list of spells to activate when this spell is triggered. (empty)

Triggers

Triggers are specified in the format: <name> [var]. Not all triggers use a variable, but some do.

Trigger Description
takedamage Triggers when the player takes damage. The var is the item (or comma-separated list) that the attacker is holding, or a damage type (or comma-separated list). Leave out the var to allow any damage source.
givedamage Triggers when the player gives damage. The var is the item (or comma-separated list) that the player is holding. Leave out the var to allow any item.
kill Triggers when the player kills an enemy. The var is the type of entity (or comma-separated list) killed. Leave out the var to allow any entity.
respawn Triggers when the player respawns.
blockbreak Triggers when the player breaks a block. The var is the block id (or comma-separated list). Leave out the var to trigger on any block break.
blockplace Triggers when the player places a block. The var is the block id (or comma-separated list). Leave out the var to trigger on any block place.
rightclick Triggers when the player right clicks. The var is the item that the player is holding (or comma-separated list).
rightclickblockcoord Triggers when the player right clicks a specific block, or a list of blocks. The var is the coordinates of the block in the format world,x,y,z (can specify a list with semi-colons, ie: world,x,y,z;world,x,y,z).
rightclickblocktype [v2.11] Triggers when the player right clicks a certain type of block, or list of types. The var is the block id (or comma-separated list).
spellcast Triggers when the player casts a spell. The var is the spell name to check. Leave out the var to trigger on any spell cast.
spelltarget Triggers when the player targets another player or monster with a spell. The var is the spell name to check. Leave out the var to trigger on any targeted spell cast.
spelltargeted Triggers when the player is targeted by a spell. The var is the spell name being cast. Leave out the var to trigger on any spell.
sprint Triggers when the player starts to sprint. Does not use a var.
stopsprint Triggers when the player stops sprinting. Does not use a var.
sneak Triggers when the player starts to sneak. Does not use a var.
stopsneak Triggers when the player stops sneaking. Does not use a var.
hotbarselect [v2.11] Triggers when the player selects a certain item on their hot bar. The var is the item id or comma-separated list.
hotbardeselect [v2.11] Triggers when the player deselects a certain item on their hot bar. The var is the item id or comma-separated list.
buff A special trigger that makes a buff spell always active. Technically triggers on player join, leave, death, and respawn. Does not use a var. Only works with buff spells, and should not generally be used with any other triggers.
ticks Triggers periodically. The var is the tick interval, in server ticks (20 = approx 1 second).

Examples

Example 1: Poison Sword

If a player has this spell, they will have a 30% chance to poison when attacking with a gold sword. The effect will not occur more often than once every 4 seconds.

    poisonsword:
        spell-class: ".PassiveSpell"
        name: poison-sword
        triggers: 
            - givedamage 283
        chance: 30
        cooldown: 4
        spells:
            - poison

Example 2: Spell Reflect

If a player has this spell, they will always have a 5% chance to automatically cast reflect when targeted by a spell.

    spellreflect:
        spell-class: ".PassiveSpell"
        name: spell-reflect
        triggers: 
            - spelltargeted
        chance: 5
        cooldown: 30
        spells:
            - reflect
passivespell.txt · Last modified: 2012/12/12 13:18 by nisovin
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution 3.0 Unported
Recent changes RSS feed Driven by DokuWiki