What is wrong with my combat system logic?

I’m a n00b at blueprints so I can’t figure out what is wrong here:

I’m trying to make an attack system with input buffering:

So in C++ I respond to gamepad input and save them in a int32:

33349-cpp_src.png

In my animation blueprint I have the following event graph:

What I try to do is call GetBufferedAttack to see if it is non-zero (meaning a button was pressed) and if so save it and call ClearAttackBuffer

Finally I respond to 2 notifies that are supposed to clear the PendingAttack variable when some attack state is entered:

In the state-machine I go from Idle to DashAttack if PendingAttack variable is 2 (1 for StabAttack)

This almost works. I can go to each attack from Idle and back, and also buffer up the other attack while an attack is playing.

But I can’t buffer up the same attack to be played again (later) while it is currently playing!

So what am I missing?

What is the “out” condition of your attack states.

Also what’s the visual feedback. Is you animation stuck in the attack pose, idle pose ?

My guess at this point is this would have something to do with your state going back to idle, your buffered action is already set, so your condition to go to the same state is valid and the anim graph goes back to playing the same anim again without the anim end notify.

Thanks, the problem was like you guessed; that it would go back to the animation again without resetting/restarting it as the transitions unexpectedly are set to take 0.2 secs for doing blending. So I had to add an extra animation state

I don’t know if there’s a proper way to do this, but i’ll copy the part that lead you to the answer here so you can accept it and close this question

Thanks

  • Marc

What is the “out” condition of your attack states.

Also what’s the visual feedback. Is you animation stuck in the attack pose, idle pose ?

My guess at this point is this would have something to do with your state going back to idle, your buffered action is already set, so your condition to go to the same state is valid and the anim graph goes back to playing the same anim again without the anim end notify.