HomingMissileSpell - TheComputerGeek2/MagicSpells GitHub Wiki

Source Code

spell-class: ".targeted.HomingMissileSpell"

targeting cast argument values:

Value Supported
entity true
location true
entity_from_location false

Spell Effect Positions:

  • delayed - Plays the effect at the missile's location when the missile ends.
  • special - Plays the effect at the missile's location as it travels, every special-effect-interval.
  • projectile - Plays the effect at the missile's position as it travels, every tick-interval. On this spell, this position only works for EffectLib effects, entity effects, and armorstand effects.

Description:

A targeted spell that shoots a homing missile made of particles or other effects.

Configuration:

Since 4.0 Beta 13 some of these options support dynamic values through numeric or string expressions.

Option Description Type Default Supports expressions
homing-modifiers Modifiers for the missile, if the modifier checks won't pass, the missile will stop flying. String List false
effect-offset Offset applied to effects from the missile. Vector "0,0.6,0" true
relative-offset Relative offset applied at the start location. Vector "0,0.6,0" true
target-relative-offset Relative offset applied at the target location. Vector "0,0.6,0" true
hit-ground Whether the missile should trigger the spell upon running into the ground. Boolean false true
hit-air-during Whether the missile should trigger the spell all the way it travels. Boolean false true
stop-on-hit-ground Whether the missile should stop upon hitting the ground. If this is false, it will pass through the ground and will not stop unless max-duration is set. Boolean false true
stop-on-modifier-fail Whether the missile should disappear if homing-modifiers will fail Boolean true true
hit-air-after-duration Whether the missile should trigger the spell if it reaches max-duration without hitting anything. Boolean false true
spell The default sub-spell to cast on hit. Must be a targeted spell that can hit the ground or an entity, depending on how the options above are set up. String false
spell-on-hit-air Sub-spell to cast during the missile flight duration. Must be a targeted spell that can hit the ground or an entity, depending on how the options above are set up. (requires hit-air-during and spell-interval) String false
spell-on-hit-ground Sub-spell to cast when the missile hits ground. Must be a targeted spell that can hit the ground, depending on how the options above are set up. (requires hit-ground) String false
spell-on-modifier-fail Sub-spell to cast when the missile's modifier list fails. Must be a targeted spell that can hit the ground, depending on how the options above are set up. (requires homing-modifiers) String false
spell-on-entity-location Sub-spell to cast when the missile hits a target. Must be a targeted spell that can hit the ground. String false
spell-after-duration Sub-spell to cast when the missile reaches its max-duration. Must be a targeted spell that can hit the ground, depending on how the options above are set up. (requires hit-air-after-duration) String false
max-duration The maximum duration this missile is allowed to exist. (in seconds) Double 20 true
y-offset Modifies the start y offset. (overrides relative-offset) Float 0.6 true
hit-radius How far from the center of the missile to look for entities to hit. Float 1.5 true
vertical-hit-radius How far vertically from the center of the missile to look for entities to hit. Float 1.5 true
projectile-inertia Missile's inertia. Float 1.5 true
projectile-velocity How fast the missile moves, roughly in blocks per second. Float 5 true
tick-interval Defines (in server ticks) how often the missile ticks to check modifiers, check hitboxes, play effects, etc. Integer 2 true
spell-interval Used with the hit-air-during option, casts the spell-on-hit-air each defined interval. This interval is every tick-interval * spell-interval ticks. Integer 20 true
special-effect-interval How often to play Spell Effects on the special position. This interval is every tick-interval * special-effect-interval ticks. Integer 2 true
intermediate-special-effect-locations How often to play the particle effects between travelled locations (in ticks) Integer 0 true
projectile-horiz-offset Since 4.0 Beta 13 patch 1. An offset of the direction the projectile initially moves in degrees Float 0 true
projectile-vert-offset Since 4.0 Beta 13 patch 1. An offset of the direction the projectile initially moves vertically in tangent values. Float 0 true
projectile-horiz-spread Since 4.0 Beta 13 patch 1. Effectively the opposite of horizontal accuracy. A higher number means less accuracy. Float 0 true
projectile-vert-spread Since 4.0 Beta 13 patch 1. Effectively the opposite of vertical accuracy. A higher number means less accuracy. Float 0 true

Example:

Homing-Missile:
    spell-class: ".targeted.HomingMissileSpell"
    range: 100
    cast-item: bone
    permission-name: homing_missile
    projectile-velocity: 15
    projectile-inertia: 1.5
    max-duration: 5
    tick-interval: 1
    special-effect-interval: 1
    relative-offset: 1,1,0
    target-relative-offset: 0,1,0
    can-target: players,nonplayers
    spell: DMG_HOMING_MISSILE
    effects:
        eff1:
            position: special
            effect: effectlib
            effectlib:
                class: SphereEffect
                particle: REDSTONE
                color: FF00FF
                radius: 0.35
                particles: 20
                iterations: 1
                period: 1
                visibleRange: 100

DMG_HOMING_MISSILE:
    spell-class: ".targeted.PainSpell"
    helper-spell: true
    damage: 4
    ignore-armor: true