How to make AI run awy from first person character

Hey so I’m making a game where you gotta chase down some ai skate boarders and taze them. but I’m not sure how to make them skate away from me? does anyone have any good tutorial on how to do this? Here is a video of my game Thrasher 2 | Opposing Force : Developement update - YouTube
the skaters are going to be goofy ps1 characters like this Little Edy | adult swim smalls - YouTube so I don’t even need a run animation they just gotta move away and have the skateboard point in the right direction.

Thanks in advanced

You can start by implementing this and tweaking the values to suit your needs.

Hey thanks for getting back to me, so I’ve done this but it’s not working, I think i have the wrong blueprint class and I can’t tell which one he has? I’m using a pawn actor

You need to use the Character actor, they have walking, running, jumping, and swimming.
Pawns do not.

You could make it work with a sensing Pawn if simplicity is what you’re after:

Add Navmesh, show it to ensure it looks OK:


But Characters are more versatile, for sure.

2 Likes

I think this is what i want, it’d be super basic. is there a tutorial on it. or you could tell me the steps and I think i can follow.
Thanks dude

Hey I tried it but I can’t get it to work? what blueprint class are you using? I used the third person character and deleted the blueprints. here’s what I’ve got…





a step by step might be easier than trying to figue out where I messed up haha

What node is that I marked here? I know its a vector and multiplication. But I can’t find a vector multiplication node that lets you just have one typed in input number.

You can find the vector × float node in UE4. In UE5 you can right click pins to change types. Or drag wires onto pins to autoconvert.

@kimmyjimmle you’ll need to make a choice. Use Pawns or Chars. Adding a floating movement comp to a character that already has a movement comp will not work well.

There are no steps, that’s all there is. I used a Pawn since you said you were using one, too.

2 Likes

Ok, found it, thanks!

Hey I made a blueprint pawn class and implemented what it looks like you’ve done but the best I could do was get the box to chase me?


so I went into the floating pawn movement changed the acceleration max speed to a minus value but it just floats away and disappears.
I did notice the value said 0 on the last node to the simple move to.

here’s my step by step:
1)create a pawn blueprint class
2)add a pawn sensing and floating pawn movement
3)create these nodes.


4)create nav mesh bounds
5)test and nothing happens get this error

6) add this and now the box comes towards me

7) go into floating pawn movement and minus the numbers and it floats away in the sky.

if you could polease tell me what i’ve messed up that would be greatly appreciated.
Thanks so much :slight_smile:

Not to hijack your thread, but I noticed this thread the other day. I have been working on a Beat Em Up template. And I stiil am unsure exactly how the enemies move on most of the classic BEU’s. I saw this and immediately thought of how the enemies walk on the classic arcade BEU, P.O.W.

They walk to the player, attack, and immediately fall back about 10 feet then approach again to attack.

I tried that out, and it works pretty good. Stuck it in the midst of the enemy attack code.

So essentially, I have been wanting to do the opposite, make the enemies approach the player, and once they get within “sweep distance” (you MK players out there know what I mean.) they will attack the player. Here is the code to get them to come to the player.

So after my enemy attacks, I am activating a timer which drives the move backward stuff for X amount of seconds, in which a delay then fires a pulse to clear and invalidate timer thus rendering that walk backward timer null.

The problem is the animations don’t seem to react correctly, when they walk backwards. Probably because they are using 1D blendspaces.

But it did create an interesting effect. Sort of a two player tag-team up on player one. I’m guessing the BEU’s used many of these things to create a more fluid experience.

1 Like

Correction, they were actually 2D blendspaces. When I remade the enemy using a 1D blend space and set the max speed to 100. It actually looks right now.

1 Like

Hey sorry to message you again but I’m still stuck I can’t get it working. Could you please check my message above and see if there’s any steps i screwed up with?
All the best!

I just made a third person project in UE5. I duplicated the third person character blueprint and called it “Enemy”, and dragged into the world.

I then went to the components and selected the enemies capsule component and ticked “generate hit events”.

I then created a boolean variable called “TagYoureIt?”

And used the following code -

I then went into my third person character bp, and went to character movement component and set my max walk speed to 1000.

The result of this simple “Tag You’re It!!!” game can be seen in the following video.

When you are it, the player runs away from you, when you are not it the player runs to you to tag you. This is not using the typical AI way and I noticed the enemy did not try to jump obstacles to get to me. Whereas, I think if I had used a nav mesh and then the move AI to node it would have.

I am curious as to the effect at the end of this video where I stand still and the enemy tags me then moves away, and at the speed of that delay node (I found adding that seemed to make it work better) then turns back and turned to me and tagged me over and over and over… If the enemy would keep on running away after the tag then this simple game of tag would work almost perfect.

I might try the other way with nav mesh and all that later to note the differences. Hope this helps.