So I have a simple script that cast a spell whenever I get hit, which is attached to a permanent magic effect with conditions. Problem is, when I get hit by flame or frost it triggers like 100 times a second and crash my PC, before my conditions kick in to make it stop. How do I limit the event to trigger only once per second?
Scriptname MagicCastOnHit extends ActiveMagicEffect
{This script cast a spell on hit.}
;======================================================================================;
; PROPERTIES /
;=============/
SPELL PROPERTY armorSpell AUTO
;======================================================================================;
; VARIABLES /
;=============/
Actor TargetActor
;======================================================================================;
; EVENTS /
;=============/
Event OnEffectStart(Actor Target, Actor Caster)
TargetActor = Target
EndEvent
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
armorSpell.cast(TargetActor, TargetActor)
EndEvent
Edited by 123hamster, 07 October 2021 - 01:15 am.