User Tools

Site Tools


passivespell

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
cancel-default-action Whether to cancel the default action that was triggered. For example, with a damage-based trigger, setting this to true would cancel the damage. This will not work if there is any delay (the delay must be -1 for it to work). false
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
Damage-Based Triggers
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.
death [v3.0] Triggers when the player dies. Note that this may cause odd behavior in some situations, since dead players can't really cast spells.
Player Event Triggers
join [v3.0] Triggers when the player joins the game.
respawn Triggers when the player respawns.
quit [v3.0] Triggers when the player quits the game. Note that this may cause odd behavior in some situations, since offline players can't really cast spells.
Player Action Triggers
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.
fly [v3.0] Triggers when the player starts to fly (presses double-jump). Does not use a var.
stopfly [v3.0] Triggers when the player stops flying. Does not use a var.
dropitem [v3.0] Triggers when the player drops an item from their inventory. The var is the item type or comma-separated list.
pickupitem [v3.0] Triggers when the player picks up an item from the ground. The var is the item type or comma-separated list.
fish [v3.0] Triggers when the player fishes. The var is one of the following: ground, fish, fail, or an entity type.
shoot [v3.1] Triggers when the player fires a projectile (an arrow from a bow). Does not use a var.
teleport [v3.0] Triggers when the player teleports. The var is the teleport cause, which is one of the following: command, endportal, enderpearl, netherportal, plugin, or unknown.
hotbarselect Triggers when the player selects a certain item on their hot bar. The var is the item id or comma-separated list. unreliable
hotbardeselect Triggers when the player deselects a certain item on their hot bar. The var is the item id or comma-separated list. unreliable
Interaction Triggers
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 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).
rightclickentity [v3.0] Triggers when the player right clicks on an entity. The var is the type of entity.
Spell Triggers
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.
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.
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"
    triggers: 
        - givedamage 283
    chance: 30
    cooldown: 4
    spells:
        - poison
passivespell.txt · Last modified: 2014/01/13 17:54 by nisovin