Thank you, IsharaMeradin, but what about the second part of the question? Why does debug.SendAnimationEvent produce no effect? All right, this is strange: getting rid of the abHitBlocked condition made NPCs stagger, but only once they had around 25% of their total health removed (does this have something to do with their resistances?). Switching from StaggerStart to BleedOutStart made the script behave normal. Just what exactly is going on here? Update: Stumbled upon another problem:
ScriptName ImprovedCombatParry Extends ReferenceAlias
Bool DeflectWindowActive
Bool ParryWindowActive
Actor Property PlayerRef Auto
Spell Property Stagger Auto
Event OnInit()
RegisterForAnimationEvent(PlayerRef, "BlockStartOut")
RegisterForAnimationEvent(PlayerRef, "BlockStop")
RegisterForActorAction(0)
EndEvent
Event OnActorAction(int actionType, Actor akActor, Form source, int slot)
If akActor == PlayerRef && actionType == 0
UnregisterForUpdate()
DeflectWindowActive = 1
Debug.Notification("Deflect window is active")
RegisterForSingleUpdate(0.5)
EndIf
EndEvent
Event OnAnimationEvent(ObjectReference akSource, string asEventName)
If akSource == PlayerRef
ElseIf asEventName == "BlockStartOut"
ParryWindowActive = 1
RegisterForSingleUpdate(0.2)
ElseIf asEventName == "BlockStop"
UnregisterForUpdate()
ParryWindowActive = 0
EndIf
EndEvent
Event OnUpdate()
If ParryWindowActive
ParryWindowActive = 0
ElseIf DeflectWindowActive
DeflectWindowActive = 0
Debug.Notification("Deflect window is inactive")
EndIf
EndEvent
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
If (abHitBlocked && ParryWindowActive) || DeflectWindowActive
Stagger.Cast(akAggressor)
EndIf
EndEvent
Again, getting no errors when compiling, and animation events work as desired, however, actor action events do not appear to function, and I fail to see why.