Jump to content

registering AnimationEvent leads to inability to block and/or attack

Recommended Posts

As in the title the issue is that when I register NPC for animation event, then player is loosing ability to attack or block (or both). Is there way to somehow make it work?
At first I noticed this while I was experimenting with a spell effect that makes you fire things like with bloodskaal blade, and now I was registering things to detect if NPC was doing some ranged attacks or just standing.
So the code is in magic effect, I apply spell with console command "cast", notifications show that events firing as expected.

actor trg
int i = 0

Event OnEffectStart(Actor akTarget, Actor akCaster)
	i = 0
	trg = akTarget
	if (RegisterForAnimationEvent(trg as ObjectReference, "MRh_SpellFire_Event") && RegisterForAnimationEvent(trg as ObjectReference, "MLh_SpellFire_Event"))

Event OnUpdate()
	i = 0

Event OnAnimationEvent(ObjectReference akSource, string asEventName)
  if (akSource == trg as ObjectReference) && (asEventName == "MRh_SpellFire_Event")
		Debug.Notification(i+"# MRh_SpellFire_Event event sent!")
  if (akSource == trg as ObjectReference) && (asEventName == "MLh_SpellFire_Event")
		Debug.Notification(i+"# MLh_SpellFire_Event event sent!")

Event OnEffectFinish(Actor akTarget, Actor akCaster)
	UnregisterForAnimationEvent(trg as ObjectReference,"MRh_SpellFire_Event")
	UnregisterForAnimationEvent(trg as ObjectReference,"MLh_SpellFire_Event")

UPD it seems to affect player's controls when PC is one who casting, like ">player.cast 1413069f 0005054a left" when doing like ">cast 1413069f 0005054a left" it works using selected reference as caster. But still weird bug.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...