Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Veiw Range Script
#1
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.
Reply }
#2
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.
Reply }
#3
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!!!!!!!
Reply }
#4
This is NOT a bump, but a revelation for users of RPGMaker VX.

A surprise occurred as a member of House Slashers, Lysop, discovered that most of the functions of View Range v3Delta actually worked with RPGMaker VX.

OMG, the script is cross-platform!!!! I gotta change this script's flag to BOTH!

For both RPGMaker XP and RPGMaker VX, it lets events find another event or the player within a certain range, and impassible tiles can block an event's view of its target if the 'block' parameter in the event viewing call is set to true.

IE:
$view_range.enemies_view(2, 12, 14, nil, true)
Lets event #2 see the player if it's within 12 tiles, but only if there are no impassible tiles blocking.
-and-
$view_range.enemies_view(2, 12, 14, nil)
Lets event #2 see the player if it's within 12 tiles regardless of impassible tiles



The only thing necessary for View Range to fully function with RPGMaker VX is a bit of editing so the Event Sound feature can function.

Normally, and with RPGMaker XP, it runs some statements within the Game_System class. These statements were removed from RPGMaker VX. But if you paste the below code into RPGMaker VX, you restore these methods that the Event Sound feature uses without any conflicts or side effects.

Code:
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles system-related data. Also manages vehicles and BGM, etc.
# The instance of this class is referenced by $game_system.
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # * Play Background Sound
  #     bgs : background sound to be played
  #--------------------------------------------------------------------------
  def bgs_play(bgs)
    @playing_bgs = bgs
    if bgs != nil and bgs.name != ""
      Audio.bgs_play("Audio/BGS/" + bgs.name, bgs.volume, bgs.pitch)
    else
      Audio.bgs_stop
    end
    Graphics.frame_reset
  end
  #--------------------------------------------------------------------------
  # * Fade Out Background Sound
  #     time : fade-out time (in seconds)
  #--------------------------------------------------------------------------
  def bgs_fade(time)
    @playing_bgs = nil
    Audio.bgs_fade(time * 1000)
  end  
  #--------------------------------------------------------------------------
  # * Get Playing Background Sound
  #--------------------------------------------------------------------------
  def playing_bgs
    return @playing_bgs
  end  
end
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png] [Image: liM4ikn.png] [Image: fdzKgZA.png] [Image: sj0H81z.png]
[Image: QL7oRau.png] [Image: uSqjY09.png] [Image: GAA3qE9.png] [Image: 2Hmnx1G.png] [Image: BwtNdKw.png%5B]
Above are clickable links

Reply }
#5
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.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png] [Image: liM4ikn.png] [Image: fdzKgZA.png] [Image: sj0H81z.png]
[Image: QL7oRau.png] [Image: uSqjY09.png] [Image: GAA3qE9.png] [Image: 2Hmnx1G.png] [Image: BwtNdKw.png%5B]
Above are clickable links

Reply }
#6
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)
Reply }
#7
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.

Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png] [Image: liM4ikn.png] [Image: fdzKgZA.png] [Image: sj0H81z.png]
[Image: QL7oRau.png] [Image: uSqjY09.png] [Image: GAA3qE9.png] [Image: 2Hmnx1G.png] [Image: BwtNdKw.png%5B]
Above are clickable links

Reply }
#8
This bump is thanks to PK8. While working on a request, he discovered that View Range Eta also works with RPGMaker VXAce.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png] [Image: liM4ikn.png] [Image: fdzKgZA.png] [Image: sj0H81z.png]
[Image: QL7oRau.png] [Image: uSqjY09.png] [Image: GAA3qE9.png] [Image: 2Hmnx1G.png] [Image: BwtNdKw.png%5B]
Above are clickable links

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

Reply }
#10
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.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png] [Image: liM4ikn.png] [Image: fdzKgZA.png] [Image: sj0H81z.png]
[Image: QL7oRau.png] [Image: uSqjY09.png] [Image: GAA3qE9.png] [Image: 2Hmnx1G.png] [Image: BwtNdKw.png%5B]
Above are clickable links

Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   Text Scroll Script - Enhanced DerVVulfman 23 29,452 02-18-2021, 04:16 AM
Last Post: DerVVulfman
   Cursor Script Selwyn 7 12,967 09-28-2019, 02:13 PM
Last Post: DerVVulfman
   ACBS FIX SCRIPT #2: Advanced Cry Correction DerVVulfman 1 3,856 08-09-2019, 03:42 PM
Last Post: aeliath
   ACBS FIX SCRIPT #1: Victory Cries Patch DerVVulfman 1 3,843 08-08-2019, 02:53 PM
Last Post: aeliath
   Archived Script Listings DerVVulfman 9 33,309 01-08-2019, 04:27 AM
Last Post: DerVVulfman
   Spritesheet Generator Conversion Script DerVVulfman 0 3,534 11-21-2018, 04:48 AM
Last Post: DerVVulfman
   Neo Mode 7 Script by MGCaladtogel MGC 59 110,538 09-29-2017, 03:48 AM
Last Post: DerVVulfman
   Longer Script Calls LiTTleDRAgo 0 4,304 05-17-2017, 12:36 AM
Last Post: LiTTleDRAgo
   SLOLS: Snake Look-alike on Load Script Zeriab 3 10,083 05-14-2017, 06:25 PM
Last Post: LiTTleDRAgo
   Character Select Script Selwyn 3 9,398 03-07-2017, 04:14 AM
Last Post: JayRay



Users browsing this thread: