Does anybody knows how to check nearest Event ID from this Event(@event_id)?
ex) This Event(1) -> Event(2) is nearest distance from event(1)
need to know Event(2)'s ID with script down below or another script can run this.
I use meowface's script but it is player based so wanna change "player" part to "this_event".
but changing "$game_player" to "$game_map.events[@event_id]" doesn't seem to work.
and nametag based searching event ID could be more helpful.
and i use Rpgmaker vx ace version. sorry i didn't mention that.
attached meowface's full script and link below
https://forums.rpgmakerweb.com/index.php?threads/enemy-distance-scanner-radar.46115/
====================================================================
# ■ Meow Face Enemy Distance Scanner
#----------------------------------------------------------------------------------------------------------------------
# Return the ID of the nearest Event (from player position)
#===================================================================
# How to Use:
# [1] Put this script below Material and above Main
# [2] Put this name tag on events you want to scan: <enemy>
# [3] Use this Script Call to get the closest enemy's id (in Control Variables Script box)
# closest
# eg.
# Control Variables 1 = closest
#===================================================================
class Game_Map
def distance_from(id)
$game_player.distance_x_from($game_map.events[id].x).abs + $game_player.distance_y_from($game_map.events[id].y).abs
end
def scan_target
meowradar = {}
@events.values.each do |meow|
if meow.enemy?
meowscan = distance_from(meow.id)
meowtarget = (meow.id).to_s
meowradar[meowtarget] = meowscan
end
end
meowradar
end
def scan_nearest
scan_target.min_by{|k,v| v}[0] if !scan_target.empty?
end
end
class Game_Event < Game_Character
def enemy?
@event.name.include?('<enemy>')
end
end
class Game_Interpreter
def nearest_enemy
$game_map.scan_nearest
end
end
ex) This Event(1) -> Event(2) is nearest distance from event(1)
need to know Event(2)'s ID with script down below or another script can run this.
I use meowface's script but it is player based so wanna change "player" part to "this_event".
but changing "$game_player" to "$game_map.events[@event_id]" doesn't seem to work.
and nametag based searching event ID could be more helpful.
and i use Rpgmaker vx ace version. sorry i didn't mention that.
attached meowface's full script and link below
https://forums.rpgmakerweb.com/index.php?threads/enemy-distance-scanner-radar.46115/
====================================================================
# ■ Meow Face Enemy Distance Scanner
#----------------------------------------------------------------------------------------------------------------------
# Return the ID of the nearest Event (from player position)
#===================================================================
# How to Use:
# [1] Put this script below Material and above Main
# [2] Put this name tag on events you want to scan: <enemy>
# [3] Use this Script Call to get the closest enemy's id (in Control Variables Script box)
# closest
# eg.
# Control Variables 1 = closest
#===================================================================
class Game_Map
def distance_from(id)
$game_player.distance_x_from($game_map.events[id].x).abs + $game_player.distance_y_from($game_map.events[id].y).abs
end
def scan_target
meowradar = {}
@events.values.each do |meow|
if meow.enemy?
meowscan = distance_from(meow.id)
meowtarget = (meow.id).to_s
meowradar[meowtarget] = meowscan
end
end
meowradar
end
def scan_nearest
scan_target.min_by{|k,v| v}[0] if !scan_target.empty?
end
end
class Game_Event < Game_Character
def enemy?
@event.name.include?('<enemy>')
end
end
class Game_Interpreter
def nearest_enemy
$game_map.scan_nearest
end
end