NPC, that chases player at certain speed&range?

  1. What do you want to achieve? i wanna make a npc that detects a player going a certain walking speed.

example:
if players speed over 12 the npc will chase players, and if the speed is under 4, the npc will not chase unless 10 studs near npc

  1. What is the issue? no idea how i should approach this task
  1. Find the closest player
  2. Check Distance and speed
  3. Chase if close enough

EDIT: Scripting an NPC such as this is a complex task! Ordinarily you wanna use OOP and create methods to handle the detection and chasing. Or you could cheese around it and make a part representing the radius, parented to the npc model for detection.

1 Like