Getting damage values

Post » Sun Sep 08, 2013 3:55 pm

Is there a way to figure out how much damage was done to the player inside of an OnHit() event? I'd like to get the value of how much health the player lost as a result of the hit if possible. Thanks.

User avatar
Elizabeth Lysons
 
Posts: 3474
Joined: Fri Feb 02, 2007 7:16 am

Post » Mon Sep 09, 2013 12:38 am

Not without actively tracking health, and there's no way to be 100% accurate about it. Essentially you would have to have a recurring onUpdate event that triggers every 0.25 seconds or so during combat and records the player's current health value, then in the onHit() event, check how much the player's health has decreased since the last check, and update health to the new value. They do something pretty much exactly like this in a script example included in the article on http://www.creationkit.com/Dynamically_Attaching_Scripts#Create_the_Ability_and_Effect_for_the_Actor, except there they are tracking the reverse--how much damage the player dishes out to NPCs. I'd recommend taking a look at it.

Edit: alternatively, if you are just looking to do this to test something, you can disable the player's health regeneration and then simply check every onHit() for the new value, which should give you a more exact reading.

User avatar
Roisan Sweeney
 
Posts: 3462
Joined: Sun Aug 13, 2006 8:28 pm

Post » Sun Sep 08, 2013 2:56 pm

Thanks. I'll take a look at using the onUpdate() solution.

User avatar
KIng James
 
Posts: 3499
Joined: Wed Sep 26, 2007 2:54 pm


Return to V - Skyrim