Surprise / preemptive attack control

Hello there everyone! I am trying to run a touch based encounter system, and for the most part I have this all figured out! (Enemy encounters are not random and are visible to the player. If the player touches the event, the encounter begins). Now, I am stumped on the final part of this system. How would one go about determining a back attack or a preemptive attack? I was trying to do this through eventing (if player is facing down and if this event is facing down make encounter Preemptive) but I would end up with enemies getting a back attack and the player still getting a preemptive attack.


Thanks in advance! 
Hello there everyone! I am trying to run a touch based encounter system, and for the most part I have this all figured out! (Enemy encounters are not random and are visible to the player. If the player touches the event, the encounter begins). Now, I am stumped on the final part of this system. How would one go about determining a back attack or a preemptive attack? I was trying to do this through eventing (if player is facing down and if this event is facing down make encounter Preemptive) but I would end up with enemies getting a back attack and the player still getting a preemptive attack.


Thanks in advance! 

How about this?


Player Facing Down + Enemy Facing Down + Player Right Below Enemy - Surprise


Player Facing Up + Enemy Facing Up + Player Right Above Enemy - Surprise


Player Facing Left + Enemy Facing Left + Player Right At the Left Of The Enemy - Surprise


Player Facing Right + Enemy Facing Right + Player Right At the Right Of The Enemy - Surprise


Conversely:


Player Facing Down + Enemy Facing Down + Player Right Above Enemy - Preemptive


Player Facing Up + Enemy Facing Up + Player Right Below Enemy - Preemptive


Player Facing Left + Enemy Facing Left + Player Right At the Right Of The Enemy - Preemptive


Player Facing Right + Enemy Facing Right + Player Right At the Left Of The Enemy - Preemptive
How about this?


Player Facing Down + Enemy Facing Down + Player Right Below Enemy - Surprise


Player Facing Up + Enemy Facing Up + Player Right Above Enemy - Surprise


Player Facing Left + Enemy Facing Left + Player Right At the Left Of The Enemy - Surprise


Player Facing Right + Enemy Facing Right + Player Right At the Right Of The Enemy - Surprise


Conversely:


Player Facing Down + Enemy Facing Down + Player Right Above Enemy - Preemptive


Player Facing Up + Enemy Facing Up + Player Right Below Enemy - Preemptive


Player Facing Left + Enemy Facing Left + Player Right At the Right Of The Enemy - Preemptive


Player Facing Right + Enemy Facing Right + Player Right At the Left Of The Enemy - Preemptive

Ah see I would do that, except I can't find a way to detect the players position versus the enemies position. I guess I should have stated that the enemies will give chase to the player as well, so X and Y coordinates are constantly changing.
How about using Event Trigger Player Touch/Event Touch?
How about using Event Trigger Player Touch/Event Touch?

I am using that right now in order to trigger a battle on map.
So I've tried tinkering with X and Y variables to follow both the player and the event, This doesn't work well because the event will ALWAYS turn to face the player, negating any sort of direction check in variables. 

Original thread: https://forums.rpgmakerweb.com/threads/surprise-preemptive-attack-control.61240/