Link in Pink
Member
Radius Script
(Otherwise known as View Range)
This script is made in it's entirety by Monsta. This script was located on a German website and is okay to use as long as you credit Monsta.
Overview
This script allows an event to "see" the player or another event within a certain number of tiles.
Original Script in German
Because it's in German, there may be quite a bit of confusion. Here's where I come in.
Instructions
Installing the script: Place it above "Main." Just like every other script.
Setting up an event:
1.) Make an event and set it to Parallel Process.
2.) Make a conditional Branch using the "Script" function.
3.) Insert this piece of code:
The first "6" is the event ID that is "seeing." The next section is the thing that it sees. In this case it sees the Player. The next "6" is the number of tiles in which the event sees. Leave the "0."
To make an event see another event place this code in a Conditional Branch:
In this code, the "2" is the event that it's seeing. "7" is the number of tiles it can see.
It might sound a bit complicated, so for those people who don't want to read it, here's a demo.
Demo
http://www.mediafire.com/?zishkmzdgyt
Again, it's free to use and post, but make sure to credit Monsta completely. :wink:
(Otherwise known as View Range)
This script is made in it's entirety by Monsta. This script was located on a German website and is okay to use as long as you credit Monsta.
Overview
This script allows an event to "see" the player or another event within a certain number of tiles.
Original Script in German
Code:
#==========Radius Script=========#
#============by Monsta===========#
#=====Version 1.0===24.5.2007====#
# Aufrufen #
# in_radius?(id_sehendes_event,id_gesehendes_event,sichtweite,sichtform,testfenster_anzeigen)
# Der Player hat die ID 0, kann aber auch mit "Player" angegeben werden
# Mit "All" beim gesehenden Event, bekommt man einen Array mit allen gesehenden Events
class Interpreter
RADIUS = [ [[],[0],[-1,0,1],[-1,0,1],[-2,-1,0,1,2],[-2,-1,0,1,2],[-3,-2,-1,0,1,2,3],[-3,-2,-1,0,1,2,3]], # Sicktkegel 1
[[-1,0,1],[-2,-1,0,1,2],[-3,-2,-1,0,1,2,3],[-4,-3,-2,-1,0,1,2,3,4],[-5,-4,-3,-2,-1,0,1,2,3,4,5]] ] # Sicktkegel 2
def in_radius?(id1,id2,radius=7,radius_form=0,windows=false)
@all = false
if windows == true
@radius_windows = {}
delete_radius_windows
end
if (id1.is_a?(String) and id1.downcase == 'player') or id1 == 0
char1 = $game_player
else
char1 = $game_map.events[id1]
end
if id2.is_a?(String)
if id2.downcase == 'player'
char2 = $game_player
elsif id2.downcase == 'all'
@all = []
end
else
char2 = id2 == 0 ? $game_player : $game_map.events[id2]
end
if radius >= RADIUS[radius_form].size
print ("Fehler im Skript: Radius Skript\n\nDer Radius ist größer als die Radiusangabe")
return false
end
for i in 0..radius
for r in RADIUS[radius_form][i]
case char1.direction
when 2 # Runter
x = char1.x + r
y = char1.y + i
when 4 # Links
x = char1.x - i
y = char1.y - r
when 6 # Rechts
x = char1.x + i
y = char1.y + r
when 8 # Hoch
x = char1.x + r
y = char1.y - i
end
@radius_windows["#{i},#{r}"] = Radius_Color.new(x,y) if $DEBUG and windows
id = $game_map.id_coordinates(x,y)
if @all == false
return true if id == char2.id
else
@all += [id] if id != -1
end
end
end
if @all == false or @all == []
return false
else
return @all
end
end
def delete_radius_windows
@radius_windows.each_value{|w|w.dispose if w != nil and w.disposed? == false} if @radius_windows != nil
end
end
class Game_Map
def id_coordinates(x=0,y=0)
@events.each {|e|return e[1].id if e[1].x == x and e[1].y == y}
return 0 if $game_player.x == x and $game_player.y == y
return -1
end
end
class Radius_Color < Window_Base
def initialize(x,y)
super(x * 32, y * 32, 20, 20)
self.contents = Bitmap.new(width, height)
self.opacity = 170
end
end
Because it's in German, there may be quite a bit of confusion. Here's where I come in.
Instructions
Installing the script: Place it above "Main." Just like every other script.
Setting up an event:
1.) Make an event and set it to Parallel Process.
2.) Make a conditional Branch using the "Script" function.
3.) Insert this piece of code:
Code:
in_radius?(6,'Player',6,0)
The first "6" is the event ID that is "seeing." The next section is the thing that it sees. In this case it sees the Player. The next "6" is the number of tiles in which the event sees. Leave the "0."
To make an event see another event place this code in a Conditional Branch:
Code:
in_radius?(@event_id,2,7,0,true)
In this code, the "2" is the event that it's seeing. "7" is the number of tiles it can see.
It might sound a bit complicated, so for those people who don't want to read it, here's a demo.
Demo
http://www.mediafire.com/?zishkmzdgyt
Again, it's free to use and post, but make sure to credit Monsta completely. :wink: