Spell Lingering Scripts


This hook is run at the end of spell processing. It is designed to help implement spells such as 'Dispell Magic', which remove the effects of previous spells.


For the sake of simplicity, we will describe this function for very particular spells so that the terminology does not get reduced to 'Party of the First Part' and such nonsense. There are two spell-casters involved and we will need to refer to them by some words:

  1. The combatant who cast the spell which created the lingering Spell Effects. We will use the word 'Creator' to refer to this combatant.

  2. The combatant who cast a spell which will examine the lingering Spell Effects and perhaps cancel them. We will use the word 'Destroyer' to refer to this combatant.


Let us say we have a spell called 'Vinyard' that causes lingering spell effects:


Let us say we have a spell called 'Grape Wilt' that kills grape vines over some area.


Let us say that 'Susan the Souse' (The creator) casts 'Vinyard', which leaves lingering effects over a large area.


Now along comes 'Teetotaler Theresa' (The destroyer) who casts 'Grape Wilt'. It has an area of effect and is designed to cancel the effect of 'Vinyard'.


The engine examines the spell 'Grape Wilt' and finds a Special Ability with a script named 'SpellLingeringScripts'. The engine runs that script and it returns the name of a script that should be run for each lingering spell effect. Let us say that it returns 'Destroy Grape Vines'. The engine then then examines all the lingering effects of previously cast spells. For each such lingering effect, the engine finds the spell that caused the effect and searches for scripts by the name 'Destroy Grape Vines'. It will run such scripts with information necessary to determine whether or not 'Grape Wilt' should cancel the Spell Effect created by 'Vinyard'. Namely:

In our example, we will assume that 'Vinyard' has Special Ability with a script named 'Destroy Grape Vines'. That script will run in the Context of the spell 'Vinyard' with HookParameter[5] set to “Grape Wilt”, and Hook parameters[6] and [7] set to the casters' levels. The script can return a value:

Hook Parameters for 'SpellLingeringScripts'

Hook Parameter[5] will be the name of the spell cast by the 'Destroyer' – in this case “Grape Wilt”.

Hook Parameter[6] will be the 'Destroyer's spell-casting level at the time he cast his spell.

Context for 'SpellLingeringScripts'


Note:

The 'spell-casting levels' are determined firstly by the magic-school of the spell being cast. Magic User spells use the Magic-User level and the Cleric spells use the Cleric level. These can be overridden at the time the spell is cast by using the hook “SpellCasterLevel”.