Trying To Make A Sword Swing Once

Hey everyone, hope all is well!

I’ve run into a problem that I can’t quite solve.
I’ve got a sword that I want to have the character be able to only swing once. Right now, the sword keeps being swung for however long the mouse button is held down.
I’m curious as to how I could manage to achieve this.

Thanks, and take care!

At the swinging animation, add an animation notify (it’s like a function call, if you don’t know). And hook this notify with a method that disable whatever the variable triggering the sword swing animation.

Usually the variable is boolean, and you’ll set it to false. Check this quick video about how to add different types of animation notifies or state-machines events, to call some code at certain moment of the animation.

-m

Hey Mamoniem, thanks for the response!

After looking at this a bit this morning, I finally figured out what was going on. A lot of my logic for animations depends on a bool, isAttacking, which is set when you click the mouse button. The problem was that I wasn’t turning this bool off quickly enough to stop the attacks from happening if the button was held down.
After adding a delay after the initial set, then setting it to false, everything is working quite well.

Thanks for your time and input! =-)

Don’t forget to mark the the answer if it helped :wink:

Thanks for the reminder. =-)

welcome :slight_smile: it helps in sorting the queue for Epic staff.

-m