Put this in a Script command in the event's move route (one command, set move route to repeat):
Code:
var D = 4; var d = $gameMap.distance($gamePlayer.x, $gamePlayer.y, this.x, this.y); if (d > D) this.moveTowardPlayer();
This says "target distance is 4; check distance between player and this event; if distance is more than target, move towards player". Distance is rectilinear, i.e. 1 tile diagonally is distance 2 (1 vertical, 1 horizontal). You can change the "D = 4" bit at the start to whatever distance you like.
🙏
For something more elaborate/stalkery, you could try this:
Code:
var D = 4; var d = $gameMap.distance($gamePlayer.x, $gamePlayer.y, this.x, this.y); this.setMoveSpeed($gamePlayer.realMoveSpeed()); if (d < D) this.moveAwayFromPlayer(); else if (d > D) this.moveTowardPlayer();
This one will match the event's speed to the player's, and make them move away if they're too close. For this one I'd recommend setting the event's move frequency to 5 (Highest), i.e. no pause between moves.