Check for casting of spell targeted within a region

So I’d like to be able to trigger something off of the casting of a spell on a specific region of an area denoted by the region inside a trigger. The caster doesn’t need to be in that region, nor is there a specific placeable or creature in that region that could be targeted instead.

Before I spend a week experimenting, does anyone know if this is possible or not? I was thinking of trying to write a script based on the OnClick event for the trigger, or is my best option to create an invisible object and use it’s OnSpellCastAt event?

spellhook then get spell target location, create an npc on that location and check if npc is inside the trigger

very ugly workaround but without nwnx I don’t think there is better way

alternative would be to check X,Y positions but unless that area is a perfect square or rectangle this will be very hard to implement, but if it is square then you could write off the XY of all 4 corners, then manually check in script whether is the X,Y of cast location within them. Not sure if this is applicable for circle shaped aoe…

1 Like

Hm, A rectangle would be fine. I’ve never worked with spellhook, though. How do I access that? Or where can I start reading about it?

https://nwnlexicon.com/index.php/Lilac_Soul_-_Spell-Hooking

1 Like