Symbol of Pain

Description
This spell allows you to scribe a potent rune of power upon a surface. When triggered, a symbol of pain imposes a -4 penalty on attack rolls, skill checks, and ability checks to all enemies in the area (60 feet radius). These effects last for 1 hour.

Note: Magic traps such as symbol of pain are hard to detect and disable. A rogue (only) can use the Search skill to find a symbol of pain and Disable Device to thwart it (DC30).

Bugs
nx2_s0_symbol_of_sleep, ginc_symbol_spells, nx2_s0_symbol_of_paina:

All symbols scripts including Symbol of Pain are extremely inefficient. They are based on an interaction of a trap object and an AoE object that are both created when a rune spell is cast. The trap object is actually just for show and does absolutely nothing. The spell functions similar to a Glyph of Warding, which is triggered by entering the AoE and it is the AoE object, not the trap object that sends out the burst and applies the penalties. It would make more sense to get rid of the AoE altogether and to rely on the trap object itself. Below are a couple of hints that should give potential modders an idea on how to create such a trap:

1) Creating event handlers for the trap (ginc_symbol_spells.nss):

2) Making the trap object remember who created it, the SpellSaveDC of the creator and the location of the trap (due to a hard-coded bug, fails to detect its own location when triggered!)-ginc_symbol_spells.nss:

3) Triggering the trap when it's created (the OnEnter event works differently for traps than for AoEs! When an AoE spell is cast on a creature, the OnEnter event is triggered, see Mind Fog or Cloudkill, but the trap OnEnter event is only triggered when an object actually MOVES around while standing on the trap or actually enters the trap) - ginc_symbol_spells.nss:

4) The triggering script (nx2_b_symbol_triggered) needs to check if GetEnteringObject is valid, if it is, it's a real OnEnter event, if not, it's the artificially created OnEnter event that is created when the trap object is created (see above):

5) Deleting the trap:

The trap duration is limited to 1 turn per caster level. So how does one check if it's time for the trap to expire? There are three possibilities:

a) Apply any useless effect like Ultravision to the trap for the duration and use the trap's hearbeat script (nx2_b_symbol_hb.nss) to check if the effect has expired. If true, tell the trap to disarm itself. Does not work if the player saves the game after creating the trap (some kind of hard-coded bug)

b) Set the creation time as a localInt on the trap object and then use the heartbeat script to see if it's time to disarm itself

c) Check if player is resting - "GetIsResting" (resting forwards the clock by 8 hours). If true, disarm.

6) Creating the burst when triggered and applying the penalties (nx2_s0_symbol_of_paina.nss):

7) Altering ALL dispel spells to include code to dispel Symbol spells (Note: Dispel spells cannot dispel traps, only AoEs!) This involves changes to the following scripts: nw_s0_lsdispel.NSS, nw_s0_dismagic.NSS, nw_s0_grdispel.NSS, nw_s0_morddisj.NSS as well as warlock dispel invocations. The DC for dispel should roughly follow the standard DC for dispelling AoEs: