Yanfly EventChaseStealth Plugin how to make events not able to see you through trees

Hello everyone. I'm working with the EventChaseStealth plugin right now and was wondering how I could make it so that enemies can not see you through objects like trees and rocks. I have stealth tiles set up in the passage between me and the bat looking at me in the screenshot and it works just fine there but as soon as I enter the area I'm in in the screenshot the bats from the other area are able to detect me again. I can't put in stealth tiles where my character is because there are enemies in that area and you would just be able to avoid them. I would rather not space out the pathways or add more layers of trees so if someone could tell me how I could make it so that the enemies can not see the character through certain tiles I would really appreciate it.

Screenshot.jpg
I've been tossing around ideas to help you with, an honestly the scope of the script kind of limits you in this case. It's an amazing script, as are all YEP materials, but what you're looking for, as far as I can see, isn't accounted for in Event Chase Player or Event Chase Stealth. However, I believe I have a solution, although it will take a little legwork.


What you need to do is figure out the x and y of the areas you are having problems with. You can see the coordinates in the editor by clicking on the actual tile (Do it from Event mode so you don't have to worry about messing your map layout up in the process ^^ )


Then you can set up limiters using the following calls


$gamePlayer.x      $gamePlayer.y


$gameMap.event(x).x     $gameMap.event(x).y   


I don't know the specific finite details of your map, but what you'll need to do is find a way to, knowing the updated locations of yourself and the enemies, prevent them from seeing you in places you don't think they should. One way I see going about this is by placing a condition that says if 


$gamePlayer.y == (That long horizontal row between the trees) && $gamePlayer.x < (The furthest spot to the right of the area in question) && $gamePlayer.x > (The furthest spot the left of the area in question)


I know that sounds confusing, and if you don't know any scripting it could sound even worse, but what I'm saying is that you're probably gonna have to make unique conditions similar to the ones I mentioned to do something like cause the event in question to turn away from player if you or they are in the appropriate area. 


That's just one way, it's really, really hard to be overly specific without a lot more detail. But what do you think? I'm willing to help work on a solution to make this happen ^^
@standardplayer I have extremely little experience with scripting but it kind of makes sense. My map is in the screenshot below. I'm planning on having 2-5ish enemies in each open area and they are not able to leave these areas or detect you in the passageways which both work fine. The only problem I'm having is when you are in an area and an enemy from a different area sees you because there are no stealth tiles. The sight range of enemies is shown in the screenshot (they aren't able to see in the 1 tile passage since there are stealth tiles there). How would I make it so that enemies from can not see you in areas besides their own?

Screenshot3.jpg

Screenshot2.jpg
Hmm well I actually just came up with an idea, it's a bit of a quick fix and I'm not 1000% sure it will work, but hear me out. 


The stealth regions work in such a way that if the enemy is in the same 'stealth' region as you, it can see you as though you weren't in a stealth region at all. 


So what if you covered entire areas in a  stealth region, so that it was like you weren't in a stealth region at all? There's a reason I'm suggesting this, obviously. 


In your screenshot, you're saying that creature can see in the area you are in, even though he's in what is basically another area. But if the side you were on was covered in stealth region 1, and the area he was in was covered in stealth region 2, then he wouldn't be able to see you, but anything in your area would. 


Does that make sense? I can't see you need anymore than 4 or 5 stealth regions to EVER make something like this work, I honestly think you could pull it off with 3. 


But do you understand what I'm saying? If you're sharing a stealth region with an enemy, it's like you aren't in a stealth region at all, as far as anything in the same region is concerned. But something that's outside of the region or in a different region wouldn't be able to detect you, not unless it was in the same region as you or if you weren't in a stealth region at all and within it's sightline.


Let me know if this isn't helpful, there are other ways to go about it
@standardplayerYou're a genius. Thank you so much!
No problem 😀  I'm sure you know this, but you can still make stealth regions within those regions, just designate and use another stealth region. 


A good example is a dark corridor where you're already hard to detect, but if an enemy is there, you can hide behind a barrel that has another stealth region. Then it's like you're in a stealth region and the enemy isn't. 

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-eventchasestealth-plugin-how-to-make-events-not-able-to-see-you-through-trees.60280/