Greetings!
I have seen some plugin to use LoS (line of sight) on RPG Maker MV with NPCs but non that handles this for the player character.
So, what I'm looking for?
I would like to have a sniper on my actors party. The problem is, normaly I can execute events if my actor is beside other characters (events). But what if my character is some tiles away from the target? Now I need a line of sight to check if my character can see the target.
Okay, now I have begun to write a little plugin to do the job. At the moment, it's very basic so I would like to know, if there are some things I should add or consider.
To mark an event to be checked on the line of sight, you can write "<LoS>" on the event note. Without this note, it's a normal event as you know.
To break the line of sight, you can use regions. Right now, only region #1 is hard coded as a barrier the actor can't look through.
At the Moment there are 3 functions on the plugin you can use. Every function has a "distance" parameter for the visual range of the players character.
I have made a little video to show how it works. If the player character can see one ot the 3 enemies a balloon will shown above the players actor. To visualize the viewing range I show an overlay above the player.
As you can see, the little horned red hair is covered by the trees at first. But if the player as close enough he can see the red hair. If the player looks up, he can't see the red hair behind.
On the wall, the black guard is close enough but the player can't see through. But if the player walks around, the guard is vissible.
One idea would be to check the walking direction too. So if a player stands in top of a roof or a cliff he could see another person on the ground but not inverse.
Another option would be a semitransparent wall. This will not block the sight completely but it will reduce the range.
I have seen some plugin to use LoS (line of sight) on RPG Maker MV with NPCs but non that handles this for the player character.
So, what I'm looking for?
I would like to have a sniper on my actors party. The problem is, normaly I can execute events if my actor is beside other characters (events). But what if my character is some tiles away from the target? Now I need a line of sight to check if my character can see the target.
Okay, now I have begun to write a little plugin to do the job. At the moment, it's very basic so I would like to know, if there are some things I should add or consider.
To mark an event to be checked on the line of sight, you can write "<LoS>" on the event note. Without this note, it's a normal event as you know.
To break the line of sight, you can use regions. Right now, only region #1 is hard coded as a barrier the actor can't look through.
At the Moment there are 3 functions on the plugin you can use. Every function has a "distance" parameter for the visual range of the players character.
- inDistance: This will only check if a <LoS> event is in the distance around the player. No direction check, no region check.
- inDirection: This will check if a <LoS> event is the distance and direction (in front of) the player, but there is no region check. "In front of" the player is a half circle in the player direction.
- seen: As an expansion of the last function this will use the region check too. So it's possible to hide an event behind a wall or tree.
I have made a little video to show how it works. If the player character can see one ot the 3 enemies a balloon will shown above the players actor. To visualize the viewing range I show an overlay above the player.
As you can see, the little horned red hair is covered by the trees at first. But if the player as close enough he can see the red hair. If the player looks up, he can't see the red hair behind.
On the wall, the black guard is close enough but the player can't see through. But if the player walks around, the guard is vissible.
One idea would be to check the walking direction too. So if a player stands in top of a roof or a cliff he could see another person on the ground but not inverse.
Another option would be a semitransparent wall. This will not block the sight completely but it will reduce the range.