Check Player position in relation on event

Hello,

I would be very thankful if some kind soul could give me a clue on this.

I am creating a stealth system where an event play as a guard, turning up/down so you can kill it from behind. I want to create a script call that checks the player position in relation of the event: event.x = player.x

I am not good at scripting, I searched some formulas on the internet but the game crashes. So if a veteran scripter can give me a hint it would be greatly appreciated.

Thanks in advance.
No guarantees, but you might find something to help you in this stealth tutorial
https://forums.rpgmakerweb.com/index.php?threads/stealth-eventing-a-tutorial.35993/
If you are doing something but the game crashes, you have to tell us what that something is before we can help you fix it.

Original thread: https://forums.rpgmakerweb.com/threads/check-player-position-in-relation-on-event.90695/