Scripting NPCs to cast Detect Life when sneak attacked

Post » Tue Aug 19, 2014 4:43 am

Is it possible to script NPC's to cast a Detect Life spell (assuming they know it) in response to an undetected threat?

Pseudocode for script would be something like (as far as I'm aware, the CK doesn't do loops but I include for illustrative purposes):

while (Actor Takes Damage && No Opponent Detected)

Actor(Cast Spell Detect Life)

Assuming this is feasible, what is the best way to add a spell to (say) all magic capable NPC's in Skyrim? Would I have to go into each actor record individually and add the spell or would it be better done via the ActorBase record or....?

Conversely, if anyone knows of a mod which achieves something like this, please let me know.

P.S. Of course, if the player is a vampire the detect life spell won't be of any use - perhaps consider it a(nother) perk of vampirism....or give Detect Undead as well as Detect Life....

User avatar
Adrian Powers
 
Posts: 3368
Joined: Fri Oct 26, 2007 4:44 pm

Return to V - Skyrim