Moving PlayerCharacter in Blueprint

I want the player character to move itself on closest enemy but want myself to control other things via buttons. How can I move it? AIMoveTo and SimpleMoveTo nodes doesn’t work or I couldn’t make it work.

What I want is very similar to this: Nonstop Knight Gameplay IOS / Android - YouTube

In this game, character moves itself and player only uses skills.

Depends what you mean by “move” itself. From the video I can’t tell if the player does or doesn’t have actual control over the character. However, two things come to mind, splines…and having some sort of automatic enemy selection and move to script.

For spline movement you can try something like this tutorial I made a while back.

For the other idea, you would have to implement blueprint logic to “locate” and enemy, use something like a “set world location” node and “lerp” node with a timeline or timer to get the player to head in certain directions.

in your case i would setup your character as an ai. you could basically set it up as you would normally but just never posses it. then its main functions you just setup as custom events. so you could have an event for finding the enemy, moving, and attacking. then you could just call these events from the player controller or the level bp. imagine a rts style game where you have a god perspective, select unit → decide action (attack, move, etc). its basically the same thing except you only have one unit. doing things in this manner enables you to use things like the aiMoveTo node which makes movement super simple (remember to have a nav mesh). ang by using custom events it makes it easy to automate certain tasks like having the character move to the next enemy when the current target dies.

below is a little setup i used to test this. the first picture shows the script in the players character to find the closest enemy and then use a AIMoveTo to move to the enemies location. the second picture shows the level bp and the buttons i was using for testing to trigger the events in the player character.

Thank you for your detailed answer. How can I use AI’s camera as the game camera when it’s not possessed? What should I choose as DefaultCharacter on GameMode?

Thank you!

for the default pawn you dont need to set it to anything, or rather you set it to none. that should work just fine. as for the camera im not 100% sure on the best method but you could use a set view target on begin play on the character. or you could implement a camera from the level. are you going for the same isometric view as the video?

Yes exactly. And I figured out the camera with the target blend.

I’m gonna test the closest enemy movement. Thank you again.

Works perfectly! Thank you so much!