#<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>># # # # V's Live Hud Menu System # # Version 0.2 # # # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # Written By: V # # Last Edited: January 6, 2014 # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # # #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>># #==============================================================================# #------------------------------------------------------------------------------# # ** Disclaimer # #------------------------------------------------------------------------------# # # # This script was intended for Non-Commercial use only, if you wish to use # # this script in a commercial game please PM me at which ever site you found # # this script. Either way please give me credit in your game script as the # # writer of this script, and send me a PM abuot the release of the game/demo. # # # #------------------------------------------------------------------------------# # ** How To Use # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # # # * This script has a customizable area below. # # # #------------------------------------------------------------------------------# # ** Description # #------------------------------------------------------------------------------# # # # v0.1 # # ~=~=~=~ # # * This script allows for a live hud style menu. Right now it only supports # # a one party member team but I will be updating to support all. # # # # v0.2 # # ~=~=~=~ # # * This script can now be used with V's VGW v3.0+ # # # #------------------------------------------------------------------------------# #==============================================================================# $imported = {} if $imported.nil? $imported["Vs_Live_HUD_Menu"] = true #============================================================================== # ** Window_SkillList #------------------------------------------------------------------------------ # This window is for displaying a list of available skills on the skill window. #============================================================================== class Window_SkillList < Window_Selectable #-------------------------------------------------------------------------- # * Draw Sizeable Text #-------------------------------------------------------------------------- def draw_sizeable_text(x, y, w, h, text, alignment, size) contents.font.size = size contents.draw_text(x, y, w, h, text, alignment) reset_font_settings end #-------------------------------------------------------------------------- # * Draw Sizeable Text #-------------------------------------------------------------------------- def draw_sizeable_rect_text(rect, text, alignment, size) contents.font.size = size contents.draw_text(rect, text, alignment) reset_font_settings end #-------------------------------------------------------------------------- # * Draw Item Name # enabled : Enabled flag. When false, draw semi-transparently. #-------------------------------------------------------------------------- def draw_item_name(item, x, y, enabled = true, width = 172) return unless item draw_icon(item.icon_index, x, y, enabled) change_color(normal_color, enabled) draw_sizeable_text(x + 24, y, width, line_height, item.name, 0, 13) end #-------------------------------------------------------------------------- # * Draw Skill Use Cost #-------------------------------------------------------------------------- def draw_skill_cost(rect, skill) if @actor.skill_tp_cost(skill) > 0 change_color(tp_cost_color, enable?(skill)) draw_sizeable_rect_text(rect, @actor.skill_tp_cost(skill), 2, 14) elsif @actor.skill_mp_cost(skill) > 0 change_color(mp_cost_color, enable?(skill)) draw_sizeable_rect_text(rect, @actor.skill_mp_cost(skill), 2, 14) end end end #============================================================================== # ** Window_SkillCommand #------------------------------------------------------------------------------ # This window is for selecting commands (special attacks, magic, etc.) on the # skill screen. #============================================================================== class Window_SkillCommand < Window_Command #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width return Graphics.width end #-------------------------------------------------------------------------- # * Get Alignment #-------------------------------------------------------------------------- def alignment return 1 end #-------------------------------------------------------------------------- # * Get Number of Lines to Show #-------------------------------------------------------------------------- def visible_line_number return 1 end #-------------------------------------------------------------------------- # * Get Digit Count #-------------------------------------------------------------------------- def col_max return item_max unless item_max == 0 return 1 if item_max == 0 end #-------------------------------------------------------------------------- # * Calculate Height of Window Contents #-------------------------------------------------------------------------- def contents_height item_height end end #============================================================================== # ** Window_EquipStatus #------------------------------------------------------------------------------ # This window displays actor parameter changes on the equipment screen. #============================================================================== class Window_EquipStatus < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(x, y, h) super(x, y, window_width, h) @height = h @actor = nil @temp_actor = nil refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh contents.clear 8.times {|i| draw_item(0, ((line_height - 6) * i), i) } end #-------------------------------------------------------------------------- # * Draw Sizeable Text #-------------------------------------------------------------------------- def draw_sizeable_rect_text(x, y, w, h, text, alignment, size) contents.font.size = size contents.draw_text(x, y, w, h, text, alignment) reset_font_settings end #-------------------------------------------------------------------------- # * Get Window Height #-------------------------------------------------------------------------- def window_height @height end #-------------------------------------------------------------------------- # * Get Line Height #-------------------------------------------------------------------------- def line_height return 20 end #-------------------------------------------------------------------------- # * Draw Parameter Name #-------------------------------------------------------------------------- def draw_param_name(x, y, param_id) change_color(system_color) draw_sizeable_rect_text(x, y, 80, line_height, Vocab::param(param_id), 0, 14) end #-------------------------------------------------------------------------- # * Draw Current Parameter #-------------------------------------------------------------------------- def draw_current_param(x, y, param_id) change_color(normal_color) draw_sizeable_rect_text(x, y, 32, line_height, @actor.param(param_id), 2, 14) end #-------------------------------------------------------------------------- # * Draw Right Arrow #-------------------------------------------------------------------------- def draw_right_arrow(x, y) change_color(system_color) draw_sizeable_rect_text(x, y, 22, line_height, "→", 1, 14) end #-------------------------------------------------------------------------- # * Draw Post-Equipment Change Parameter #-------------------------------------------------------------------------- def draw_new_param(x, y, param_id) new_value = @temp_actor.param(param_id) change_color(param_change_color(new_value - @actor.param(param_id))) draw_sizeable_rect_text(x, y, 32, line_height, new_value, 2, 14) end end #============================================================================== # ** Window_EquipItem #------------------------------------------------------------------------------ # This window displays choices when opting to change equipment on the # equipment screen. #============================================================================== class Window_EquipItem < Window_ItemList #-------------------------------------------------------------------------- # * Update Help Text #-------------------------------------------------------------------------- def update_temp_actor if @actor && @status_window temp_actor = Marshal.load(Marshal.dump(@actor)) temp_actor.force_change_equip(@slot_id, item) @status_window.set_temp_actor(temp_actor) end end end #============================================================================== # ** Window_ItemList #------------------------------------------------------------------------------ # This window displays a list of party items on the item screen. #============================================================================== class Window_ItemList < Window_Selectable #-------------------------------------------------------------------------- # * Draw Sizeable Text #-------------------------------------------------------------------------- def draw_sizeable_rect_text(rect, text, alignment, size) reset_font_settings contents.font.size = size contents.draw_text(rect, text, alignment) reset_font_settings end #-------------------------------------------------------------------------- # * Draw Sizeable Text #-------------------------------------------------------------------------- def draw_sizeable_text(x, y, w, h, text, alignment, size) reset_font_settings contents.font.size = size contents.draw_text(x, y, w, h, text, alignment) reset_font_settings end #-------------------------------------------------------------------------- # * Draw Number of Items #-------------------------------------------------------------------------- def draw_item_number(rect, item) draw_sizeable_rect_text(rect, sprintf(":%2d", $game_party.item_number(item)), 2, 14) end #-------------------------------------------------------------------------- # * Draw Item Name # enabled : Enabled flag. When false, draw semi-transparently. #-------------------------------------------------------------------------- def draw_item_name(item, x, y, enabled = true, width = 172) return unless item draw_icon(item.icon_index, x, y, enabled) change_color(normal_color, enabled) draw_sizeable_text(x + 24, y, width, line_height, item.name, 0, 14) end end #============================================================================== # ** Window_GameEnd #------------------------------------------------------------------------------ # This window is for selecting Go to Title/Shut Down on the game over screen. #============================================================================== class Window_GameEnd < Window_Command #-------------------------------------------------------------------------- # * Get Alignment #-------------------------------------------------------------------------- def alignment return 1 end #-------------------------------------------------------------------------- # * Aliasing Method: Make Command List #-------------------------------------------------------------------------- alias :wgemcl857453453 :make_command_list #-------------------------------------------------------------------------- # * Make Command List #-------------------------------------------------------------------------- def make_command_list add_command(Vocab.save, :save) add_command("Load", :load) wgemcl857453453() end end #============================================================================== # ** Window_Status #------------------------------------------------------------------------------ # This window displays full status specs on the status screen. #============================================================================== class Window_Menu_Status < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(actor) super((Graphics.width / 5), (Graphics.height / 5), (Graphics.width / 5) * 3, (Graphics.height / 5) * 3) self.openness = 0 @actor = actor @playtime = $game_system.playtime_s refresh end #-------------------------------------------------------------------------- # * Refresh Processing #-------------------------------------------------------------------------- def refresh contents.clear @playtime = $game_system.playtime_s draw_actor_face(@actor, 5, 5) draw_actor_graphic(@actor, 95, 110) draw_sizeable_text(115, -15, (Graphics.width / 5) * 3, 50, "Name: ", 0, 14, normal_color) draw_sizeable_text(120, 2, (Graphics.width / 5) * 3, 50, @actor.name, 0, 25, normal_color) draw_sizeable_text(115, 20, (Graphics.width / 5) * 3, 50, "Class: ", 0, 14, normal_color) draw_sizeable_text(120, 37, (Graphics.width / 5) * 3, 50, $data_classes[@actor.class_id].name, 0, 25, normal_color) dfs = Font.default_size Font.default_size = 14 draw_text_ex(5, 115, @actor.description) Font.default_size = dfs y = 162 x = 15 8.times {|i| draw_actor_param(@actor, x - 5, y + line_height * i, i) if i < 4 draw_actor_param(@actor, x + 65, y + line_height * (i - 4), i) if i > 3 } draw_sizeable_text(-25, 190, (Graphics.width / 5) * 3, 50, "Playtime: " + playtime, 2, 14, normal_color) end #-------------------------------------------------------------------------- # * Returns Playtime #-------------------------------------------------------------------------- def playtime return @playtime end #-------------------------------------------------------------------------- # * Draw Parameters #-------------------------------------------------------------------------- def draw_actor_param(actor, x, y, param_id) change_color(system_color) draw_text(x, y, 120, line_height, Vocab::param(param_id)) change_color(normal_color) draw_text(x + 25, y, 36, line_height, actor.param(param_id), 2) end #-------------------------------------------------------------------------- # * Line Height #-------------------------------------------------------------------------- def line_height return 15 end #-------------------------------------------------------------------------- # * Draw Sizeable Text #-------------------------------------------------------------------------- def draw_sizeable_text(x, y, w, h, text, alignment, size, color) reset_font_settings contents.font.size = size change_color(color) contents.draw_text(x, y, w, h, text, alignment) reset_font_settings end end #============================================================================== # ** Window_Base #------------------------------------------------------------------------------ # This is a super class of all windows within the game. #============================================================================== class Window_Hud < Window_Command #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize @command_icons = [13,160,14,261] @option_icon = 117 super(0, 0) self.opacity = 0 @cindex = nil @hp = $game_party.battle_members[0].hp @mp = $game_party.battle_members[0].mp @exp = $game_party.battle_members[0].exp @gold = $game_party.gold @states = $game_party.battle_members[0].states @map_name = $game_map.display_name refresh end #-------------------------------------------------------------------------- # * Refresh Processing #-------------------------------------------------------------------------- def refresh super draw_cursor_text if @cindex != nil draw_map_name draw_actor_name($game_party.battle_members[0], 58, 5) draw_actor_face($game_party.battle_members[0], 5, 5, true) draw_actor_states($game_party.battle_members[0], 155, 35) draw_actor_hp($game_party.battle_members[0], 72, 17, 75) draw_actor_mp($game_party.battle_members[0], 72, 30, 75) draw_actor_xp($game_party.battle_members[0], 15, 362, Graphics.width - 50) draw_currency_value(value, currency_unit, 4, 30, contents.width - 8) end #-------------------------------------------------------------------------- # * Draw Icon # enabled : Enabled flag. When false, draw semi-transparently. #-------------------------------------------------------------------------- def draw_small_icon(icon_index, x, y) bitmap = Cache.system("Iconset") rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24) new_rect = Rect.new(x, y, 16, 16) contents.stretch_blt(new_rect, bitmap, rect) end #-------------------------------------------------------------------------- # * Draw Cursor Text #-------------------------------------------------------------------------- def draw_cursor_text x = item_rect_for_text(@cindex).x y = item_rect_for_text(@cindex).y w = item_rect_for_text(@cindex).width h = item_rect_for_text(@cindex).height draw_sizeable_text(x, y, w, h, command_name(@cindex), 2, 18, normal_color) end #-------------------------------------------------------------------------- # * Deactivate #-------------------------------------------------------------------------- def change_text_cursor(index) @cindex = index refresh end #-------------------------------------------------------------------------- # * Draw Map Name #-------------------------------------------------------------------------- def need_refresh? need_refresh = false if @map_name != $game_map.display_name @map_name = $game_map.display_name need_refresh = true end if @gold != $game_party.gold @gold = $game_party.gold need_refresh = true end if @hp != $game_party.battle_members[0].hp @hp = $game_party.battle_members[0].hp need_refresh = true end if @mp != $game_party.battle_members[0].mp @mp = $game_party.battle_members[0].mp need_refresh = true end if @exp != $game_party.battle_members[0].exp @exp = $game_party.battle_members[0].exp need_refresh = true end if @states != $game_party.battle_members[0].states @states = $game_party.battle_members[0].states need_refresh = true end return need_refresh end #-------------------------------------------------------------------------- # * Make Command List #-------------------------------------------------------------------------- def make_command_list add_command("Status", :status) add_command("Equipment", :equipment) add_command("Skills", :skills) add_command("Items", :items) add_original_command add_command("Options", :options) end #-------------------------------------------------------------------------- # * Add Original Commands #-------------------------------------------------------------------------- def add_original_command end #-------------------------------------------------------------------------- # * Draw Item #-------------------------------------------------------------------------- def draw_item(index) y = 60 height = 35 @command_icons.size.times { |i| draw_icon(@command_icons[i], 5, y + (height * i)) } draw_original_icons(y) draw_icon(@option_icon, 5, y + (height * @command_icons.size)) end #-------------------------------------------------------------------------- # * Draw Original Icons #-------------------------------------------------------------------------- def draw_original_icons(y) end #-------------------------------------------------------------------------- # * Get Rectangle for Drawing Items #-------------------------------------------------------------------------- def item_rect(index) rect = Rect.new rect.width = item_width - 425 rect.height = item_height + 5 rect.x = index % col_max * (item_width + spacing) + 2 rect.y = index / col_max * item_height + 59 + (spacing * index) rect end #-------------------------------------------------------------------------- # * Get Spacing for Items Arranged Side by Side #-------------------------------------------------------------------------- def spacing return 11 end #-------------------------------------------------------------------------- # * Draw Map Name #-------------------------------------------------------------------------- def draw_map_name draw_sizeable_text(-10, 0, Graphics.width, line_height, $game_map.display_name, 1, 18, normal_color) end #-------------------------------------------------------------------------- # * Draw Name #-------------------------------------------------------------------------- def draw_actor_hp(actor, x, y) draw_sizeable_text(x - 280, y + 8, Graphics.width, line_height, actor.name, 1, 14, normal_color) end #-------------------------------------------------------------------------- # * Draw State Icons #-------------------------------------------------------------------------- def draw_actor_states(actor, x, y) actor.states.each_index { |i| icon_x = x + (i * 22) icon = $data_states[actor.states[i].id].icon_index draw_small_icon(icon, icon_x, y) } end #-------------------------------------------------------------------------- # * Draw HP #-------------------------------------------------------------------------- def draw_actor_hp(actor, x, y, width = 124) draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2) change_color(system_color) draw_sizeable_text(x - 280, y + 8, Graphics.width, line_height, Vocab::hp_a, 1, 14, normal_color) end #-------------------------------------------------------------------------- # * Draw MP #-------------------------------------------------------------------------- def draw_actor_mp(actor, x, y, width = 124) draw_gauge(x, y, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2) change_color(system_color) draw_sizeable_text(x - 280, y + 8, Graphics.width, line_height, Vocab::mp_a, 1, 14, normal_color) end #-------------------------------------------------------------------------- # * Get Party Gold #-------------------------------------------------------------------------- def value $game_party.gold end #-------------------------------------------------------------------------- # Get Currency Unit #-------------------------------------------------------------------------- def currency_unit Vocab::currency_unit end #-------------------------------------------------------------------------- # * Window Width #-------------------------------------------------------------------------- def window_width return Graphics.width end #-------------------------------------------------------------------------- # * Window Height #-------------------------------------------------------------------------- def window_height return Graphics.height end #-------------------------------------------------------------------------- # * Draw Face Graphic # enabled : Enabled flag. When false, draw semi-transparently. #-------------------------------------------------------------------------- def draw_face(face_name, face_index, x, y, enabled = true) bitmap = Cache.face(face_name) cw = 96 ch = 96 src_rect = Rect.new(x, y, (cw / 2), (ch / 2)) actor = Rect.new(face_index % 4 * cw, face_index / 4 * ch, cw, ch) contents.stretch_blt(src_rect, bitmap, actor) bitmap.dispose end #-------------------------------------------------------------------------- # * Draw Sizeable Text #-------------------------------------------------------------------------- def draw_sizeable_text(x, y, w, h, text, alignment, size, color) reset_font_settings contents.font.size = size change_color(color) contents.draw_text(x, y, w, h, text, alignment) reset_font_settings end #-------------------------------------------------------------------------- # * Draw XP #-------------------------------------------------------------------------- def draw_actor_xp(actor, x, y, width = 124) exp_rate = actor.exp.to_f / actor.next_level_exp draw_gauge(x, y, width, exp_rate, tp_gauge_color1, tp_gauge_color2) draw_sizeable_text(x + 200, y, 100, line_height, "XP: %" + (exp_rate * 100).to_i.to_s, 1, 16, system_color) end end #============================================================================== # ** Scene_Map #------------------------------------------------------------------------------ # This class performs the map screen processing. #============================================================================== class Scene_Map < Scene_Base #-------------------------------------------------------------------------- # * Aliasing Method: Initializing Processing #-------------------------------------------------------------------------- alias :smi5453245343 :initialize #-------------------------------------------------------------------------- # * Initializing Processing #-------------------------------------------------------------------------- def initialize smi5453245343() @menu_index = 0 @actor = $game_party.members[0] end #-------------------------------------------------------------------------- # * Aliasing Method: Create All Windows #-------------------------------------------------------------------------- alias :smcaw4524 :create_all_windows #-------------------------------------------------------------------------- # * Create All Windows #-------------------------------------------------------------------------- def create_all_windows smcaw4524() create_hud_window create_stat_window create_equipment_command_window create_slot_window create_equipment_status_window create_equipment_item_window create_skill_command_window create_skill_item_window create_category_window create_item_window create_options_window end #-------------------------------------------------------------------------- # * Create Options Window #-------------------------------------------------------------------------- def create_options_window @options_window = Window_GameEnd.new @options_window.set_handler(:to_title, method(:command_to_title)) @options_window.set_handler(:shutdown, method(:command_shutdown)) @options_window.set_handler(:save, method(:command_save)) @options_window.set_handler(:load, method(:command_load)) @options_window.set_handler(:cancel, method(:command_options_cancel)) @options_window.close @options_window.unselect @options_window.deactivate end #-------------------------------------------------------------------------- # * Create Category Window #-------------------------------------------------------------------------- def create_category_window @category_window = Window_ItemCategory.new @category_window.openness = 0 @category_window.height = 50 @category_window.y = (Graphics.height / 2) - 50 @category_window.z = 200 @category_window.set_handler(:ok, method(:on_category_ok)) @category_window.set_handler(:cancel, method(:on_category_cancel)) @category_window.unselect @category_window.deactivate end #-------------------------------------------------------------------------- # * Create Item Window #-------------------------------------------------------------------------- def create_item_window wy = (Graphics.height / 5) wh = (Graphics.height / 5) * 3 wx = (Graphics.width / 5) ww = (Graphics.width / 5) * 3 @item_window = Window_ItemList.new(wx, wy, ww, wh) @item_window.openness = 0 @item_window.set_handler(:ok, method(:on_item_ok)) @item_window.set_handler(:cancel, method(:on_item_cancel)) @item_window.deactivate @category_window.item_window = @item_window end #-------------------------------------------------------------------------- # * Create Command Window #-------------------------------------------------------------------------- def create_skill_command_window @skill_command_window = Window_SkillCommand.new(0, (Graphics.height / 2) - 50) @skill_command_window.z = 200 @skill_command_window.actor = @actor @skill_command_window.set_handler(:skill, method(:command_skill)) @skill_command_window.set_handler(:cancel, method(:command_skill_cancel)) @skill_command_window.openness = 0 @skill_command_window.unselect @skill_command_window.deactivate end #-------------------------------------------------------------------------- # * Create Item Window #-------------------------------------------------------------------------- def create_skill_item_window wx = (Graphics.width / 5) wy = (Graphics.height / 5) ww = (Graphics.width / 5) * 3 wh = (Graphics.height / 5) * 3 @skill_item_window = Window_SkillList.new(wx, wy, ww, wh) @skill_item_window.openness = 0 @skill_item_window.actor = @actor @skill_item_window.set_handler(:ok, method(:on_skill_item_ok)) @skill_item_window.set_handler(:cancel, method(:on_skill_item_cancel)) @skill_command_window.skill_window = @skill_item_window @skill_item_window.unselect @skill_item_window.deactivate end #-------------------------------------------------------------------------- # * Create Status Window #-------------------------------------------------------------------------- def create_equipment_status_window @equipment_status_window = Window_EquipStatus.new(0, (@slot_window.y + @slot_window.height), 141) @equipment_status_window.actor = @actor @equipment_status_window.set_temp_actor($game_party.members[0]) @equipment_status_window.z = 200 @equipment_status_window.openness = 0 end #-------------------------------------------------------------------------- # * Create Command Window #-------------------------------------------------------------------------- def create_equipment_command_window wx = (Graphics.width / 5) wy = (Graphics.height / 5) ww = Graphics.width - (wx * 2) @equipment_command_window = Window_EquipCommand.new(wx, wy, ww) @equipment_command_window.set_handler(:equip, method(:command_equip)) @equipment_command_window.set_handler(:optimize, method(:command_optimize)) @equipment_command_window.set_handler(:clear, method(:command_clear)) @equipment_command_window.set_handler(:cancel, method(:command_equipment_cancel)) @equipment_command_window.openness = 0 @equipment_command_window.unselect @equipment_command_window.deactivate end #-------------------------------------------------------------------------- # * Create Slot Window #-------------------------------------------------------------------------- def create_slot_window wx = (Graphics.width / 5) wy = (Graphics.height / 5) + @equipment_command_window.height ww = Graphics.width - (wx * 2) @slot_window = Window_EquipSlot.new(wx, wy, ww) @slot_window.status_window = @equipment_status_window @slot_window.actor = @actor @slot_window.set_handler(:ok, method(:on_slot_ok)) @slot_window.set_handler(:cancel, method(:on_slot_cancel)) @slot_window.openness = 0 @slot_window.unselect @slot_window.deactivate end #-------------------------------------------------------------------------- # * Create Item Window #-------------------------------------------------------------------------- def create_equipment_item_window wx = @equipment_status_window.width wy = @slot_window.y + @slot_window.height ww = Graphics.width - wx wh = Graphics.height - wy @equipment_item_window = Window_EquipItem.new(wx, wy, ww, wh) @equipment_item_window.status_window = @equipment_status_window @equipment_item_window.actor = @actor @equipment_item_window.set_handler(:ok, method(:on_equipment_item_ok)) @equipment_item_window.set_handler(:cancel, method(:on_equipment_item_cancel)) @equipment_item_window.openness = 0 @slot_window.item_window = @equipment_item_window end #-------------------------------------------------------------------------- # * Create Status Window #-------------------------------------------------------------------------- def create_stat_window @stat_window = Window_Menu_Status.new($game_party.members[0]) end #-------------------------------------------------------------------------- # * Create Hud Window #-------------------------------------------------------------------------- def create_hud_window @hud_window = Window_Hud.new @hud_window.set_handler(:status, method(:command_status_select)) @hud_window.set_handler(:equipment, method(:command_equipment_select)) @hud_window.set_handler(:skills, method(:command_skill_select)) @hud_window.set_handler(:items, method(:command_item_select)) @hud_window.set_handler(:options, method(:command_options_select)) @hud_window.unselect @hud_window.deactivate end #-------------------------------------------------------------------------- # * Empty Method: Command Menu Select #-------------------------------------------------------------------------- def command_menu_select end #-------------------------------------------------------------------------- # * [Save] Command #-------------------------------------------------------------------------- def command_save @menu_index = 0 SceneManager.call(Scene_Save) end #-------------------------------------------------------------------------- # * [Load] Command #-------------------------------------------------------------------------- def command_load @menu_index = 0 SceneManager.call(Scene_Load) end #-------------------------------------------------------------------------- # * [Go to Title] Command #-------------------------------------------------------------------------- def command_to_title SceneManager.goto(Scene_Title) end #-------------------------------------------------------------------------- # * [Shut Down] Command #-------------------------------------------------------------------------- def command_shutdown fadeout_all SceneManager.exit end #-------------------------------------------------------------------------- # * [To Title] Command #-------------------------------------------------------------------------- def command_options_cancel @menu_index -= 7 @options_window.close Sound.play_cancel @hud_window.select(4) @hud_window.activate @hud_window.change_text_cursor(4) end #-------------------------------------------------------------------------- # * [Options Select] Command #-------------------------------------------------------------------------- def command_options_select @menu_index += 7 @options_window.refresh @options_window.open @options_window.select(0) @options_window.activate @hud_window.deactivate end #-------------------------------------------------------------------------- # * Category [OK] #-------------------------------------------------------------------------- def on_category_ok @category_window.close @item_window.refresh @item_window.open @item_window.activate @item_window.select_last end #-------------------------------------------------------------------------- # * Category [Cancel] #-------------------------------------------------------------------------- def on_category_cancel @menu_index -= 3 @category_window.unselect @category_window.close Sound.play_cancel @hud_window.select(3) @hud_window.activate @hud_window.change_text_cursor(3) end #-------------------------------------------------------------------------- # * Item [OK] #-------------------------------------------------------------------------- def on_item_ok $game_party.last_item.object = item determine_item end #-------------------------------------------------------------------------- # * Item [Cancel] #-------------------------------------------------------------------------- def on_item_cancel @item_window.unselect @item_window.close @category_window.open @category_window.activate end #-------------------------------------------------------------------------- # * [Item Select] Command #-------------------------------------------------------------------------- def command_item_select @menu_index += 3 @hud_window.deactivate @category_window.select(0) @category_window.activate @category_window.open end #-------------------------------------------------------------------------- # * [Skill] Command #-------------------------------------------------------------------------- def command_skill @skill_command_window.close @skill_command_window.deactivate @skill_item_window.activate @skill_item_window.select_last @skill_item_window.open end #-------------------------------------------------------------------------- # * Item [OK] #-------------------------------------------------------------------------- def on_skill_item_ok @actor.last_skill.object = skill_item determine_skill_item end #-------------------------------------------------------------------------- # * Item [Cancel] #-------------------------------------------------------------------------- def on_skill_item_cancel @skill_item_window.unselect @skill_item_window.deactivate @skill_item_window.close @skill_command_window.activate @skill_command_window.open end #-------------------------------------------------------------------------- # * [Status Select] Command #-------------------------------------------------------------------------- def command_skill_select @menu_index += 3 @skill_command_window.select(0) @skill_command_window.activate @skill_command_window.open @hud_window.deactivate end #-------------------------------------------------------------------------- # * [Status Select] Command #-------------------------------------------------------------------------- def command_skill_cancel @menu_index -= 3 @skill_command_window.unselect @skill_command_window.deactivate @skill_command_window.close @hud_window.activate end #-------------------------------------------------------------------------- # * [Change Equipment] Command #-------------------------------------------------------------------------- def command_equip @slot_window.activate @slot_window.select(0) end #-------------------------------------------------------------------------- # * [Ultimate Equipment] Command #-------------------------------------------------------------------------- def command_optimize Sound.play_equip @actor.optimize_equipments @equipment_status_window.refresh @slot_window.refresh @equipment_command_window.activate end #-------------------------------------------------------------------------- # * [Remove All] Command #-------------------------------------------------------------------------- def command_clear Sound.play_equip @actor.clear_equipments @equipment_status_window.refresh @slot_window.refresh @equipment_command_window.activate end #-------------------------------------------------------------------------- # * Slot [OK] #-------------------------------------------------------------------------- def on_slot_ok @equipment_status_window.open @equipment_item_window.open @equipment_item_window.activate @equipment_item_window.select(0) @equipment_item_window.update_temp_actor end #-------------------------------------------------------------------------- # * Slot [Cancel] #-------------------------------------------------------------------------- def on_slot_cancel @slot_window.unselect @equipment_command_window.activate end #-------------------------------------------------------------------------- # * Item [OK] #-------------------------------------------------------------------------- def on_equipment_item_ok Sound.play_equip @actor.change_equip(@slot_window.index, @equipment_item_window.item) @slot_window.activate @slot_window.refresh @equipment_status_window.refresh @equipment_item_window.unselect @equipment_item_window.deactivate @equipment_item_window.close @equipment_item_window.refresh @equipment_status_window.close end #-------------------------------------------------------------------------- # * Item [Cancel] #-------------------------------------------------------------------------- def on_equipment_item_cancel @slot_window.activate @equipment_item_window.unselect @equipment_item_window.deactivate @equipment_item_window.close @equipment_status_window.close end #-------------------------------------------------------------------------- # * [Equipment Cancel] Command #-------------------------------------------------------------------------- def command_equipment_cancel @menu_index -= 2 @equipment_command_window.close @equipment_command_window.unselect @equipment_command_window.deactivate @slot_window.close Sound.play_cancel @hud_window.select(1) @hud_window.activate @hud_window.change_text_cursor(1) end #-------------------------------------------------------------------------- # * [Equipment Select] Command #-------------------------------------------------------------------------- def command_equipment_select @menu_index += 2 @hud_window.deactivate @equipment_command_window.open @equipment_command_window.select(0) @equipment_command_window.activate @slot_window.open end #-------------------------------------------------------------------------- # * [Status Select] Command #-------------------------------------------------------------------------- def command_status_select @menu_index += 1 @stat_window.refresh @stat_window.open @hud_window.deactivate end #-------------------------------------------------------------------------- # * Confirm Item #-------------------------------------------------------------------------- def determine_skill_item use_skill_item @skill_item_window.refresh @skill_item_window.activate end #-------------------------------------------------------------------------- # * Use Item #-------------------------------------------------------------------------- def use_skill_item Sound.play_use_item user.use_item(skill_item) use_skill_item_to_actors check_common_event check_gameover end #-------------------------------------------------------------------------- # * Get Currently Selected Item #-------------------------------------------------------------------------- def skill_item @skill_item_window.item end #-------------------------------------------------------------------------- # * Get Array of Actors Targeted by Item Use #-------------------------------------------------------------------------- def skill_item_target_actors return [$game_party.members[0]] end #-------------------------------------------------------------------------- # * Determine if Item is Usable #-------------------------------------------------------------------------- def skill_item_usable? user.usable?(skill_item) && skill_item_effects_valid? end #-------------------------------------------------------------------------- # * Determine if Item Is Effective #-------------------------------------------------------------------------- def skill_item_effects_valid? skill_item_target_actors.any? do |target| target.item_test(user, skill_item) end end #-------------------------------------------------------------------------- # * Use Item on Actor #-------------------------------------------------------------------------- def use_skill_item_to_actors skill_item_target_actors.each do |target| skill_item.repeats.times { target.item_apply(user, skill_item) } end end #-------------------------------------------------------------------------- # * Get Currently Selected Item #-------------------------------------------------------------------------- def item @item_window.item end #-------------------------------------------------------------------------- # * Get Item's User #-------------------------------------------------------------------------- def user $game_party.members[0] end #-------------------------------------------------------------------------- # * Use Item #-------------------------------------------------------------------------- def use_item Sound.play_use_item user.use_item(item) use_item_to_actors check_common_event check_gameover @item_window.redraw_current_item end #-------------------------------------------------------------------------- # * Get Array of Actors Targeted by Item Use #-------------------------------------------------------------------------- def item_target_actors [$game_party.members[0]] end #-------------------------------------------------------------------------- # * Use Item on Actor #-------------------------------------------------------------------------- def use_item_to_actors item_target_actors.each do |target| item.repeats.times { target.item_apply(user, item) } end end #-------------------------------------------------------------------------- # * Confirm Item #-------------------------------------------------------------------------- def determine_item use_item @item_window.refresh @item_window.select(0) @item_window.activate end #-------------------------------------------------------------------------- # * Determine if Common Event Is Reserved # Transition to the map screen if the event call is reserved. #-------------------------------------------------------------------------- def check_common_event if $game_temp.common_event_reserved? on_item_cancel on_category_cancel @hud_window.select(0) @hud_window.change_text_cursor(0) @hud_window.deactivate end end #-------------------------------------------------------------------------- # * Update Scene Transition #-------------------------------------------------------------------------- def update_scene check_gameover update_transfer_player unless scene_changing? update_encounter unless scene_changing? update_call_debug unless scene_changing? end #-------------------------------------------------------------------------- # * Aliasing Method: Create All Windows #-------------------------------------------------------------------------- alias :smu4554636316338 :update #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super @hud_window.refresh if @hud_window.need_refresh? $game_map.update(true) $game_timer.update @spriteset.update update_scene if scene_change_ok? case @menu_index when 0 $game_player.update when 1 @hud_window.change_text_cursor(@hud_window.index) if Input.trigger?(:UP) || Input.trigger?(:DOWN) when 2 @stat_window.refresh if @stat_window.playtime != $game_system.playtime_s when 3 case when Input.trigger?(:UP) @equipment_item_window.update_temp_actor when Input.trigger?(:DOWN) @equipment_item_window.update_temp_actor when Input.trigger?(:LEFT) @equipment_item_window.update_temp_actor when Input.trigger?(:RIGHT) @equipment_item_window.update_temp_actor end end if Input.trigger?(:B) case @menu_index when 0 @menu_index += 1 Sound.play_ok @hud_window.select(0) @hud_window.activate @hud_window.change_text_cursor(0) when 1 @menu_index -= 1 Sound.play_cancel @hud_window.unselect @hud_window.deactivate @hud_window.change_text_cursor(nil) when 2 @menu_index -= 1 @stat_window.close Sound.play_cancel @hud_window.select(0) @hud_window.activate @hud_window.change_text_cursor(0) end end end end