Stealth Kill and Another Question

Hello!
I want to make a stealth kill mechanism. (something like Tenchu and Metal Gear Solid)
To achieve this effect, I think I'm gonna use conditional branch.
Where the event/enemy will react differently depending on which direction it's facing.
There is something like that, but the choices are only up, down, left, and right.
No choice to determine if the enemy is facing toward the player or away from the player.
Is there any other way to make a stealth kill mechanism?

Another question:
I want to make an event that triggers battle instantly whenever it touches the player.
I've made an event that chase me whenever it sees me. The chase event works well. (using yanfly event chase)
But when the event is standing 1 tile beside me, it stops chasing.
And the battle won't occur unless I manually touch the event.
How to make the event triggers battle instantly?

Sorry if I'm asking too much questions.
Any help will be appreciated. Thanks!
Yanfly's Event Chase Player Plug-in has commands which allow you to determine whether an event can see the player or not. I haven't played around with it all that much, since my game is still in the early stages.

You might also want to take a look at this post by @dbchest. There's also some sort of plug-in linked on that page if you don't want to use the script call.

There might be an easier way to pull off forcing a battle while checking if an event is touching the player. In Ace I used a script call, as part of a conditional branch, which did this. However, I have no idea what the JS code would be which does the same thing.

Hope that helps in some small way. 🙂
this is pretty random; i have been playing "The Evil Within 2" a LOT lately and i am going to make a stealth kill plugin for RPGMV because of that, haha. i will let you know when it is finished if you want to take a look at it.
No choice to determine if the enemy is facing toward the player or away from the player.
look at the function moveTowardCharacter and see how it relates position and direction.

basically, if both are looking at the same direction, whomever is behind the other, is looking *at* the other.
to determine "behind", you evaluate XY position.
@The Stranger: Thanks! That's a useful reference.

@dbchest: I want to know, where do I have to put this code?
$gameMap.event(this._eventId).direction() === $gamePlayer.reverseDir($gamePlayer.direction());
Do I have to put it inside conditional branch?
Anyway, good luck on making the plugin. I'm looking forward to it 😀

@gstv87: Where I can find moveTowardCharacter function?
Yanfly has this plugin, http://yanfly.moe/2016/06/03/yep-105-event-encounter-aid-rpg-maker-mv/, and in the help file is a list of conditions you can use to check if the player is behind the enemy, to the side of the enemy, or the enemy is facing you. I have a stealth game I am working on as well and I use it for "stealth" takedowns that I use a quick time event plugin so the player has to sneak up behind the badguy and if he's behind him, show choices appears and if takedown is selected, the player has to enter a sequence and he chokes the badguy out. If he either fails to input the sequence or the badguy turns, a battle starts and the battles are hard with extremely limited ammo and health recovery. This makes the player want to sneak and use stealth more than just fighting everything.

For your battle problem make the event, event touch not player touch. Then conditional branches to determine what direction it is facing. Also in the event chase plugin, make sure sight is set or they will always Chase you. Another Yanfly plugin to consider is the move route core. You can setup some pretty good routes that way.
You could run a parallel process to check player position in relation to event position, but the plugins mentioned above make it a hell of a lot easier.
@OnslaughtSupply : Thank you! It works like a charm!

One question still remains, though.
I still can't make the battle event triggers automatically when it stand near me.
Even it stopped precisely 1 tile beside me, I have to actively approach the event before the battle start.

Edit:
Apparently I set up the event with player touch. I set it to event touch and now it works wonderfully.
Thanks for all of you! I'm a happy guy now 😀

*the thread can be closed*

Original thread: https://forums.rpgmakerweb.com/threads/stealth-kill-and-another-question.88587/