Alternatively you could use a spellhook that checks the area tag (or a variable set on the area) and if it matches, then the spell is canceled before its ever cast. Doing it this way would also mean that the spell is used up for that day.
I use this in a few areas in my module - Karek Norn - to simulate null magic areas. Using the spellhook allows me to effectively hide such areas from casters until they attempt to cast a spell and find that nothing happens.
Example Code from my module's spellhook
#include "x2_inc_switches"
#include "nw_i0_plot"
void main()
{
if (GetLocalInt(GetArea(oCaster), "NULL_MAGIC_ZONE") == 1) //Magic Nullification Area
{
SetModuleOverrideSpellScriptFinished();
SendMessageToPC(oCaster, "Your spell disipates before the magical energies conjured forth can manifest any effect.");
}
}
You could even use thespellhook to generate some alternate effect, damage the caster and any allies, etc. With spellhooking you can acomplish a lot of global spell changes without changing a bunch of scripts. For example, in addition to area specific effects upon spells, I also use the spellhook for my spell components and divine focus systems. Basically I can prevent a divine caster from casting any spells without a holy symbol in their inventory or prevent arcane casters from casting spells without the appropriate material components or foci.
Modifié par Pstemarie, 19 janvier 2012 - 01:59 .