Amount of damage taken using OnHit event ?

Post » Wed Jun 20, 2012 5:33 am

I want to add a script to the player that does something every time the player is physically hit. This is easy by simply putting the code inside the OnHit event, and testing if the source of damage is a Weapon. But my issue is that I need to know how much damage was taken on that hit.

So, is there a way to identify the amount of damage taken from inside the OnHit event? Any other way?
User avatar
Oyuki Manson Lavey
 
Posts: 3438
Joined: Mon Aug 28, 2006 2:47 am

Post » Wed Jun 20, 2012 3:53 pm

couldnt you do a get actor value on health before and after the on hit event, then calculate the difference?
User avatar
BRAD MONTGOMERY
 
Posts: 3354
Joined: Mon Nov 19, 2007 10:43 pm

Post » Wed Jun 20, 2012 10:36 am

couldnt you do a get actor value on health before and after the on hit event, then calculate the difference?

The idea is good at first, but how can I keep control of the correct actor health?
I could save the actor health after each hit and compare that value to the current health on the next hit. But after a hit, the actor can be healed or lose health through other means that don't trigger the OnHit event, so I don't think I can have control of that health.
User avatar
Antony Holdsworth
 
Posts: 3387
Joined: Tue May 29, 2007 4:50 am


Return to V - Skyrim