I don't know whether this should be in RGSS support or script requests because I don't know how complex this is to do. Basically below is a far better version of the age-old classic Near Fantastica View Range script. It's in complete working order but I was hoping an adjustment could be made to make it an even more amazing script.
I was hoping I could set a terrain tag inside the script that when is between the "Seeing event" and the "seen event" it still doesn't see it. Basically so if I was having a monster that chases you when it sees you but you are hiding behind a desk with a terrain tag set to 7 or whatever, even if it's within the designated range it gets ignored. If anyone can do this it would be a great help and I'd also encourage you to post it as I'm sure it would be a great improvement for anyone else using it too.
Original thread: Made by Monsta from a German forum / Translated / Posted by Link in Pink
http://www.rmxp.org/forums/index.php?topic=45126.0
I was hoping I could set a terrain tag inside the script that when is between the "Seeing event" and the "seen event" it still doesn't see it. Basically so if I was having a monster that chases you when it sees you but you are hiding behind a desk with a terrain tag set to 7 or whatever, even if it's within the designated range it gets ignored. If anyone can do this it would be a great help and I'd also encourage you to post it as I'm sure it would be a great improvement for anyone else using it too.
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
Original thread: Made by Monsta from a German forum / Translated / Posted by Link in Pink
http://www.rmxp.org/forums/index.php?topic=45126.0