Download

How can I play the same animation twice (re-enter the same state when it's finished)?

Hello,

I need to play a same slash animation twice, or more times, in my state machine (slash, slash, slash… if player spams the button). The slash is one-off animation (not made to loop).

What I want is, when a slash animation finishes, if player don’t press the button again, it transits back to idle. If player press the button again, it re-enters to the slash node itself again.

I use a conduit to do it, as the following picture. The transition rule from attack to conduit is remaining time rate < 0.1. The transition rule from conduit to attack can always be true if player spams the button. It seems it won’t restart the slash animation when it re-enters. I end up stuck at the last frame of the attack forever.
2018-03-23 20_15_55-PSMCharacterAnimationBlueprint_.png

I know that if I transit to an idle node first then go back to attack, it will work. But a brief idle pose in between breaks the fighting rhythm of my game. I need a slash right after another.

There is an “always restart on entry” option. But it won’t work, because technically I’ve never left the attack state.

How could I solve this problem?

Thanks.

You may want to create and use animation montages for this. And some blueprint logic of course.

Well, I’m managing the states in C++. Using a montage would mean creating another system.
I managed to make it working by duplicate the states and transit between the duplicated states.
Thanks anyway.

This is a really bad way of doing it and won’t scale up nicely if you ever needed things to repeat more times in a row, or if you want to change the animation, you’d have to change it multiple times.