Save-Point
Veiw Range Script - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+---- Forum: RPGMaker XP (RGSS) Engine (https://www.save-point.org/forum-116.html)
+---- Thread: Veiw Range Script (/thread-2771.html)

Pages: 1 2 3


Veiw Range Script - Near Fantastica - 03-02-2008

Veiw Range Script
Version: 1 & 2
by Jaime 'Near Fantastica' Webster
Not DerVVulfman
and Version: 3 Eta
Edit by DerVVulfman

Features
  • Lets events see the player and interact with it in different ways depending on how close the player is
  • To add this script make a script call it View_Range and add the following into it then call it accordingly with a script call
  • Can handle BGS effects

By the poster
I didn't create the original scripts, and as of now the links that Near Fantastica put up are down (and he can't get to them) and his RMXP system is down.  Given that he posted the original (though broken) demo links here, there should be no problem to post the script.

I tinkered with the system and made a version 3 (still tinkering :) ) that combines the best features of both... and a little more.

Script
View Range v1
View Range v2

And
View Range v3 Eta


Instructions

For version 1

For version 2


For version 3



Take Care,
Near


Enjoy,
Mike aka DerVVulfman


* - * - * - * - * - *

Version 3 Eta
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.


Veiw Range Script - DerVVulfman - 10-23-2009

BUMP
Updated the version 3 edit to Version 3 Delta

The revision fixes a problem whereby enemies/events that can have their view 'blocked' may not properly detect the player coming into view.


Veiw Range Script - samsonite789 - 11-02-2009

I have spent hours upon hours trying to figure out how to fix that exact problem you fixed with the delta version. You have saved my life and sanity.

THANK YOU!!!!!!!


RE: Veiw Range Script - DerVVulfman - 03-06-2012

Ignore all that, and upgrade to View Range v3 Zeta.

Version Epsilon had code in it for both RPGMaker XP and RPGMaker VX dual compatability and fixed a directional error for VX. But Zeta got a working auto-detect for RPGMaker VX that worked.


RE: Veiw Range Script - LilyKnight - 03-07-2012

I am having issues opening the document in open office. IT tries to interpret it as an ascii file and shows gibberish when I open it. However, if I open it in editpad pro, it works fine.

I do wonder if its possible to make types of view. (cone, all around, straight line) and to check for events with a specific comment in them (hostile to certain types of events and afraid of others)


RE: Veiw Range Script - DerVVulfman - 03-31-2012

Meh... Now it's ETA. Yeah, I'm going through the Greek Alphabet.

Autodetect stank. It didn't help if you made a script in RMXP that used a class that VX had and was detecting, so I said the heck with it and made it an on/off switch.




RE: Veiw Range Script - penguwin - 07-12-2013

>_<
D'oh I don't get how to use this script.


RE: Veiw Range Script - DerVVulfman - 07-13-2013

Think of it as an alarm or sensor system.

Place an event on your map and make it... oh, I dunno... a rock. Make the 'trigger' for that rock to be a parallel process so it runs constantly. In the 'Event List' window on the right, you insert a script call command. A script call is where you can run an RGSS script (like view range) instead of your typical move-event/show-text commands. Now with that view range command, you set up a few values like the event's own id, a range and a switch that is turned on.

$view_range.event_view(12, 5, 3)


This example assumes that you are checking a circular range around event #12... for a distance of 5 tiles around it. And if the player is detected in this range, RMXP's switch #3 is turned on.

Oh... and there's a cool system to change audio volumes when you get closer or further from a source.

What you do when Switch #3 is turned on is up to you. You can make a guard ticked off.... a gate closes behind the player... the planet Krypton blows up... etc.


RE: Veiw Range Script - deus69xxx - 08-12-2013

So I was gonna try and keep this from taking up a post slot, but apparently I can't message, send email or anything else as a member lol so...
I slapped in the script (ETA) and filled out the script $view_range.enemies_view(ev_id, v_range, sw_id, s_sw_id, block) with: (1, 8, 60, nil, true). when event 1 detects switch 60 is on, it goes nuts and chases the character, which is fine, but, it's refusing to have LOS blocked by non-passable objects.
I tried true and false, just to make sure there wasn't a typo, and even fully encased the character in impassable wall blocks. still the event goes nuts chasing the character. any input?
also, when trying to use a self switch "a" I get an error "undefined local variable or method for 'a' for #<Interpreter:0xa1a3118>" same with "A". (quotes not used)
idea of what i'm doing wrong? everything looks right, script looks right to my half trained eye...


RE: Veiw Range Script - MechanicalPen - 08-13-2013

I spent about 5 hours working on a similar bug with my own "line of sight" code. Does it work when the walls are 3 tiles thick? if so, then you have the issue where the monsters are peeking through the diagonals of walls. I can give you an alternate algorithm if that turns out the be the problem.