Game over when seen by an event?

Hello, is there a script for a event that when the event direction is looking at you, it instantly runs game over or text?
I don't want it to be stupid.

So for example, i've made a event that is walking on his move route.
If i hide behind something (like a closet that you can't walk in) in front of him, it will still not trigger you.
If you are in front of it with you standing on walkable tile(like grass), it will trigger game over.

Sorry if there's something wrong in the post, the post is hard to understand, or my bad english.
It is possible with eventing but it isn't simple.

Press F7. Set regions to the map.
1 is free air, 2 is an obstacle that player can cover


You need a Conditional Branch that checks if the X is the same with the enemy. IF so...
________ you have to next another Conditional Branch to check if the X of the player is bigger. I if it is...
____ If enemy is facing left then
Game Over

You need a Conditional Branch that checks if the X is the same with the enemy. IF so...
________ you have to next another Conditional Branch to check if the X of the player is smaller I if it is...
____ If enemy is facing right then
Game Over


Do the same for Y axis and Up and Down facing respectively.
This must be checked in a parallel process and you must add a wait(10) on the beginning of that event.

Now imagine that you must add the region in logic.


You need a Conditional Branch that checks if the X is the same with the enemy. IF so...
________ you have to next another Conditional Branch to check if the X of the player is bigger. I if it is...
____ If enemy is facing left then
_______you have to make a loop for all x tiles between you and the enemy.
Conditional branch to check if a region is 2 If so.
___ do nothing
Else
___Game Over
End the branch

Original thread: https://forums.rpgmakerweb.com/threads/game-over-when-seen-by-an-event.94277/