OnHit event - condition to identify physical enemy attacks ?

Post » Wed Jun 20, 2012 6:44 am

I added a scripted effect to the player that uses the OnHit event, which I want to trigger only when the player is physically hit by an attack (not spell, etc). So, inside the OnHit event I added the line:

if (akSource as Weapon)
; ...
endif

This seems to work fine. Enemy spells are blocked on that condition and don't trigger the effect. On the other hand, hits from enemy attacks trigger correctly. But then I noticed the condition is accepting my own Blizzard damage. In fact, every tick I stay inside the Blizzard hazard causes the script to proc.

So, I'm here considering that "if (akSource as Weapon)" is true when the damage comes from a hazard..

Is this correct?
How can I change this condition to really only allow physical attacks from enemies to pass?
User avatar
gemma king
 
Posts: 3523
Joined: Fri Feb 09, 2007 12:11 pm

Post » Wed Jun 20, 2012 6:49 pm

Weird, I wouldn't have thought that.

What's in akAggressor when it's the blizzard?
User avatar
Prue
 
Posts: 3425
Joined: Sun Feb 11, 2007 4:27 am

Post » Wed Jun 20, 2012 11:38 am

What's in akAggressor when it's the blizzard?

Good question. I'll take a look at that when I got home.

But your question gave me an idea :smile:
Maybe I can try making it work only when the attacker is an actor:

if (akAggressor as Actor && akSource as Weapon)
User avatar
Daniel Brown
 
Posts: 3463
Joined: Fri May 04, 2007 11:21 am


Return to V - Skyrim