How to impliment stealth mechanics?

So, I want to formulate a simple stealth system into my game. (Enemies wandering around with field of view indicators that result in a loss when seen.)

Any reccomendations on how to pull this off? Because I'm sadly drawing a blank. (Would LOVE if it were just a simple plugin or something.)
This is extremely difficult to pull off correctly, because the engine has absolutely no help for that.

Yanfly has a plugin that allows an event to react to the player coming into a certain distance. That might be a start, but it is very limited from what I remember.
I don't have the link, you'll have to check his main list for yourself.
well, there's a few ways.

-You can implement a constant check for if the player is running, and if they're, immediately make them get caught(since running makes noise). To make that, you can use $gamePlayer.isDashing() inside a parallel process event.
-check if the event is looking at the player
-then check distance between event and player on top of it(use $gameMap.distance($gamePlayer._x, $gamePlayer._y, yourevent_x, yourevent_y). If they're closer than say 3-4 tiles, they're caught or the event walks towards them, and if it touches them its game over.

Also, due all respect to andar, its not a extremely difficult thing to pull off. Most things aren't. You just need to plan and think about what you want to do and break it into smaller, simpler parts.


More useful scripts:

So, I want to formulate a simple stealth system into my game. (Enemies wandering around with field of view indicators that result in a loss when seen.)

Any reccomendations on how to pull this off? Because I'm sadly drawing a blank. (Would LOVE if it were just a simple plugin or something.)

There are two plugins I've been trying out for this - first is Yanfly's Event Chase Player and Event Chase Stealth extension. Event Chase Player lets you set Movement Routes on events, generally as part of a custom move route, which will make the event either chase or run away from the player once it comes within range (with an option for if the event needs to see the player or not). The Chase Stealth extension lets you trigger a "stealth mode" for the player to make it undetectable whilst it lasts.

The other one is Mankind's Player Sensor plugin (there's a video example of it in action on this tweet thread). This lets you put a notetag on events to designate them as sensors - you can choose if you want them to be able to see just in a straight line, in a triangle shape, or in a D shape, what range, and whether they can see through walls or not. You can then run a script to make any event with the notetag start or finish searching. It will display a line of sight for each event that is searching, and if they spot the player it will cause them to turn on a Self Switch (of your choice), and turn it off again once they lose line of sight to the player. You can then obviously use the Self Switched Event page to decide what you want to happen next (i.e. they could start chasing the player, or instantly catch them, or whatever).
Here is a useful Thread about different kinds of Line of Sight possibilities.
The other one is Mankind's Player Sensor plugin (there's a video example of it in action on this tweet thread). This lets you put a notetag on events to designate them as sensors - you can choose if you want them to be able to see just in a straight line, in a triangle shape, or in a D shape, what range, and whether they can see through walls or not. You can then run a script to make any event with the notetag start or finish searching. It will display a line of sight for each event that is searching, and if they spot the player it will cause them to turn on a Self Switch (of your choice), and turn it off again once they lose line of sight to the player. You can then obviously use the Self Switched Event page to decide what you want to happen next (i.e. they could start chasing the player, or instantly catch them, or whatever).
This looks good, but... forgive my ignorance, will the fact that this is a Japanese plugin effect it's usage?

Like, will I need to imput in Japanese command codes or something to make it work?
that this is a Japanese plugin effect it's usage?
only in sofar as you need to understand the plugins instruction and help, and use the commands invented by the plugin programmer.

the data structures themselves are language-independent and always the same.
This looks good, but... forgive my ignorance, will the fact that this is a Japanese plugin effect it's usage?

Like, will I need to imput in Japanese command codes or something to make it work?
There shouldn't be any issues - I've been using Google Translate to read the help file - and all the Plugin commands and Notetags it uses seem to be in English.
There shouldn't be any issues - I've been using Google Translate to read the help file - and all the Plugin commands and Notetags it uses seem to be in English.
Mind a little tutorial then? All I'm trying to do here for the record, is the following...

Cone shaped FOV (1-3-3 shape)

The player being caught activates an autoplay event.

Guard characters controlled via their normal movement pattern control.

Sorry to to get so specific, it's just clear you have experience in this field, and would love some help in this regard.
Mind a little tutorial then? All I'm trying to do here for the record, is the following...

Cone shaped FOV (1-3-3 shape)

The player being caught activates an autoplay event.

Guard characters controlled via their normal movement pattern control.

Sorry to to get so specific, it's just clear you have experience in this field, and would love some help in this regard.
So, if you're using the Player Sensor plugin, you'd go in to each of your Guards and add the Notetag to the event <PsensorF:3>.

Then run the plugin command PSS start somewhere on the same map (say, in an autorun event that turns itself off after) and the guards will be activated. Run the plugin command PSS stop if you want them to stop searching again.

deo4nUv.png
8J5wSzB.png


In the Plugin Settings, the top option lets you select a letter A, B, C or D - this will be the Self Switch that the guards will turn on if they see you.

Iq0scNe.png


So set it to, say, D, then in your Guard event add a page with the condition Self Switch D is on, set it to Autorun, and event out your capture event in there.

aeswmbT.png
6saAW65.png


One issue I did find is that having a lot of guards on the same map caused some significant lag (I think I had more than 30 on the same map...). If you have this problem, the solution I used was to split my map up into chunks, and only activate certain guards when I was close enough, so they're not all searching at once. To do this, for the guard Notetag use <!PsensorF:3> instead (with an ! mark). This will stop the guard searching even when you use PSS start. Then, when you want to activate specific guards, use a script call and write something like
$gameSystem.onSensor(2);
$gameSystem.offSensor(4);
(where the 2 and 4 are the Event IDs of guards I am turning on and off from searching).

Hopefully that all makes sense!
I get the idea... but it's not working, sadly. Nothing is happening.

Here's some screenshots. Maybe you'll know what's wrong?
Your Event 8 (to turn the PSS on) doesn't have the condition "Self Switch A" ticked on page 2 - that means it will only check page 2, so it's never turning on the sensors. Just need to add the condition "Self Switch A on" to page 2 of that event and see if it works then.
Your Event 8 (to turn the PSS on) doesn't have the condition "Self Switch A" ticked on page 2 - that means it will only check page 2, so it's never turning on the sensors. Just need to add the condition "Self Switch A on" to page 2 of that event and see if it works then.
I always forget to do that when eventing, damn I feel like an idiot.

Thanks for the help. Seems to have fixed things.
So, I want to formulate a simple stealth system into my game. (Enemies wandering around with field of view indicators that result in a loss when seen.)

Any reccomendations on how to pull this off? Because I'm sadly drawing a blank. (Would LOVE if it were just a simple plugin or something.)
Ah stealth mechanics! *cracks fingers*

Do you want instant gameover when seen or some event to happen when you get caught?

If you want a cone-o-vision to be drawn on the events themselves you will need to edit the event sheets OR make a vision cone sheet which will be drawing in front of the npc, the latter will require some eventing to follow the npc's facing while the former is plug and play, but will need to be done PER sprite, which one is up to you, if you want the eventing one i can share you a way to follow the sprite's facing.

If the first question is the event thing, do you want to be chased by the npc who spotted you?

Original thread: https://forums.rpgmakerweb.com/threads/how-to-impliment-stealth-mechanics.154535/