Animation event that triggers when a melee attack starts?

Post » Fri Feb 01, 2013 12:55 pm

Hi,

I've been working on an attack cancel script.
The only way I know to cancel an attack animation is by sending a stagger animation event to the player when he is performing a melee attack and then quickly stopping the stagger animation. This creates the illusion that the attack was cancelled.

See here:

Scriptname aabcAttackCancelScript extends activemagiceffect{If the player is starting an attack, he can cancel it by pressing the block button}Actor CasterEvent OnEffectStart(Actor akTarget, Actor akCaster)Caster = akCasterRegisterForAnimationEvent(Caster, "weaponSwing")EndEventEvent OnAnimationEvent(ObjectReference akSource, string asEventName)if (akSource == Caster) && (asEventName == "weaponSwing")	  Debug.SendAnimationEvent(Caster, "staggerStart")  Utility.Wait(0.2)  Debug.SendAnimationEvent(Caster, "staggerStop")endifEndEventActor Property PlayerRef Auto

The above works just fine (minus the fact that the stagger event is sent on every attack as opposed to only when pressing the block button but that's because I didn't implement that part yet)

The only real problem of the code above is that registering for the 'weaponSwing' event is too slow. Ideally I'd like to interrupt the melee attack sooner. I tried other animation events that seemed promising like 'attackStart' or 'attackPowerStartInPlace' but they didn't work. I don't understand why since those are animation events obtained from the iddle animations window in the CK. In theory, they are as valid as the 'weaponSwing' that works for me just fine. Any ideas/suggestions as to why this is happening?
User avatar
Robert DeLarosa
 
Posts: 3415
Joined: Tue Sep 04, 2007 3:43 pm

Return to V - Skyrim