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.
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.
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.
Thanks. I'll take a look at using the onUpdate() solution.