Ai getting distance to player pawn

I’m trying to make several NPC pawns follow my playing pawn and at different ranges to the player the npc will do different things, Like if they’re too far away they might sprint to catch up, or if theyre close enough to the player they might try to duck into cover or something, I know theres a bout a billion way to accomplish this, i just dont understand why the way im doing it doesnt work. WHat i have is a get distance node that compares the npc pawns to the player on the surface it works exactly as youd think… but then i noticed that the npc folower distance is always compared to the distance from the original spawn of the actor… i couldnt seem to find the work aroudns i’d expect, my question is what im i missing? and given the context of what im trying to do is this the way to go?

Wow such a simple thing for me to overlook, thank you very much for pointing that out!!! :slight_smile:

No worries, it’s always the simple things! Glad it helped :slight_smile:

Is the event/distance between player pawn being updated or checked every tick or just called once?

If it’s just called once, say on event begin play, then it will find the position only the one time and store that as the location to head towards. You’d need to make sure your ‘Event receive execute’ and position of the player is being checked every frame to keep updating the position of the player so the ai can keep updating the position it needs to head towards.