Download

Why does the animation not play only when spam clicking?

Hello, I am having a bit of an issue with when my player can and can’t attack. I attached a screen capture of the player blueprint.

The problem is that if I spam click the attack input multiple times for a long time, even though the delay passes and the conditions are reset, my player does not play the animation for a second time as long as I keep clicking fast enough. If I wait for a moment and click slightly after the delay, it works fine.

Problem is, if a player is spam clicking, it would be natural for the attack to fire when clicking after the delay is over, but instead the animation just does not play unless waiting for a long enough time between each click. It feels very non-intuitive, because sometimes an attack simply won’t fire because you clicked too soon, and if you spam click to compensate, it actually takes longer because you have to stop spam clicking and then wait long enough before clicking to make the animation play again.

If I add a 0.2 second delay node before the “IsAttacking” variable is set to true (this variable transitions the player to the attack state in the animation blueprint), I can spam click and the attack will always fire right after the “IsAttacking” variable is reset back to false after the 0.75 delay. Problem is of course, that adds a delay to the attack input, which messes up the gameplay. I tried making the 0.2 delay shorter, but then I get the same problem mentioned above.

I’m stuck on what to do. Any help would be greatly appreciated, thank you.

Thanks for the reply. The picture I attached earlier is from the player blueprint, the anim blueprint is pretty much empty except for some stuff driving a running animation. I’ll attach a picture of my state machine.
In the player blueprint, once the IsAttacking boolean is reset after the delay, I can see the state machine going from Attacking back to Idle/Running.

Edit: Oh, maybe you mean I should put it in the anim BP and not player BP? Looking at the picture you attached, I will try that.

I’m not really sure what to do. The problem specifically seems to be that when I click too quick after the delay is finished, it fires and resets the IsAttacking boolean as intended, but the state changes are lagging behind. Because I can see that in the state machine, after the delay is finished and the boolean is reset, it goes back to Idle/Running state, but clicking attack again quickly after it changes to Idle/Running, returning it to the Attack state, returns no animation unless I wait that extra moment.

I’m not really sure what to do. The problem specifically seems to be that when I click too quick after the delay is finished, it fires and resets the boolean as intended, but the state changes are lagging behind. Because I can see that in the state machine, after the attack delay is finished and the boolean is reset, it goes back to the Idle/Running state. Clicking attack again quickly after it changes to Idle/Running, returns it to the Attack state, but returns no animation unless I wait that extra moment.

Could you please show me how to set up this part with nodes? “IsAttacking false OR GetRelevantTimeRemaining < 0.1 -> Can Enter Transition”

My attack animation is shorter than the delay.
I can see that in the state machine, after the attack delay is over and the boolean is reset, it returns to the Idle/Running state. If I click attack again right after it changes back to Idle/Running, it goes back to the Attacking state, but no animation gets played. Unless I wait that extra moment during Idle/Running before clicking again.