Event checking if player interacted with it from behind

How do i have an event check if the player interacted with it from behind? Without having to make four eventing pages, one for each direction it will be facing?

I want to make a system where the player can avoid on map battles by maybe knocking out the enemy troop and maybe getting experince or even items they wouldn't get by fighting them in some cases. This can be done by making four event pages and checking if the player is facing the same way the event is when they interact with it, but i want to do something simpler
Page: Locked direction. Save direction of the event using control variables to a variable and compare it to player's. If they're equal, he came from behind. If you need to unlock direction, you can do it theough movement route.
I want it to be on one page and have the event have any kind of movement
Then have a custom move route that always unlocks the facing at the beginning and locks it at the end.
There should be a way to setup conditional branches for that.
I use a similar setup with bookshelves where you just can't interact with it, if you're not facing it.

Spoiler: Screenshots
1.PNG 2.PNG
@Rockenberg what if the event is facing down? I know how to do this with multipule pages, i'm trying to do this with one
It should work the same.

EDIT:
Basically you have the option to make a directional input of up, down, left, or right
@Rockenberg what if the event is facing down? I know how to do this with multipule pages, i'm trying to do this with one
Try something like this in your conditional branch:
Code:
$gameMap.event(this._eventId).direction() == $gamePlayer.direction()

It will check to see if the player and event are facing the same direction.

EDIT: Sorry, didn't realize this was RMAce, my mistake! I'm sure someone could help translate that to Ruby
EDIT: Sorry, didn't realize this was RMAce, my mistake! I'm sure someone could help translate that to Ruby
*scripter hat, on*
Code:
$game_map.events[@event_id].direction == $game_player.direction
@Oddball
I tried to recreate what you were looking for?
Spoiler: Screenshot
2 (1).png


The way @TheoAllen is probably a lot simpler though.
Thank you Theolized! You solved it!

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/event-checking-if-player-interacted-with-it-from-behind.114577/