Creating an NPC Threat

I need some help with coding.

I wanted to have an event where an enemy (NPC) "looks" for the player. The npc wouldn't be able to move (he is fixed in the corner of a room) but he would "check" the tiles ahead of him to see if the player was in one of them, and he would approach (much like people do in Pokemon). I don't know the code for that event. It would also be good if there was a way he could then follow the player, the sequence ending when he came within one square of the character (to allow you time to run away). Does anyone think they can help me with this?
I've moved this thread to RGSS3 Script Requests. Please be sure to post your threads in the correct forum next time. Thank you.
Hopefully this might be what you are looking for: https://yanflychannel.wordpress.com/rmvxa/field-scripts/event-chase-player/
TheoAllen's Pathfinding script is the best for this kind of thing.


The above mentioned script will work on open areas, but if the event needs to avoid obstacles in the way, it won't work.
The first one worked well. Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/creating-an-npc-threat.36962/