Debugging attack timings, and OnActiveAttack events

stove

New member
hi,

wondering if anyone might be able to help me debug attack timings for a melee weapon. I have a sword whose attack correctly activates (the debug colliders turn red) if I place OnAnimatorItemUse events for each of my attack animations. However, this gets extremely glitchy if I set the 'use rate' too low: below a certain threshold the attack never activates. I assume this is because it ends up skipping the OnAnimatorItemUse or OnAnimatorItemUseComplete events.

I've been trying to troubleshoot this by toying with the use rate numbers, but it's awkward and I have yet to find something that works without feeling artificially slow.

So my first question is: I've been playing with the use rate and the exit timings for my animations. Is this the best way to debug this? Is there anything else I should be looking at?

My second question (related) is: what the heck is the active attack start event trigger, and why is this separate from the animator use events? I tried setting up appropriate animation events for these (see images) but it seems to do absolutely nothing and the attack never activates unless I set a duration. I assume I have the events in the animator set up wrong. But I also just don't understand when/how to use these instead of just the Use events, nor do I really know where I should be looking for info on this in the docs.

Any help appreciated!

image (2).pngimage (1).png
 
You can enable debug logging on the item action which will allow you to better track what is going on. This is a good way to see what the module is waiting on.

I'll tag @Sangemdoko for your second question.
 
Hopefully the graphic on this page explains the attack life cycle a bit better:

Essentially using the melee weapon can allow you to do multiple "hits" in a single animation. (you can imagine a character with quick sword attacks that does multiple stab motions in a single animation with each one triggering a hit).

So the Attack Start, Attack Complete and Allow Chain Attack event triggers are all related to that.
If you have a single swing, they won't make alot of sense, but if you have multiple Attacks that can chain and or attacks with multiple hits, it makes more sense.
 
thanks, both.

Sangemdoko, are the attack events in my second image the correct ones? "OnActiveAttackStart" and "OnActiveAttackComplete"?

Because when I check 'wait for animation events' and use these events (basically between the two Use events), the attack never activates. The only way I can get it working is if I leave the Use events and set generous manual durations for the attacks.
 
Ah, you are missing the 'Animator'. It's
OnAnimatorActiveAttackStart
OnAnimatorMeleeAttackComplete
OnAnimatorAllowChainAttack

I believe this is consistant with how the other events are named ( @Justin correct me if I'm wrong )

@stove When you are not sure if an animation event name is not correct you can open you script editor / IDE of choice. Do a Shift+Ctrl+F -> name of the class, component, module, etc... and you'll find the relevant code. Then you can read through to find when the animator event is listened to.

It will usually look somthing like this:
Code:
m_ActiveAttackStartEventTrigger.RegisterUnregisterEvent(register, Character, "OnAnimatorActiveAttackStart", SlotID, HandleActiveAttackStartAnimationEvent);
m_ActiveAttackCompleteEventTrigger.RegisterUnregisterEvent(register, Character, "OnAnimatorMeleeAttackComplete", SlotID, HandleActiveAttackCompleteAnimationEvent);
m_AllowChainAttackEventTrigger.RegisterUnregisterEvent(register, Character, "OnAnimatorAllowChainAttack", SlotID, HandleAllowChainAttackAnimationEvent);

I hope that helps
 
Top