Chain Lightning

Spell Description
Caster Level(s) Wizard/Sorcerer 6
Innate Level 6
School Evocation
Descriptor(s) Elictricity
Component(s) Verbal, Somatic
Range Long
Area of Effect / Target Colossal, 1 Target / Level
Duration Instant
Save Reflex 1/2
Spell Resistance Yes
Additional Counterspell(s) None
Dispel No
Description A bolt of electricity arcs through the caster's enemies for 1d6 points of electrical damage per caster level, up to a maximum of 20d6 points of damage to the initial target and half that amount to all secondary targets.

Spell Scripts
Main nw_s0_chlightn

Changes/Updates for Thain
Script Change Custom GetCasterLevel function
Before Get the level of the casterclass used or item property
After Get the level of the casterclass used or item property, pluss any modifiers (Palemaster++)
Script Change Custom ResistSpell function
Before Checks for Absorbtion (Spell mantle), Immunity and SR
After Same as before, just a wrapper for easy later change
Script Change Custom GetSpellSaveDC
Before Returns Save DC of spell: 10 + Spell Level + Spell Focus
After Same as before, just a wrapper to easy add alternate DC for items and maybe more later
Bugfix Delayed damage to first target to after script
Before First target would get damage during execution of the script, which could lead to death of the target and messing up the rest of the script.
After First target gets damage after script is finished

Concept: Ankh_Phoenix and Aremah, Code: Ankh_Phoenix