Montage Branching Point Firing Prematurely
I am having a big issue with branching points. I will describe it as best I can, but I'm not particularly certain where the problem arises. Any help would be hugely appreciated...
My game contains a combat system. The player can click to swing a weapon, and they can only swing again once the original swing has finished. Because I have various events tied to certain branching points, and because I desired a little more control, I have derived UAnimInstance into my own subclass, UCharacterAnimator. This contains a few variables that allow me to control the various states of my characters animation, including bools that say whether or not the player is currently mid-animation, if the animation is interruptible, and various methods for playing and stopping animations. Two in particular I feel are important:
My blueprint looks like this, and is derived from this new subclass (please ignore the bottom right...):
So, when the required branch point is hit, the "End Animation" method (shared above) is fired, and all of the variables (set in the play method) are reset. So far so good.
In this situation, I am testing what would happen if a character attempts a melee attack and is subsequently blocked. They should swing, but when blocked, the animation is stopped (StopAnimation is called) and then a "Knockback" animation is played immediately after (which will prevent them attacking until the animation is over, and prevent them moving). The problem is that the "EndAnimation" branching point for the animation is fired immediately after playing the animation, meaning that the player is free to move and attack again, despite being mid-knockback-animation.
Here is what the game prints out, thanks to the debug text, when trying this functionality:
So, going from the bottom to the top. The hit is blocked, and the animation is stopped, thus the first purple line is printed out immediately. No problem there, although it cannot seem to print the name. However, it then immediately prints out the second line, with the full animation name - even though the branch point has not been met. And then, lastly, EndAnimation is called again by the blueprint, and this time the branch point has actually been met.
So a rough stack of functions would be:
So, can anyone provide any hint into what is going wrong? I can guarantee that the branching points are in the correct places, and on the weapon swing, it gets hit just fine. I am wondering if perhaps branching points are somehow called by the Montage_Stop function?
Any and all help would be greatly appreciated, as the solution to this has really eluded me
asked Jan 06 '15 at 08:31 PM in C++ Programming
Follow this question
Once you sign in you will be able to subscribe for any updates here