How to Make an Event Detect Player Proximity

Hi everyone, hope you all are well!

I just stepped into this thread because I am trying to make the same thing in my game, only with a difference: I want the player to be detectable only when a rotating/moving enemy is facing towards him/her (stealth part of the game, of course).
I already tried some solutions, and got some nice-but-not-exactly-what-I-wanted results, but they are complex solutions with a lot of switching/eventing, so I would be glad to hear your suggestions on how to achieve that result easily (or at least: "more easily", sure you all have got better solutions).

Heve a good day!

I've split your post into its own thread, from here:

As you've mentioned, your request is different. You are always welcome to link to other threads that are relevant, like I've done here. 👋

To check facing direction, you can use:
  • Conditional Branch -> Character ___ is facing ___; or
  • Control Variables -> Game Data -> Character -> Direction.
The latter returns a numpad direction: 2 = down, 4 = left, 6 = right, 8 = up.

This allows you to check both proximity (as discussed in the linked thread) and "field of view". E.g. if facing left, a 180-degree FoV check could be "is player X <= this character's X?". You can do other angles with some maths.

If you want to do line-of-sight checks, that's considerably more complicated. Without a plugin, you can use regions to help identify "sight areas", e.g. a room that is mostly region 1, but the area visible from the corridor is region 2; the corridor is all region 2. If you want movable LoS obstacles, though, then I'd definitely suggest a plugin.
You can try Krons AI base
Here an Example to get started...

Var1 set to Event Direction (2,4,6,8)
Var2 set to Player MapX
Var2 - Event MapX
Var3 set to Player MapY
Var3 - Event MapY

If Var1 = 2 (Down)
If Var3 is equal or more 0
If Var3 is equal or less 6
If Var2 is equal or more -1
If Var2 is equal or less 1
in case all are true, than the Event has seen you.
Textbox: I can see you Down there. Wait 180Frames

If Var1 = 4
If Var3 is equal or more -1
If Var3 is equal or less 1
If Var2 is equal or more -6
If Var2 is equal or less 0
in case all are true, than the Event has seen you.
Textbox: I can see you on the Left. Wait 180Frames

If Var1 = 6
If Var3 is equal or more -1
If Var3 is equal or less 1
If Var2 is equal or more 0
If Var2 is equal or less 6
in case all are true, than the Event has seen you.
Textbox: I can see you on the Right. Wait 180Frames

If Var1 = 8
If Var3 is equal or more -6
If Var3 is equal or less 0
If Var2 is equal or more -1
If Var2 is equal or less 1
in case all are true, than the Event has seen you.
Textbox: I can see you Up there. Wait 180Frames

Edit:
This is just one example, depending on the kind of vision shape, there are different calculations.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-an-event-detect-player-proximity.156205/