#=============================================================================== # # Yanfly Engine RD - Display Target Data # Last Date Updated: 2009.04.22 # Level: Easy # # This script puts a window next to the target enemy selection window and shows # the following data on them: HP, MP, and States. The select enemy window is now # changed to one column (and that's all you really need to be honest) to fit in # the new data window. Some enemies can have their HP and MP hidden as well. # #=============================================================================== # Updates: # ---------------------------------------------------------------------------- # o 2009.04.22 - Fixed a Divide By Zero propblem. # o 2009.04.18 - Updated with exhaust. # o 2009.02.19 - Started script. #=============================================================================== # Instructions #=============================================================================== # # Just put this script somewhere under ¥ Materials and you should be fine. If # you want to edit enemy HP and MP gauge colours, scroll down and go to the # respective parts to do so. If you want to have some enemies hide their HP or # MP, find DONT_SHOW_HP or DONT_SHOW_MP and put in the respective enemy ID. The # enemy ID is the enemy's number in the database's Enemies tab. # #=============================================================================== # # Compatibility # - Overwrites: Scene_Battle, start_target_enemy_selection # - Overwrites: Scene_Battle, end_target_enemy_selection # - Overwrites: Scene_Battle, update_target_enemy_selection # - Overwrites: Window_TargetEnemy, initialize # #=============================================================================== $imported = {} if $imported == nil $imported["DisplayTargetData"] = true module YE module BATTLE module DISPLAY # This is the exhaustion colour ID if you don't have Yanfly Interface Fix. EXHAUST_COLOUR = 7 # This allows you to show the enemy's name at the top of the data window. # It also lets you change how the data box title. The ENEMY_NAME_ALIGN # lets you change if the name is left aligned, centered, or right aligned. # 0 = left aligned # 1 = centered # 2 = right aligned SHOW_ENEMY_NAME = true ENEMY_NAME_DISP = "%s's Data" ENEMY_NAME_ALIGN = 1 # This allows you to show enemy HP. The colours can be modified to give # the HP gradient bar a different feel if you think orange is boring. # If the HP cannot be shown, add the enemy's ID number to DONT_SHOW_HP. # Under HP_CANNOT_SHOW is the text that appears. SHOW_ENEMY_HP = true ENEMY_HPCOLOUR1 = 20 ENEMY_HPCOLOUR2 = 21 DONT_SHOW_HP = [1, 11, 17] HP_CANNOT_SHOW = "????? HP" # This changes the way HP is displayed. As a number or percentage. # 1 = Percentage # 2 = Current HP # 3 = Current HP/Max HP # HP_CANNOT_SHOW will HP_DISPLAY_TYPE = 2 # This is just like enemy HP. It'll show enemy MP instead. The colours # are modified by ENEMY_MPCOLOUR1 and 2. Add enemy ID's to DONT_SHOW_MP # if you don't want the player to know how much MP an enemy has. SHOW_ENEMY_MP = true ENEMY_MPCOLOUR1 = 22 ENEMY_MPCOLOUR2 = 23 DONT_SHOW_MP = [1, 4, 7] MP_CANNOT_SHOW = "????? MP" # This changes the way HP is displayed. As a number or percentage. # 1 = Percentage # 2 = Current HP # 3 = Current HP/Max HP # HP_CANNOT_SHOW will MP_DISPLAY_TYPE = 1 # Use this to tag the Boss enemies if you want to. Simply put the boss's # ID into the array and you're set. BOSS_HPCOLOUR1 = 18 BOSS_HPCOLOUR2 = 20 BOSS_MPCOLOUR1 = 11 BOSS_MPCOLOUR2 = 22 BOSS_HP_ID = [4, 12, 18, 26, 27, 28, 29, 30, 31] # This will show enemy status effects. Note that states with an icon # index of 0 will now show and will be omitted. If you wish to change # that, edit the EMPTY_ICON_INDEX value below. SHOW_ENEMY_STATE = true EMPTY_ICON_INDEX = 0 end # end module DISPLAY end # end module BATTLE end # end module YE #=============================================================================== # Don't touch anything past here or else your computer will explode and you will # be a very sad person. #=============================================================================== #============================================================================== # Scene_Battle #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # * Start Target Enemy Selection #-------------------------------------------------------------------------- def start_target_enemy_selection @target_enemy_window = Window_TargetEnemy.new @target_enemy_window.y = @info_viewport.rect.y @info_viewport.rect.x += @target_enemy_window.width * 2 @info_viewport.ox += @target_enemy_window.width * 2 @actor_command_window.active = false @target_data_window = Window_TargetData.new targetdata = @target_enemy_window.enemy @target_data_window.refresh_info(targetdata) end #-------------------------------------------------------------------------- # * End Target Enemy Selection #-------------------------------------------------------------------------- def end_target_enemy_selection @target_data_window.dispose @target_data_window = nil @info_viewport.rect.x -= @target_enemy_window.width * 2 @info_viewport.ox -= @target_enemy_window.width * 2 @target_enemy_window.dispose @target_enemy_window = nil if @actor_command_window.index == 0 @actor_command_window.active = true end end #-------------------------------------------------------------------------- # * Update Target Enemy Selection #-------------------------------------------------------------------------- def update_target_enemy_selection @target_enemy_window.update if Input.trigger?(Input::B) Sound.play_cancel end_target_enemy_selection elsif Input.repeat?(Input::UP) targetdata = @target_enemy_window.enemy @target_data_window.refresh_info(targetdata) elsif Input.repeat?(Input::DOWN) targetdata = @target_enemy_window.enemy @target_data_window.refresh_info(targetdata) elsif Input.repeat?(Input::L) targetdata = @target_enemy_window.enemy @target_data_window.refresh_info(targetdata) elsif Input.repeat?(Input::R) targetdata = @target_enemy_window.enemy @target_data_window.refresh_info(targetdata) elsif Input.trigger?(Input::C) Sound.play_decision @active_battler.action.target_index = @target_enemy_window.enemy.index end_target_enemy_selection end_skill_selection end_item_selection next_actor end end end # end Scene_Battle #============================================================================== # Window_TargetEnemy #============================================================================== class Window_TargetEnemy < Window_Command #-------------------------------------------------------------------------- # Object Initialization #-------------------------------------------------------------------------- def initialize commands = [] @enemies = [] totalenemies = 0 for enemy in $game_troop.members next unless enemy.exist? commands.push(enemy.name) @enemies.push(enemy) totalenemies += 1 end super(208, commands, 1, totalenemies) self.height = 128 end end # end Window_TargetEnemy #============================================================================== # Window_TargetData #============================================================================== class Window_TargetData < Window_Base #-------------------------------------------------------------------------- # Object Initialization #-------------------------------------------------------------------------- def initialize super(208, 288, 208, 128) end #-------------------------------------------------------------------------- # Refresh Target Info #-------------------------------------------------------------------------- def refresh_info(target) self.contents.clear yrow = 0 nudge = 12 width = 176 unless $imported["InterfaceFix"] exhaust_color = text_color(YE::BATTLE::DISPLAY::EXHAUST_COLOUR) else exhaust_color = text_color(YE::FIX::TEXT::EXHAUST) end # Target Name if YE::BATTLE::DISPLAY::SHOW_ENEMY_NAME targetname = sprintf(YE::BATTLE::DISPLAY::ENEMY_NAME_DISP, target.name) self.contents.draw_text(0, yrow * WLH, width, WLH, targetname, YE::BATTLE::DISPLAY::ENEMY_NAME_ALIGN) yrow += 1 end # Target HP Data if YE::BATTLE::DISPLAY::SHOW_ENEMY_HP x = 0 target.hp = target.maxhp if target.hp > target.maxhp gc0 = gauge_back_color if YE::BATTLE::DISPLAY::BOSS_HP_ID.include?(target.enemy_id) gc1 = text_color(YE::BATTLE::DISPLAY::BOSS_HPCOLOUR1) gc2 = text_color(YE::BATTLE::DISPLAY::BOSS_HPCOLOUR2) else gc1 = text_color(YE::BATTLE::DISPLAY::ENEMY_HPCOLOUR1) gc2 = text_color(YE::BATTLE::DISPLAY::ENEMY_HPCOLOUR2) end gh = 6 gy = yrow * WLH + nudge if target.maxhp < target.base_maxhp and target.base_maxhp > 0 gb = width * target.maxhp / target.base_maxhp self.contents.fill_rect(x, gy, width, gh, exhaust_color) else gb = width end self.contents.fill_rect(x, gy, gb, gh, gc0) if YE::BATTLE::DISPLAY::DONT_SHOW_HP.include?(target.enemy_id) gw = width hptext = YE::BATTLE::DISPLAY::HP_CANNOT_SHOW self.contents.gradient_fill_rect(x, gy, gw, gh, gc1, gc2) else if target.maxhp <= 0 if target.base_maxhp <= 0 gw = width else gw = 0 end else gw = gb * target.hp / target.maxhp end hptype = YE::BATTLE::DISPLAY::HP_DISPLAY_TYPE hptext = sprintf("%d%% " + Vocab::hp, target.hp * 100 / target.maxhp) if hptype == 1 hptext = sprintf("%d " + Vocab::hp, target.hp, target.maxhp) if hptype == 2 hptext = sprintf("%d/%d " + Vocab::hp, target.hp, target.maxhp) if hptype == 3 end self.contents.gradient_fill_rect(x, gy, gw, gh, gc1, gc2) self.contents.draw_text(0, yrow * WLH, width, WLH, hptext, 2) yrow += 1 end # Target MP Data if YE::BATTLE::DISPLAY::SHOW_ENEMY_MP x = 0 target.mp = target.maxmp if target.mp > target.maxmp gc0 = gauge_back_color if YE::BATTLE::DISPLAY::BOSS_HP_ID.include?(target.enemy_id) gc1 = text_color(YE::BATTLE::DISPLAY::BOSS_MPCOLOUR1) gc2 = text_color(YE::BATTLE::DISPLAY::BOSS_MPCOLOUR2) else gc1 = text_color(YE::BATTLE::DISPLAY::ENEMY_MPCOLOUR1) gc2 = text_color(YE::BATTLE::DISPLAY::ENEMY_MPCOLOUR2) end gh = 6 gy = yrow * WLH + nudge if target.maxmp < target.base_maxmp and target.base_maxmp > 0 gb = width * target.maxmp / target.base_maxmp self.contents.fill_rect(x, gy, width, gh, exhaust_color) else gb = width end self.contents.fill_rect(x, gy, gb, gh, gc0) if YE::BATTLE::DISPLAY::DONT_SHOW_MP.include?(target.enemy_id) gw = width mptext = YE::BATTLE::DISPLAY::MP_CANNOT_SHOW self.contents.gradient_fill_rect(x, gy, gw, gh, gc1, gc2) else if target.maxmp <= 0 if target.base_maxmp <= 0 gw = width else gw = 0 end else gw = gb * target.mp / target.maxmp end mptype = YE::BATTLE::DISPLAY::MP_DISPLAY_TYPE if mptype == 1 if target.maxmp <= 0 mptext = "100% " + Vocab::mp else mptext = sprintf("%d%% " + Vocab::mp, target.mp * 100 / target.maxmp) end end mptext = sprintf("%d " + Vocab::mp, target.mp, target.maxmp) if mptype == 2 mptext = sprintf("%d/%d " + Vocab::mp, target.mp, target.maxmp) if mptype == 3 end self.contents.gradient_fill_rect(x, gy, gw, gh, gc1, gc2) self.contents.draw_text(0, yrow * WLH, width, WLH, mptext, 2) yrow += 1 end # Target Status Effect Data if YE::BATTLE::DISPLAY::SHOW_ENEMY_STATE statecount = 0 for state in target.states if statecount < 7 draw_icon(state.icon_index, 3 + (24 * statecount), yrow * WLH) unless state.icon_index == YE::BATTLE::DISPLAY::EMPTY_ICON_INDEX statecount += 1 unless state.icon_index == YE::BATTLE::DISPLAY::EMPTY_ICON_INDEX elsif statecount < 14 draw_icon(state.icon_index, 3 + (24 * (statecount - 7)), (yrow + 1)* WLH) unless state.icon_index == YE::BATTLE::DISPLAY::EMPTY_ICON_INDEX statecount += 1 unless state.icon_index == YE::BATTLE::DISPLAY::EMPTY_ICON_INDEX elsif statecount < 21 draw_icon(state.icon_index, 3 + (24 * (statecount - 14)), (yrow + 2)* WLH) unless state.icon_index == YE::BATTLE::DISPLAY::EMPTY_ICON_INDEX statecount += 1 unless state.icon_index == YE::BATTLE::DISPLAY::EMPTY_ICON_INDEX elsif statecount < 28 draw_icon(state.icon_index, 3 + (24 * (statecount - 21)), (yrow + 3)* WLH) unless state.icon_index == YE::BATTLE::DISPLAY::EMPTY_ICON_INDEX statecount += 1 unless state.icon_index == YE::BATTLE::DISPLAY::EMPTY_ICON_INDEX end end yrow += 1 end end # end refresh target info end # end Window_TargetData #=============================================================================== # # END OF FILE # #===============================================================================