help with attacking on left mouse button

[SOLVED]

hi guys basically i have set up a basic attack so that when the player presses the left mouse button it fires an attack anim montage. this all works great except if the player spams the button too fast the animation goes all funny.

How can i stop the player spamming the button? i tried using bools, and even an anim notify to tell me what the animation has finished and then only let the player attack again but nothing seems to stop the spamming animation. thanks

here is a video of what i mean. if i click the button slowly everything looks fine but as i start to click faster and faster the animation spazzes out.

possibly set a delay node so the attack finishes before you can attack again.

activate, set a is attacking, and unset when the montage launch a ended montage.


also see

  • montage is playing
  • montage is active

those maybe can work as flags without need to “set them more” than play them

where would the delay node go ?? after the anim montage node?

i tried using bools, thanks ill check out those two and see what i can come up with

where are the montage is playing. is active nodes i cant find them? thanks

Nevermind i solved it. Although this seems like a rather crude way of doing it.
here is my final blueprint

so basically when i press the left mouse button it checks if the variable isAttacking is true or not.
If it is true this means we are already attacking so we do nothing.
If it is false then we need to set the boolean to true as we are now attacking and play the animation montage.

Now we have a problem, we can no longer spam the button which is good but we also are never setting the boolean value back to false therefore when we press the left mouse button again to start another attack the branch will always equate to true and do nothing.

So i added in a delay before ressetting the variable back to false. I played with the delay duration untill i got it to how i want.