How to make moving event activate only, when facing player

Hi!


I just started exploring RPG Maker VX Ace and this has been a lot of fun.


I am trying to make an event, that is acting like an enemy. The problem I am struggling with, is that this so-called enemy attacks from every side, but I want it to attack only, when it is facing the player. Since the enemy follows the player it is already facing him, but when I attack from sides or behind, I do not want that event's contest to activate, I have this event as a parallel process. I assume that I need a script for conditional branch that checks, if event is facing character or is there any other way? 
Please show a screenshot of the event - parallel process is usually a sub-optimal solution for something like this, but we need to know what exactly you have done so far to find a solution to your problem.


Usually you always activate but use conditional branches to make effects depending on facing.
I think I have done this whole enemy thing one worst possible way. because I have attacking as separate event. I could not come up with a way how to have independent attacking from the main contents. 


This first conditional branch should trigger my attack event, when I find a solution.


Reaper 1.jpg


This is for respwan


reaper 2.png


This is for attack (don't know if it is important, added just in case)


attack event.jpg


Thank you for quick response!
OK, let's try it from a different direction because yes, those events are a bit off and will cause problems - but I can't even tell what you're trying to do with that.


Please give a short description of what should happen in the game - how the enemy should behave, what should happen if it reaches the player (or at whatever distance) and what the player could do.


Because I have the suspicion that it would be a lot easier to do with 1) event touch instead of parallel and 2) using common events for the rest of the effects.
My goal is to make an enemy which:


1. Starts attacking and approaching me, when I am at specified distance  and is agressive until I move out of the distance. (Enemy's don't need HP)


2. Can only attack, when it's facing the player. (Need to be able to change attack speed and damage value)


3. Player can attack only at specified distance. 


4. Moves in certain region.


The most tricky part for me is to get event attacking the player when this condition is met (Enemy facing player) and


assigning attack speed (that is why i created separate event for attacking and used switch to turn it on).


If this can be achieved with common events I will learn more about using them and try to pull it off.


I hope my goal is clearer now.
Then the attack can simply be done by setting the trigger to event touch - event touch only triggers if the event is moving on the player position, and that automatically means that it is facing that direction. No need for a parallel at all as long as you attack only on contact (no distance weapon on the enemy)


for reaction distance and move restrictions there are already existing plugins which handle that automatically (yanfly made some, perhaps other players)


For the player attack, it's better to use a common event checking the attack button, and then check if there is a target at the correct coordinates - you'll read the player coordinates with control variables and then add/substract the distance depending on player facing.
Thanks, I think I got it now.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-moving-event-activate-only-when-facing-player.60563/