Abort current animation in state machine

Is there anyway to abort an animation/state within an state machine?
I have created the following state machines in an Animation Blueprint:

Now, The Moving state contains 3 different animations in a blend space (Idle, Walk and Run), The attack holds one animation and the same for Shaking.
The problem is that if the “Attacking” state should be fired and the “Shaking” animation is currently being played, the “Shaking” animation should stop so it can fire the “Attacking” state instead.

Does anyone know if this is possible?

Within the character blueprint (which is using this BP animation) the shaking state gets set randomly, but as soon a target is within sight the Attacking state gets fired, which means that it can happend in the middle of the “Shaking” state.

Thanks for any tips!

Ha! I do have the same doubt. Waiting for an answer.

I managed to fix it like this:

In the Character blueprint the AI can attack and chase the player. In this case I don’t want to stay in the current transition. So in the transition itself I check the value of these variables.
The variables are updated by the Blueprint Update Animation event:

I highly recommend watching this video with Wes Bunn as well as an alternative (better) way to do it Character Animation in UE4 | Live Training | Unreal Engine Livestream - YouTube

I managed to solve the problem in my case. Hope the answer works in your and others case!

I’m sure you’ve moved on from this problem by now, but looking at the top image I see a lot of “== true” nodes. Those are redundant. Their output will always be the same as their input, so you can get rid of them and just connect all of your boolean inputs and outputs straight to the “OR” node.