How i can make the enemy follow you without beign dumb?

Like, how i can make the enemy dont get stuck? Im using rpg maker mv, but i find this script... But it is to Vxace.
The script:
Code:
move_toward_player if self.x.between?($game_player.x - 3, $game_player.x + 3) &&  self.y.between?($game_player.y - 3, $game_player.y + 3)
You can do something like this in event commands, if it's a parallel event. Just use Control Variable to get the coordinates of the player, compare them to the coordinates of the event, and execute a move route with move toward player if it falls in your range.

Aside from that, it's probably easiest to use a plugin - for example, Yanfly's Event Chase Player which allows you to configure the chasing range and such.
additionally there are plugins to add advanced pathfinding scripts to the engine - those will help on complex maps where the movement toward the player can be labyrinthic.

Original thread: https://forums.rpgmakerweb.com/threads/how-i-can-make-the-enemy-follow-you-without-beign-dumb.162055/