How can a use Blueprint to make vehicle AI that follow the player vehicle?

Making a game in which i need the vehicle AI to go to the player location. I want the AI vehicles to be able to smash into the player vehicle and cause damage. So far I have had limited success using the available tutorials. I tried adapting character AI tutorials but adjusting the procedure to fit a vehicle game caused issues.

Add this in the Wheeled vehicle blueprint.

Thank you. I’m quite the novice - I am using the advanced vehicle template, what other things do i need to have set up on the wheeled vehicle blueprint to get this code running (e.g. collisions, variables, etc.)

That should be it. Duplicate the advanced car blueprint (name it AICar or something), in the new car, add that logic, and instead of the target node, place a reference to the car the user is driving. That should make the AICar follow the player car.

Not sure if I am referencing right. Made a public actor reference variable and set it to vehicle blueprint which is the default player and the AI vehicle just drives elsewhere :s ?

When you’re not sure, use logs. The “Log Text” node prints stuff on screen. From the target node you can get “name” and “world location”. Print those on screen and make sure they have the expected values.

Struggling to use the debugging tools. Iv directly referenced the character and it still doesn’t work. Not quite sure what I am missing :s. Need this mechanic as I am making a pursuit game and need to start making assets haha.

As you can see in the error messages “Accessed None trying to read property Player…”. That means Player is null. That means you have a variable called Player, but it has no value. It does not point to anything. It should point to your player.
In the left side of capture.png, you have your variables tab and there you have your variable “player”. Press the grey eye icon next to it. This will make it accessible from the details panel in the game viewport. Go there and you should see a drop down where you can select a value for it. Assign the other car (player’s car) in the scene.

Managed to get it working by starting game and making my own vehicle rather than modifying the advanced vehicle template. Thank you so much for your help :slight_smile:

Is the node with . from two vectors2d the same as dot node in UE4.18 ?

*edit, i used a dot product where the " . " node is (because i still dont know what that . is) and reversed the locations of player character and the vehicle, so i made vehicle location - player location and now it goes to player (whereas before it was going in the exact opposite direction)…

old question: same question as jjwisniewka… wahts that " . " node stand for

is there any better way now short way please update its 2021 thanks

yeah Lost at the . ?

where the . converts 2 vector2d to the float ?? where do get that ??

dot