MV Line of Sight detection for On-Map Encounters

I'm working on a game in RMMV that uses on-map encounters. Recently, I finished a level that stealth mechanics, which is to say it was populated with enemies that follow patrol routes that can be avoided by staying out of their line of sight. I really like idea and it tested well, although most plugins I've tried have problems that I have some trouble working around.

What I want to do is to list off all the ones I've tried (as a resource for anyone else reading this) and so I can solicit advice and plugin suggestions and hopefully figure something out.

Event Chase Player (YEP)
This is the first one I used. I was fairly happy with it, but I quickly realized that enemies can see through walls. Event Chase Stealth allows you to define region IDs that will hide the player from detection, unless you're both inside the same region. Stealth regions do not obstruct line of sight like I was hoping. Also, any event chasing you will immediately give up if you enter a stealth region.

While using this plugin, I set up enemy events such that they initiate a battle on event touch. They would patrol around and chase you when they spotted you. If you defeat them, they're gone forever. If you escape, they will become transparent and just stand still for a few seconds, giving you enough time to run away before they spot you again.

All of this is handled on one event which makes it very easy to add new encounters or change existing ones.

Galv's Event Detectors
This one seems really promising, except it isn't really compatible with movement routes. Which is a shame, because this plugin allows you to define exactly what types of terrain will obstruct line of sight or not. So I didn't mess with it much after realizing that.

Bomblord's "Line Of Sight" plugin
Extremely basic. Any non-passable tile will obstruct line of sight, which can lead to some weirdness like hiding behind a non-passable fence. I would be more than happy to work around that but I can't figure out a simple way to allow players to flee without immediately starting the battle all over again. I'm sure it's possible, but I don't know if it's possible to solve that issue and still keep things simple.

caethyril's Line of Sight
Very configurable. This one appears to be directly compatible with EventChasePlayer — in that it can replace that plugin's sight checks system with its own — which is promising. I tested it briefly, not entirely sure if it works right and neither is the author from the looks of it. Will try again when I have more time.

Gimmer_SpottingPlayers
Haven't tried this one. Looks like it might specifically be geared for something not unlike that scene in OoT where you have to sneak into the castle, but it might be usable. I fear it might have similar problems to Bomblord's plugin. Again will try to test when I have a bit more time.

So that's all I know. If anyone knows any other plugins for me to try, or any suggestions, or maybe even just useful
threads to point me and others in the right direction I'd be very grateful. But for now I have to go.
I'm working on a game in RMMV that uses on-map encounters. Recently, I finished a level that stealth mechanics, which is to say it was populated with enemies that follow patrol routes that can be avoided by staying out of their line of sight. I really like idea and it tested well, although most plugins I've tried have problems that I have some trouble working around.

What I want to do is to list off all the ones I've tried (as a resource for anyone else reading this) and so I can solicit advice and plugin suggestions and hopefully figure something out.

Event Chase Player (YEP)
This is the first one I used. I was fairly happy with it, but I quickly realized that enemies can see through walls. Event Chase Stealth allows you to define region IDs that will hide the player from detection, unless you're both inside the same region. Stealth regions do not obstruct line of sight like I was hoping. Also, any event chasing you will immediately give up if you enter a stealth region.

While using this plugin, I set up enemy events such that they initiate a battle on event touch. They would patrol around and chase you when they spotted you. If you defeat them, they're gone forever. If you escape, they will become transparent and just stand still for a few seconds, giving you enough time to run away before they spot you again.

All of this is handled on one event which makes it very easy to add new encounters or change existing ones.

Galv's Event Detectors
This one seems really promising, except it isn't really compatible with movement routes. Which is a shame, because this plugin allows you to define exactly what types of terrain will obstruct line of sight or not. So I didn't mess with it much after realizing that.

Bomblord's "Line Of Sight" plugin
Extremely basic. Any non-passable tile will obstruct line of sight, which can lead to some weirdness like hiding behind a non-passable fence. I would be more than happy to work around that but I can't figure out a simple way to allow players to flee without immediately starting the battle all over again. I'm sure it's possible, but I don't know if it's possible to solve that issue and still keep things simple.

caethyril's Line of Sight
Very configurable. This one appears to be directly compatible with EventChasePlayer — in that it can replace that plugin's sight checks system with its own — which is promising. I tested it briefly, not entirely sure if it works right and neither is the author from the looks of it. Will try again when I have more time.

Gimmer_SpottingPlayers
Haven't tried this one. Looks like it might specifically be geared for something not unlike that scene in OoT where you have to sneak into the castle, but it might be usable. I fear it might have similar problems to Bomblord's plugin. Again will try to test when I have a bit more time.

So that's all I know. If anyone knows any other plugins for me to try, or any suggestions, or maybe even just useful
threads to point me and others in the right direction I'd be very grateful. But for now I have to go.

Have you tried to use Vlue's Proximity Events for MV?

It allows for cone of sight vision for enemies, though you have to tag them as Parallel Processing for it to work properly.

Example: You'd need to set up a conditional branch in the parallel processing event that checks if the player is in the enemy's sights.

Proximity.inprox_d(27, 3, true)

This, for example, would allow Event 27 to see you three tiles away if you wind up in a direction where it's looking.

You have to tag the event with their id number, as well as set the end to be third option to be "true" as that's what controls the line of sight functionality.

By default enemies cannot see you through walls unless you tag the walls as "transparent" with the transparent region function that comes with Proximity Events.

... Optimally you should also put 10 or so frames of wait below the conditional branch if you plan to have many overworld enemies that function like this, as it reduces lag.
No, I had never even heard of it before today. Seems simple but powerful... very promising. I'll check it out!
Gimmer one is really nice and it can look through or not through walls.
ideal for big tree's.

as it has 1 line, I dont know the entire mechanic you looking for.

Ocram_Lights for example has a similair part, if you enter into the light,
you will be detected, cannot say for the setup as I dont use it.

but there are some ways, mog hunter might have 1 as well, but others
can flip a switch when detected.
Vlue's Proximity Events really seemed to do the trick. I wish it was possible to specifically reduce how far they can see vertically, since that would play nicely with the fact that the game window is significantly wider than it is tall. I'm not particularly a programmer but I might just work up the courage to do it myself one day. But it's really not neccesary since even without it, I'm happy with how it works and I think it will playtest well.

Enemies will follow patrol routes. If they spot you, the battle immediately initiates. I much prefer this as it is simpler, more challenging, and doesn't muck up the patrol routes if they stray too far away. If you defeat the enemy, it is gone forever. If you run away, the enemy will turn transparent and wait for 6 seconds to give you time to run away, so that combat doesn't immediately begin again. You can also walk through them so it's impossible to get stuck.

First I created two common events, one called "Spotted"...
Code:
◆Play SE:Stare (90, 130, 0)
◆Set Movement Route:This Event
:                  :◇Wait:60 frames
◆Comment:prevents the enemy from continuing their patrols while the battle initiates
◆Show Balloon Icon:This Event, Exclamation
...and another called, "Escaped".
Code:
◆Set Movement Route:This Event (Wait)
:                  :◇Through ON
:                  :◇Opacity:170
:                  :◇Wait:360 frames
:                  :◇Opacity:255
:                  :◇Through OFF
Enemy event pages are set to parallel and look like this:
Code:
◆If:Script:Proximity.inprox_d(this._eventId, 5, true)
  ◆Common Event:Spotted
  ◆Battle Processing:Combat Drone
  :If Win
    ◆Control Self Switch:A = ON
    ◆
  :If Escape
    ◆Common Event:Escaped
    ◆
  :End
  ◆
:End
◆Wait:10 frames
...and they will patrol using a custom autonomous movement route. When Self Switch A is on they just switch to a blank event page. You could probably add a stealthy takedown fairly easily by moving this logic onto a seperate event and putting the relevant sneak attack logic onto the event itself.
you might be able to do that, when you check "face directions first".

if face down || face UP (down OR up)
than Proximity.inprox_d.....
else if facing LEFT || RIGHT (best check the scriptcall for this)
end
end

and that should do the trick though ^^
you might need to test to make sure though.
◆If:Script:Proximity.inprox_d(this._eventId, 5, true) ◆Common Event:Spotted ◆Battle Processing:Combat Drone :If Win ◆Control Self Switch:A = ON ◆ :If Escape ◆Common Event:Escaped ◆ :End ◆ :End ◆Wait:10 frames
Is this working with you? Cause Is not working with me... 🙁
Is this working with you? Cause Is not working with me... 🙁
it works. what's it doing for you? can you show me the event page?
it works. what's it doing for you? can you show me the event page?
I solved, thank you!

Original thread: https://forums.rpgmakerweb.com/threads/line-of-sight-detection-for-on-map-encounters.154700/