How to make NPC see player in their line of sight?

I want to make a event where if the NPC see's the player they have a exclamation mark above their head and the player has to hide quickly behind something so they try to trick the NPC into thinking their not actually there. And they have a time limit to hide or else they are spotted. 

I need help in trying to figure out how to create this event so the NPC has a line of vision. 
Is the event mobile or stays at the same spot?
Is the event mobile or stays at the same spot?

It is mobile but if it would be easier I can make it stay in the same spot. Do you know how to help me?
Well, if it stays at the same spot, you would first need to make a parallel process event storing the coordinates of the player. For this, open "control variables" , choose Game data, open the game data menu and then there select "character", "player", "map X" and then "map Y" for a second variable.


You will need to use conditional branches to check if the character's position is within the area of sight of your event or not using the two variables created in the parallel process.


I'm answering quickly because I'm on the run right now, if it's not clear enough let me know I'll clarify when I have a bit more free time 🙂.
Well, if it stays at the same spot, you would first need to make a parallel process event storing the coordinates of the player. For this, open "control variables" , choose Game data, open the game data menu and then there select "character", "player", "map X" and then "map Y" for a second variable.


You will need to use conditional branches to check if the character's position is within the area of sight of your event or not using the two variables created in the parallel process.


I'm answering quickly because I'm on the run right now, if it's not clear enough let me know I'll clarify when I have a bit more free time 🙂.

Okay thank you! It works great. 
You're welcome! 🙂

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-npc-see-player-in-their-line-of-sight.59181/