Scriptname _00E_A2_IronMaidenSC extends activemagiceffect ;===================================================================================== ; EVENTS ;===================================================================================== Event OnEffectStart(Actor akTarget, Actor akCaster) Caster = akTarget Health = Caster.GetActorValue("Health") _00E_A2_IronMaidenSoundM.Play(Caster) RegisterForSingleUpdate(0.25) EndEvent Event OnUpdate() Health = Caster.GetActorValue("Health") RegisterForSingleUpdate(0.25) EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) UnregisterForUpdate() EndEvent Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked) if !(akSource as Spell) && !(akSource.HasKeyword(WeapTypeBow)) if (akAggressor as actor) Attacker = akAggressor as Actor ReflectDamageOn(Attacker) endif EndIf EndEvent ;===================================================================================== ; FUNCTIONS ;===================================================================================== Function ReflectDamageOn(Actor Enemy) Damage = Health - Caster.GetActorValue("Health") If Caster.HasMagicEffect(_50E_HSet_4Pieces_ME) Damage = Damage*2 EndIf Health = Caster.GetActorValue("Health") if (Damage > 0) ; Debug.Notification("I've been hit for" + Damage as Int + "points of damage. Ouch!") _00E_A2_IronMaidenReflectSP.SetNthEffectMagnitude(0, Damage) _00E_A2_IronMaidenReflectSP.RemoteCast(Enemy, Caster, Enemy) Enemy.PlayImpactEffect(BloodSprayImpactSetRed) Enemy.PlayImpactEffect(MAGIllusionNegImpactSet) TRPImpactImpalex.Play(Caster) endif EndFunction ;===================================================================================== ; PROPERTIES ;===================================================================================== Actor Caster Actor Attacker Float Health Float Damage Keyword Property WeapTypeBow Auto Keyword Property WeapTypeMelee Auto Keyword Property VendorItemWeapon Auto MagicEffect Property _50E_HSet_4Pieces_ME Auto ImpactDataSet Property BloodSprayImpactSetRed Auto ImpactDataSet Property MAGIllusionNegImpactSet Auto Sound Property TRPImpactImpalex Auto Sound Property _00E_A2_IronMaidenSoundM Auto Spell Property _00E_A2_IronMaidenReflectSP Auto