Loara

Villager
Member
Joined
Jan 14, 2021
Messages
8
Reaction score
1
First Language
Dutch
Primarily Uses
RMMV
I am working on a project, and I want to add a little stealth section. I am using Yanfly's EventChasePlayer plugin to get the enemies to only react when my player is in their line of sight. However, they don't just look right ahead of them, but also to the side (I think they have a line of sight of 180 degrees). I want the enemies to only notice the player when they are in a straight line in front of them.

Any ideas on how to accomplish that?
 

Zelgadis85

IGMC 17/18 Entrant
Veteran
Joined
Mar 13, 2012
Messages
86
Reaction score
196
First Language
Finnish
Primarily Uses
RMMZ
Something like this springs to my mind: (Note that you need five variables for this)
Code:
Control Variables : #0001 Player X = Map X of Player
Control Variables : #0002 Player Y = Map Y of Player
Control Variables : #0003 Event X = Map X of This Event
Control Variables : #0004 Event Y = Map Y of This Event
Control Variables : #0005 Event Direction = Direction of This Event

If : Event Direction = 2
  Comment: Event facing South
  If : Player X = Event X
    Comment: Same X coordinate
    Set Movement Route : This Event
      :<>Script: this._chaseRange = 4
  End
End

If : Event Direction = 4
  Comment: Event facing West
  If : Player Y = Event Y
    Comment: Same Y coordinate
    Set Movement Route : This Event
      :<>Script: this._chaseRange = 4
  End
End

If : Event Direction = 6
  Comment: Event facing East
  If : Player Y = Event Y
    Comment: Same Y coordinate
    Set Movement Route : This Event
      :<>Script: this._chaseRange = 4
  End
End

If : Event Direction = 8
  Comment: Event facing North
  If : Player X = Event X
    Comment: Same X coordinate
    Set Movement Route : This Event
      :<>Script: this._chaseRange = 4
  End
End

I can't test it right now, but it should work. Someone might have a prettier approach though.
 

Loara

Villager
Member
Joined
Jan 14, 2021
Messages
8
Reaction score
1
First Language
Dutch
Primarily Uses
RMMV
Thanks! I'll try it out
 

Loara

Villager
Member
Joined
Jan 14, 2021
Messages
8
Reaction score
1
First Language
Dutch
Primarily Uses
RMMV
It doesn't seem to be working. I tried putting the event on parallel, but that also doesn't work. I pretty much copied exactly what you suggested, as you can see in the attachments. Also, I would like walls to block the line of sight of the event.
Do you have any ideas on that?
 

Attachments

  • Screenshot 2021-01-21 at 14.35.22.png
    Screenshot 2021-01-21 at 14.35.22.png
    232.8 KB · Views: 4
  • Screenshot 2021-01-21 at 14.35.34.png
    Screenshot 2021-01-21 at 14.35.34.png
    177.1 KB · Views: 4

Zelgadis85

IGMC 17/18 Entrant
Veteran
Joined
Mar 13, 2012
Messages
86
Reaction score
196
First Language
Finnish
Primarily Uses
RMMZ
Hmm, after finding the time to try this out, it indeed seems the plugin forces a 90 degree field of view. I think changing that requires fiddling with the plugin code, but my first attempts at that did not help.

I'm afraid I cannot be of any more help here. Hopefully somebody else will be able to step in.

For reference, I *think* that changing the function Game_Event.prototype.updateChaseDistance might have the answer you're looking for, but as I said, I did not manage to do it. Sorry.

I think the best way to have walls block line of sight might be to use the extension plugin Event Chase Stealth and to fiddle with it's settings, but seeing as it is a paid plugin, you might want to try another approach.
 

Latest Threads

Latest Posts

Latest Profile Posts

Next goal is to make pull & push + lift & throw systems with mouse support and have skill levels in them and action indicators!
>What's your avatar about? Is it yours?
I did not do that drawing. It's a screenshot taken from a comic featuring characters from Touhou such as Tenshi and Iku (the girl in the avatar). It's drawn by someone under the name of Yohane.
Link to the comic (SFW, but navigating around Dynasty Reader is NSFW)
Progress on my game is nearly done, so I figured I show you guys the title screen. I hope you like it!
Title Screen.png
Does this ever happen to anyone?: your making a battle sprite [or any sprite] then when you mess something up you then see it as something diff, then working with it? its hard to say in words but it happens to me all the time
found out how to change pfp, literally there's a hidden thingy on the bottom of it

Forum statistics

Threads
109,167
Messages
1,042,669
Members
141,665
Latest member
beauty143
Top