This is an implementation of an anti-magic zone, where no spells can be cast, be it by actual casters, from a scroll, wand, potion or other item.
Bard songs will also not work, and active (temporary) effects on entering creatures are removed, including effects on currently equipped armor and weapons (like Magic Weapon, Magic Vestment, Flame Weapon and such) as well as anything in inventory. Divine abilities like Divine Shield also don't work.
Inside the zone total spell failure as well as Silence affects the creatures. Silence is to ensure Bard inspirations and songs don't work.
When you exit the zone, everything should work normally again.
The code uses the OnEnter and OnExit scripts of a trigger as well as a spell hooking script, 3 scripts in total.
To make spell hooking work, the *module* variable X2_S_UD_SPELLSCRIPT has to be set to the name of the spellhook script. In the spellhook script, we can check for any conditions that would require the spell to be canceled. Currently this is if a local variable "ps_anti_magic_zone" has the value 1 (this is set on any creature that enters the zone, and set to 0 when exiting it).
If the creature is in the zone, then any spell from scroll, potion, wand or other item is canceled.
Problems:
- currently a brooch of shielding will still create that shield spell visual effect even though the actual effect is canceled.
- intentional: healkits work, potions of healing don't (since those are spells).
- not yet fixed: druid abilities still work in antimagic
Changes:
v1.2:
- fixed: potions and other items that do not have a valid caster, but a valid target are now correctly disabled in antimagic
- added a modified script for the Ethereal Jaunt spell that did not have a spellhook, therefore scrolls worked in antimagic
v1.1:
- fixed bug in OnExit script
- remove all effects on items in inventory as well
- demo for using Antimagic in an entire area added
Thank you for your vote, I'll add some help text and a .erf file if I make a new version.
Posted by Soulscry at 2009-08-30 12:08:20 Voted 10.00 on 08/30/09
Love it. Wish you had a good guide for installing and setting this up though. Haveing to trial and error it. Also an erf in your zip so we can drop it into a mod without haveing to strip it out of the example mod would be nifty. 10.0 very awsome work.
Just noticed some problems, if this is used with triggers in an area to make small antimagic zones, you can still stand outside the zone and cast on someone inside, and the spells work. I'll try and fix this for the next version.
Posted by Corgano at 2009-04-26 18:05:19 Voted 10.00 on 04/26/09
Looks pretty sweet! I'll have to plop this in a dungeon someplace where the PCs aren't expecting it. :) _________________________ Website: Link
Markshire is building in preparation for NWN2
Posted by nicethugbert at 2009-04-26 15:24:05 Voted 10.00 on 04/26/09
10 - A Masterpiece, Genuinely Groundbreaking 9 - Outstanding, a Must Have 8 - Excellent, Recommended to Anyone 7 - Very Good, Deserves a Look 6 - Good, Qualified Recommendation 5 - Fair, Solid yet Unremarkable 4 - Some Merit, Requires Improvements 3 - Poor Execution, Potential Unrealized 2 - Very Little Appeal 1 - Not Recommended to Anyone