Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Line of Sight

Script Request Template
This is a request for a new script.

Script Title:
Line of sight checker

I was wondering if it would be easy to make a script that can be called from an event to check the line of sight between it and the player. It could check the terrain tags and if
a certain terrain tag is found it would flip a switch.

It seems like something like this might already exist.

Any help would be appreciated
 
Not so sure about the terrain tag thing, but you could just set a parrallel process event that stores the x and y id of the character(in two different variables), and then checks if the character is at x or y line, or both if you prefer. You can also store the x/y id of an event, so that when character is the same x/y as an event, something will be triggered.

However, constantly doing this is not recommended, as the game may possibly lag, but in small doses it's pretty simple. Like I said, though, not so sure about the terrain tag.
 
Near Fantastica made this exact script something like 4 or 5 years ago. It's called View Range script.
If my memory serves me well, DerVVulfman updated the script not long ago.

So simply look for it on the forum or over the internet. It should be pretty easy to find. ;)

Take care!
-Dargor
 
sorry i should be a more specific. I already have a system to check the line of sight as if nothing where in the way. What im tring to do is set up visual blocks so that if a monster is behind a wall he can't see the player.



like in this screenshot it would check the terrian tag of each tile between the player and the monster and when it found the rocks it would flip a switch.

I already have events to do everything else its just i can only check the terrain tag of the spot an event is on. Hell if i could just find a way to check the terrain tag of a spot determined by variables i could do the rest in the event.
 
I took a look at the two links you showed me Dargor and they are just simpler versions of what ive already done. What im trying to add is the ability to BLOCK the line of sight with walls,trees,rocks,ect. So that its not just based on distance and facing. Thanks for your help though.
 
Dargor is indeed correct that I had a more up-to-date version of Near Fantastica's 'Veiw Range' script. That's the way he spelled it... Keeping it that way. And I did some continuous tinkering with it to ensure that objects blocked (walls, events) blocked the line of site properly, and that coming into view triggered the actions properly.

>CLICK for version 3Delta<

I included built in instructions that allow you to use local self-switches and global RMXP switches, as well as being able to control the volume when using the event_sound call. Also, the system's 'view' calls now includes an optional switch so impassable tiles can 'block' the view/detection system.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top