class Window_TargetName < Window_Help
def initialize
super
self.width = 192
self.height = 64
self.contents = Bitmap.new(width - 32, height - 32)
@base_window = Window_Base.new(x, y+16, width, 32)
@base_window.opacity = 160
self.opacity = 0
self.visible = false
end
def x=(n)
super
@base_window.x = n unless @base_window.nil?
end
def y=(n)
super
@base_window.y = n + 16 unless @base_window.nil?
end
def visible=(b)
super
@base_window.visible = b unless @base_window.nil?
end
def dispose
@base_window.dispose
super
end
def width=(n)
super
self.contents.dispose if self.contents
self.contents=Bitmap.new(self.width - 32, self.height - 32)
@base_window.width = n unless @base_window.nil?
end
def set_actor(actor)
set_text(actor.name,1)
end
def set_text(text,align)
self.width=self.contents.text_size(text).width+48
super(text+"???",align)
super(text,align)
end
end
class Game_Battler
def battler_rect
bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
return Rect.new(self.screen_x, self.screen_y, bitmap.width, bitmap.height)
end
end
class Arrow_Base
alias petero_targetname_Arrow_Base_update update
def update
petero_targetname_Arrow_Base_update
if @help_window != nil
rect = self.battler_rect
@help_window.x = [ 0 + rect.x - @help_window.width/2, 4].max
@help_window.y = [-48 + rect.y - rect.height , 4].max
end
end
end
class Arrow_Enemy < Arrow_Base
def battler_rect
return self.enemy.battler_rect
end
end
class Arrow_Actor < Arrow_Base
def battler_rect
return self.actor.battler_rect
end
end
class Scene_Battle
alias xrxs_bp22_main main
def main
@targetname_window = Window_TargetName.new
xrxs_bp22_main
@targetname_window.dispose
end
alias xrxs_bp22_start_enemy_select start_enemy_select
def start_enemy_select
xrxs_bp22_start_enemy_select
return if @enemy_arrow == nil
@enemy_arrow.help_window = @targetname_window
@enemy_arrow.update
@help_window.visible = false
end
alias xrxs_bp22_end_enemy_select end_enemy_select
def end_enemy_select
xrxs_bp22_end_enemy_select
@targetname_window.visible = false
end
alias petero_targetname_Scene_Battle_start_actor_select start_actor_select
def start_actor_select
petero_targetname_Scene_Battle_start_actor_select
return if @actor_arrow == nil
@actor_arrow.help_window = @targetname_window
@actor_arrow.update
@help_window.visible = false
end
alias petero_targetname_Scene_Battle_end_actor_select end_actor_select
def end_actor_select
petero_targetname_Scene_Battle_end_actor_select
@targetname_window.visible = false
end
end