Check that NPC and Player are Facing the Same Direction

Having a bit of trouble creating an event where, if you approach an NPC face-to-face, they talk normally, but if you approach them from the side or behind, you pickpocket them.

The way I thought to set it up was to have a bunch of conditional branches to check that the NPC and player are facing the same direction - so if the NPC is facing down, check if the player is facing up, do X. Else, do Y. Then check if the NPC is facing up, and again that the player is facing down, and so on. I made a similar multi-check event before with a bunch of nested conditionals in this way (though for that it was checking for switches) so this SHOULD work, even if it looks a bit messy.

The problem is, when you interact with the NPC, of course he turns to face the player...so it'll always see that the NPC and player are facing the same direction. Of course this could be fixed by turning direction fix on, but I want the NPC to be able to walk around normally until the player interacts with them, THEN have it check if they're facing the same direction before deciding the action.

What's the best way to go about this? I tried a few different things with move routes and self-switches but I couldn't get anything to work the way I want it to. Ex. I can't have the first action be a move route with direction fix, because the NPC will already be facing the player just by talking to them. I would like the NPC to be able to move around normally with autonomous movement (which means setting the event to direction fix won't work) but when you interact it should check that they're facing the same direction. I can't think of a way to do that without the event being set to direction fix by default...but then I can't get the NPC to move and walk around like a normal person.

Is this possible and I'm just missing something, or is there no way to do this without just making the NPC static so you always know what direction they'll be facing when the player approaches?
that is what the direction fix option is for - it prevents the event from changing direction toward the player when interacting.

If that NPC walks around, you need to disable it before each move command and reactivate it after the move. You do that in the move route settings, there is a command for that there.
So I'd set the autonomous movement to a custom move route (instead of, say, random) and do something like:

direction fix off
move left
direction fix on
direction fix off
move down
direction fix on

etc? Is that what you mean?
yes, exactly - you can even set the custom autonomous route to random, or if that event is controlled by another one use the set move route command in the same way.
It doesn't seem to be working for me. I set up a test actor with the following:

abQB6St.png

hHhF7KQ.png


When I talk to him, he still turns to face me.
https://forums.rpgmakerweb.com/index.php?threads/disable-npc-lock.17721
After using Shaz no lock script. You can make that this way to check if player and event are facing face-to-face:
Using this script line in Conditional Branch: $game_map.events[@event_id].direction == 10 - $game_player.direction
I used a bunch of nested conditional branches, but that sounds much more efficient!!

I got the no lock script set up and with that + the above-mentioned direction fix-toggling move route everything seems to be working as intended now. Thanks to everyone for the help!!

Original thread: https://forums.rpgmakerweb.com/threads/check-that-npc-and-player-are-facing-the-same-direction.81258/