Detecting spells in a trigger?


I was reading about Divinity 2 the other day, and I wondered if it was possible to emulate some of the environmental hazards from that game in NWN. For instance, if someone cast a flaming arrow into a trigger (representing a pool of oil) it would set things on fire.

It’s been a while since I have done any scripting but I feel like there was a non-heartbeat way to do this, but my memory isn’t what it used to be. :stuck_out_tongue:

In your specific example, the pool of oil could be a placeable. That would allow it to be targeted by ranged weapons. The placeable event scripts could be used to detect when the pool was attacked / damaged / targeted by a spell, and whether the damage type was fire.

You could also start a fire in the OnUsed script if the player is holding a torch (the OC does this with the funeral pyres in Chapter 1).

This might need quite a lot of work, owing to the variety of spells and custom torches that might conceivably start a fire without actual fire damage.

You’d need to prevent the pool from being destroyed somehow. IIRC the best way is to set high fortitude, so that damage type can be detected (other people here may know better).

There might be different solutions for other environmental hazards. For example, extreme heat and cold are often applied as a heartbeat - these days, there’s really no performance problem with that as long as you’re sensible (e.g. Area heartbeat or pseudo-heartbeat that only runs when a player is in the area).

1 Like

Those are some great suggestions, thanks! My original theory used triggers, but there’s really no reason not to use placeables, or placeables in conjunction with triggers. as for the pool being destroyed, I would want it to “burn up” after a set time period anyway, so that’s no problem.


Yes, ttriggers can be used to start / stop environmental damage on heartbeat or pseudo-heartbeat.

The specific problem with the pool of oil is that you can’t target a trigger. Once the oil is alight, of course, you can use a trigger on creatures that wander into it.

You might also look at Areas of Effect. It’s a while since I messed with those, but I remember finding some handy ready-made goodies there.

You can use trigger with no problems.

You just need to use spellhook and check if the location the spell was cast at is inside trigger

1 Like

You can’t use a ranged weapon on a trigger, though.

1 Like

Thanks for all the help!