Need help with setting up a Lock On system with Locomotion Change

Hi:) I am pretty new to UE and have no experience with programming at all.
I started by making an 8 directional locomotion system for my character, using the following codes for the character BP and AnimBP;


I wanted to keep that one for when the character is locked on an enemy, and do a normal 1 directional locomotion, so I removed the first codes and used an advanced locomotion system (advanced with start/stop transition animations) following jourverse’s tutorials on YT. This is what it looks like globally on both the 3rd person BP and AnimBP;


Now I’d like to have a switch mechanic between the two, but the code of the former cancel out?/ aren’t compatible with the later, which I guess means I have to find a way to tell the BP which of the 2 codes has to be processed depending on the lockOn condition. And well I don’t know how to do any of that, or if that is even the right thing to do.

Any help if appreciated !!!

Hey @abandonshapes!

So it looks like you’re on the right track. If “Armed” is to enable your lock on animations, then you would plug your “Locked On” anims into True, and then the non-locked-on ones into False (this is typically your Locomotion state machine).

That pose is being output somewhere else in the event graph.

However, you haven’t stated exactly what isn’t working. It would be somewhat difficult to just comb your code without something to look for. Is it just not switching?

Just an idea- Start the game, and then open the AnimBP over on the side. On the top bar there will be a drop down to select any characters currently in the game running this BP- that may help you with your testing for a solution! :slight_smile:

Thank you,

The problem is that I don’t know how to make a switch mechanic on both the AnimBP and the characterBP, since both locomotions use different codes. Moreover they both use different input systems (one uses an enhanced one and the other doesn’t), which I guess means I have to do the switch before any input node…

For example if I were to use the first locomotion’s codes in the CharacterBP with the codes in the event graph of the later, the character doesn’t play any animation at all, or it just doesn’t move.

I just need to know how;
-For the CharacterBP: Switch between two different event possessed that uses 2 different input systems/movement inputs. &
-For the AnimBP: Switch between 2 different locomotion states which use different codes in the event graph.

I’m sorry if I’m being unclear/not making sense hahah…

I will try starting the game with the BP on the side

There are ways, but they are very convoluted. I would suggest finding a way to homogenize the two: Pick either the old (input) or new (enhanced input) system and convert the other to that system. The old system is simpler, enhanced input allows for a lot more wiggle room and options.

For the AnimBP: Switching between two separate locomotion graphs is FAR easier than trying to switch between two modes of input. But you need the character setup first to be able to pull and set variables from the charBP to affect the AnimBP, so start there.

The problem is that in the charBP they overlap and try to fight, as the input is consumed by one therefore doesn’t make it through to the other. Using regular input you can do branching statements based on a bool or enum, and using enhanced input you can use input mapping contexts to do different things based on the current context of use. Such as “A is jump- but in battle A is dodge.” Same thing-different code.