How can I get my Perfect Block Timer working properly?

Right now, I am working on a perfect block mechanic in my game. AnimNotify methods of perfect blocking won’t work for how my block system functions, so I decided to do a timer based perfect block method.

The intended effect is that I run an event as soon as my block input action is pressed and held down, and once the allotted perfect block time runs out(default value is 0.25 seconds), it clears and invalidates itself. If the timer is valid and is pressed within that timeframe, it does a perfect block.

I’m close to getting it working, but I’ve run into a problem. It’s not firing off the desired effects when it should. I know it has something to do with where I am placing clear and invalidate timer. Despite me landing a block in the intended amount of time the perfect block logic should return true and fire, it always returns normal block. I have a breakpoint below visible to show which node keeps firing off when it shouldn’t.

If it doesn’t, just normal block. This is how my code works so far. I originally thought of making and setting a new Block Held Time float variable but realized I don’t need to do that as I can let the timer handle that alone.

I’m not sure how to totally fix your issue since I don’t know where ApplyHitReaction comes into play and when, but assuming CanPerformBlock returns true, you both start and clear the timer in the same execution path, meaning it starts and clears in the same frame, not after the timer is complete.

You don’t have to clear and invalidate a timer that doesn’t loop unless the intention is to stop it before it completes. Otherwise, the engine will invalidate the timer for you automatically.