• Tutorials

  • Home
  • SpellLingeringScripts

    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.

    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. 'Susan the Souse' (the creator) casts 'Vinyard', which leaves lingering effects over a large area. 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 and runs a script called 'SpellLingeringScripts'. That script 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 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 can return a value:

    Parameters

    Parameter [5] = name of the spell cast by the 'Destroyer'
    Parameter [6] = Destroyer's spell-casting level at the time spell is cast
    Parameter [7] = Creator's spell-casting level at the time spell is cast

    Context

    spell – The spell being cast


    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”.