Scriptname RestoreHealthOnBlock extends ActiveMagicEffect Actor PlayerRef Float HealthBeforeBlock Float HealthAfterBlock Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, Bool abPowerAttack, Bool abSneakAttack, Bool abBashAttack, Bool abHitBlocked) ;/OnHit is a slow function. It may not catch every block. Furthermore it runs on EVERY kind of hit. Not just what you have coded it to listen for. Stack overflow is a concern with this function./; PlayerRef = Game.GetPlayer() HealthBeforeBlock = PlayerRef.GetActorValue("Health") if !abHitBlocked HealthAfterBlock = PlayerRef.GetActorValue("Health") if HealthBeforeBlock != HealthAfterBlock PlayerRef.RestoreActorValue("Health", (HealthBeforeBlock - HealthAfterBlock)) endif endif EndEvent
I'm not walking you through on how to attach this. You'll have to learn on your own.
This script is intended to work as an ability type spell.
I'll give you links to help you through setting this up.
Edited by Terra Nova, 14 February 2015 - 01:28 PM.