# Custom Menu System # Custom Menu System # - Stylized with Dropdown Menus # Includes: # - Unlimited character support # - Quest/Key Item Support (by rpgmaker) # - Organized Menus by Items, Weapons, Armors, and Key Items # - Advanced Equip Screen (by RPG-Advocate) # - Reorganized Status Screen # - Horizontal Menus # - Transparent Windows # - Single Scene interface [lag reduction] # - Map Name Window # - Support for Deke/Near Fantastica's day*night system # # Instruction Manual: # # Step 1 - copy and paste this line into Window_Base under def initialize # self.back_opacity = 160 # You can remove this line if you do not wish for transparent menu windows. # # Step 2 - copy and paste these lines at the end of Window_Base before the # last end: # def draw_actor_face(actor,x,y) # bitmap = RPG::Cache.picture(actor.name + ".png") # self.contents.blt(x,y,bitmap,Rect.new(0,0,100,100)) # end # This is for FaceSet support. You can remove this by searching for # draw_actor_face and removing the line and the def draw_actor_face code. # If you keep this code, you will require 100x100 png files in the Pictures # directory named after the characters they correspond to. # Example: Arshes' face image is called Arshes.png # # Step 3 - Add this line: # @help_window.y = 0 # between these lines: # @help_window = Window_Help.new # and # @help_window.set_text(@help_text) # in Scene_File. This is mandatory. # # Step 4 - Add this to Game_Map at the end: # def name # $map_infos[@map_id] # end # Also add this to Scene_Title after $data_system in def main # $map_infos = load_data("Data/MapInfos.rxdata") # for key in $map_infos.keys # $map_infos[key] = $map_infos[key].name # end # Thats for the map location window. # # Support for Deke/Near Fantastica's Day and Night System: # Currently the script has this commented out, so that it doesn't interfere. # If you wish to support this, run a search in this file for D&N Script # Instructions will be there for you to follow. # Also, make sure that the D&N system script is below this one in the list # # Support for the Key Items window is as follows: # Create 4 new elements in the Database (system tab) # Make them IDs 17, 18, 19, and 20 and name them: # 0017: Items # 0018: Weapons # 0019: Armor # 0020: Quest Items # Now, in the database, give the corresponding items the corresponding elements # You'll need to do this for every item and such. If one item has both ids it # will show in both menus (Such as Items/Quest Items) # # Thats it. Enjoy ^^; # - Prexus class Window_Item < Window_Selectable def initialize(wintype = 1, element_id = 17) super(0, 64, 640, 352) @element_id = element_id @wintype = wintype @column_max = 2 if $game_temp.in_battle @column_max = 1 self.x = 308 self.y = 80 self.width = 316 self.height = 196 self.back_opacity = 160 end self.index = 0 refresh end def item return @data[self.index] end def setids(wintype, element_id) @wintype = wintype @element_id = element_id refresh end def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] if @wintype == 1 for i in 1...$data_items.size if $game_party.item_number(i) > 0 if $data_items != nil and ($data_items[i].element_set.include?(@element_id)) @data.push($data_items[i]) end end end elsif @wintype == 2 for i in 1...$data_weapons.size if $game_party.weapon_number(i) > 0 if $data_weapons[i] != nil and ($data_weapons[i].element_set.include?(@element_id)) @data.push($data_weapons[i]) end end end elsif @wintype == 3 for i in 1...$data_armors.size if $game_party.armor_number(i) > 0 if $data_armors[i] != nil @data.push($data_armors[i]) end end end end @item_max = @data.size if @item_max > 0 self.contents = Bitmap.new(width - 32, row_max * 32) self.contents.font.name = "Arial" self.contents.font.size = 24 for i in 0...@item_max draw_item(i) end end end def draw_item(index) item = @data[index] case item when RPG::Item number = $game_party.item_number(item.id) when RPG::Weapon number = $game_party.weapon_number(item.id) when RPG::Armor number = $game_party.armor_number(item.id) end if item.is_a?(RPG::Item) if $game_party.item_can_use?(item.id) self.contents.font.color = normal_color else disabled_color end else self.contents.font.color = normal_color end if $game_temp.in_battle x = 4 y = index * 32 else x = 4 + index % 2 * (288 + 32) y = index / 2 * 32 end rect = Rect.new(x, y, self.width / @column_max - 32, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) bitmap = RPG::Cache.icon(item.icon_name) opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(x, y, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.draw_text(x + 28, y, 212, 32, item.name, 0) self.contents.draw_text(x + 240, y, 16, 32, "x", 1) self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2) end def update_help @help_window.set_text(self.item == nil ? "" : self.item.description) end end class Window_MapName < Window_Base def initialize super(0, 0, 160, 96) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Arial" self.contents.font.size = 24 refresh end def refresh self.contents.clear self.contents.font.color = system_color self.contents.draw_text(4, 0, 120, 32, "Location") self.contents.font.color = normal_color self.contents.draw_text(4, 32, 120, 32, $game_map.to_s, 2) end end class Window_EquipLeft < Window_Base attr_accessor :mode attr_accessor :changes def initialize(actor) super(0, 64, 272, 352) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Arial" self.contents.font.size = 24 self.z += 100 actor_num = actor.id @actor = actor refresh end def update_actor(actor) @actor = actor actor_num = actor.id refresh end def refresh self.contents.clear draw_actor_name(@actor, 4, 0) draw_actor_level(@actor, 4, 32) draw_actor_parameter(@actor, 4, 64, 0) draw_actor_parameter(@actor, 4, 96, 1) draw_actor_parameter(@actor, 4, 128, 2) draw_actor_parameter(@actor, 4, 192, 3) draw_actor_parameter(@actor, 4, 224, 4) draw_actor_parameter(@actor, 4, 256, 5) draw_actor_parameter(@actor, 4, 288, 6) if @new_atk != nil self.contents.font.color = system_color self.contents.draw_text(160, 64, 40, 32, "?", 1) self.contents.font.color = @actor.atk < @new_atk ? system_color : @actor.atk > @new_atk ? disabled_color : normal_color self.contents.draw_text(200, 64, 36, 32, @new_atk.to_s, 2) end if @new_pdef != nil self.contents.font.color = system_color self.contents.draw_text(160, 96, 40, 32, "?", 1) self.contents.font.color = @actor.pdef < @new_pdef ? system_color : @actor.pdef > @new_pdef ? disabled_color : normal_color self.contents.draw_text(200, 96, 36, 32, @new_pdef.to_s, 2) end if @new_mdef != nil self.contents.font.color = system_color self.contents.draw_text(160, 128, 40, 32, "?", 1) self.contents.font.color = @actor.mdef < @new_mdef ? system_color : @actor.mdef > @new_mdef ? disabled_color : normal_color self.contents.draw_text(200, 128, 36, 32, @new_mdef.to_s, 2) end if @new_str != nil self.contents.font.color = system_color self.contents.draw_text(160, 192, 40, 32, "?", 1) self.contents.font.color = @actor.str < @new_str ? system_color : @actor.str > @new_str ? disabled_color : normal_color self.contents.draw_text(200, 192, 36, 32, @new_str.to_s, 2) end if @new_dex != nil self.contents.font.color = system_color self.contents.draw_text(160, 224, 40, 32, "?", 1) self.contents.font.color = @actor.dex < @new_dex ? system_color : @actor.dex > @new_dex ? disabled_color : normal_color self.contents.draw_text(200, 224, 36, 32, @new_dex.to_s, 2) end if @new_agi != nil self.contents.font.color = system_color self.contents.draw_text(160, 256, 40, 32, "?", 1) self.contents.font.color = @actor.agi < @new_agi ? system_color : @actor.agi > @new_agi ? disabled_color : normal_color self.contents.draw_text(200, 256, 36, 32, @new_agi.to_s, 2) end if @new_int != nil self.contents.font.color = system_color self.contents.draw_text(160, 288, 40, 32, "?", 1) self.contents.font.color = @actor.int < @new_int ? system_color : @actor.int > @new_int ? disabled_color : normal_color self.contents.draw_text(200, 288, 36, 32, @new_int.to_s, 2) end end def set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex, new_agi, new_int) flag = false if new_atk != @new_atk new_pdef != @new_pdef new_mdef != @new_mdef flag = true end if new_str != @new_str new_dex != @new_dex new_agi != @new_agi flag = true end if new_int != @new_int flag = true end @new_atk = new_atk @new_pdef = new_pdef @new_mdef = new_mdef @new_str = new_str @new_dex = new_dex @new_agi = new_agi @new_int = new_int if flag refresh end end def draw_actor_parameter(actor, x, y, type) case type when 0 parameter_name = $data_system.words.atk parameter_value = actor.atk when 1 parameter_name = $data_system.words.pdef parameter_value = actor.pdef when 2 parameter_name = $data_system.words.mdef parameter_value = actor.mdef when 3 parameter_name = $data_system.words.str parameter_value = actor.str when 4 parameter_name = $data_system.words.dex parameter_value = actor.dex when 5 parameter_name = $data_system.words.agi parameter_value = actor.agi when 6 parameter_name = $data_system.words.int parameter_value = actor.int end self.contents.font.color = system_color self.contents.draw_text(x, y, 112, 32, parameter_name) self.contents.font.color = normal_color self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2) end end class Window_EquipItem < Window_Selectable def initialize(actor, equip_type) super(0, 256, 640, 160) @actor = actor @equip_type = equip_type @column_max = 2 refresh self.active = false self.index = -1 end def item return @data[self.index] end def update_actor(actor, equip_type) @actor = actor @equip_type = equip_type refresh end def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] if @equip_type == 0 weapon_set = $data_classes[@actor.class_id].weapon_set for i in 1...$data_weapons.size if $game_party.weapon_number(i) > 0 and weapon_set.include?(i) @data.push($data_weapons[i]) end end end if @equip_type != 0 armor_set = $data_classes[@actor.class_id].armor_set for i in 1...$data_armors.size if $game_party.armor_number(i) > 0 and armor_set.include?(i) if $data_armors[i].kind == @equip_type-1 @data.push($data_armors[i]) end end end end @data.push(nil) @item_max = @data.size self.contents = Bitmap.new(width - 32, row_max * 32) self.contents.font.name = "Arial" self.contents.font.size = 24 for i in 0...@item_max-1 draw_item(i) end end def draw_item(index) item = @data[index] x = 4 + index % 2 * (288 + 32) y = index / 2 * 32 case item when RPG::Weapon number = $game_party.weapon_number(item.id) when RPG::Armor number = $game_party.armor_number(item.id) end bitmap = RPG::Cache.icon(item.icon_name) self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24)) self.contents.font.color = normal_color self.contents.draw_text(x + 28, y, 212, 32, item.name, 0) self.contents.draw_text(x + 240, y, 16, 32, ":", 1) self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2) end def update_help @help_window.set_text(self.item == nil ? "" : self.item.description) end end class Window_EquipItem < Window_Selectable alias xrxs_mp1_initialize initialize def initialize(actor, equip_type) xrxs_mp1_initialize(actor, equip_type) self.x = 272 self.width = 368 self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Arial" self.contents.font.size = 24 @column_max = 1 refresh end def item return @data[self.index] end def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] if @equip_type == 0 weapon_set = $data_classes[@actor.class_id].weapon_set for i in 1...$data_weapons.size if $game_party.weapon_number(i) > 0 and weapon_set.include?(i) @data.push($data_weapons[i]) end end end if @equip_type != 0 armor_set = $data_classes[@actor.class_id].armor_set for i in 1...$data_armors.size if $game_party.armor_number(i) > 0 and armor_set.include?(i) if $data_armors[i].kind == @equip_type-1 @data.push($data_armors[i]) end end end end @data.push(nil) @item_max = @data.size self.contents = Bitmap.new(width - 32, row_max * 32) self.contents.font.name = "Arial" self.contents.font.size = 24 for i in 0...@item_max-1 draw_item(i) end s = @data.size-1 self.contents.draw_text(4, s*32, 100, 32, "[Remove]") end def draw_item(index) item = @data[index] x = 4 y = index * 32 case item when RPG::Weapon number = $game_party.weapon_number(item.id) when RPG::Armor number = $game_party.armor_number(item.id) end bitmap = RPG::Cache.icon(item.icon_name) self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24)) self.contents.font.color = normal_color self.contents.draw_text(x + 28, y, 212, 32, item.name, 0) self.contents.draw_text(x + 288, y, 16, 32, ":", 1) self.contents.draw_text(x + 304, y, 24, 32, number.to_s, 2) end def update_help @help_window.set_text(self.item == nil ? "" : self.item.description) end end class Window_Target < Window_Selectable def initialize super(0, 64, 336, 352) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Arial" self.contents.font.size = 24 self.z += 10 @item_max = $game_party.actors.size refresh end def refresh self.contents.clear for i in 0...$game_party.actors.size x = 4 y = i * 84 actor = $game_party.actors[i] draw_actor_name(actor, x, y) draw_actor_state(actor, x + 144, y) draw_actor_hp(actor, x, y + 32) draw_actor_sp(actor, x + 152, y + 32) end end def update_cursor_rect self.cursor_rect.set(0, @index * 84, self.width - 32, 64) end end class Window_MenuStatus < Window_Selectable def initialize super(0, 0, 128, $game_party.actors.size*32+32) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Arial" self.contents.font.size = 24 refresh self.active = false self.index = 0 end def refresh self.contents.clear @item_max = $game_party.actors.size for i in 0...$game_party.actors.size x = 4 y = i * 32 actor = $game_party.actors[i] draw_actor_name(actor, x, y) end end def update_cursor_rect if @index < 0 self.cursor_rect.empty else self.cursor_rect.set(0, @index * 32, self.width - 32, 32) end end end class Window_Status < Window_Base def initialize(actor) super(0, 64, 480, 416) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Arial" self.contents.font.size = 24 @actor = actor refresh end def update_actor(actor) @actor = actor refresh end def refresh self.contents.clear #draw_actor_face(@actor,0,32) draw_actor_graphic(@actor, 24, 144) draw_actor_name(@actor, 4, 0) draw_actor_class(@actor, 4 + 144, 0) draw_actor_level(@actor, 96, 32) draw_actor_state(@actor, 180, 32) draw_actor_hp(@actor, 96, 112-32, 172) draw_actor_sp(@actor, 96, 144-32, 172) draw_actor_parameter(@actor, 96, 224+16, 3) draw_actor_parameter(@actor, 96, 256+16, 4) draw_actor_parameter(@actor, 96, 288+16, 5) draw_actor_parameter(@actor, 96, 320+16, 6) self.contents.font.color = system_color self.contents.draw_text(96, 160, 80, 32, "EXP") self.contents.draw_text(96, 192, 80, 32, "NEXT") self.contents.font.color = normal_color self.contents.draw_text(96 + 80, 160, 84, 32, @actor.exp_s, 2) self.contents.draw_text(96 + 80, 192, 84, 32, @actor.next_rest_exp_s, 2) self.contents.font.color = system_color self.contents.draw_text(280, 32, 96, 32, "Equipment") draw_item_name($data_weapons[@actor.weapon_id], 280, 64) draw_item_name($data_armors[@actor.armor1_id], 280, 96) draw_item_name($data_armors[@actor.armor2_id], 280, 128) draw_item_name($data_armors[@actor.armor3_id], 280, 160) draw_item_name($data_armors[@actor.armor4_id], 280, 192) draw_actor_parameter(@actor, 280, 256+16, 0) draw_actor_parameter(@actor, 280, 288+16, 1) draw_actor_parameter(@actor, 280, 320+16, 2) end end class Window_Skill < Window_Selectable def initialize(actor) super(0, 128, 640, 288) @actor = actor @column_max = 1 refresh self.index = 0 if $game_temp.in_battle @column_max = 1 self.x = 308 self.y = 80 self.width = 316 self.height = 196 self.back_opacity = 160 end end def skill return @data[self.index] end def update_actor(actor) @actor = actor refresh end def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] for i in 0...@actor.skills.size skill = $data_skills[@actor.skills[i]] if skill != nil @data.push(skill) end end @item_max = @data.size if @item_max > 0 self.contents = Bitmap.new(width - 32, row_max * 32) self.contents.font.name = "Arial" self.contents.font.size = 24 for i in 0...@item_max draw_item(i) end end end def draw_item(index) skill = @data[index] if @actor.skill_can_use?(skill.id) self.contents.font.color = normal_color else self.contents.font.color = disabled_color end if $game_temp.in_battle x = 4 y = index * 32 else x = 4 + index % 2 * (288 + 32) y = index / 2 * 32 end rect = Rect.new(x, y, self.width / @column_max - 32, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) bitmap = RPG::Cache.icon(skill.icon_name) opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0) self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2) end def update_help @help_window.set_text(self.skill == nil ? "" : self.skill.description) end end class Window_SkillStatus < Window_Base def initialize(actor) super(0, 64, 640, 64) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Arial" self.contents.font.size = 24 @actor = actor refresh end def update_actor(actor) @actor = actor refresh end def refresh self.contents.clear draw_actor_name(@actor, 4, 0) draw_actor_state(@actor, 140, 0) draw_actor_hp(@actor, 284, 0) draw_actor_sp(@actor, 460, 0) end end class Window_Help < Window_Base def initialize super(0, 416, 640, 64) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Arial" self.contents.font.size = 24 if $game_temp.in_battle self.y = 0 self.back_opacity = 160 end end def set_text(text, align = 0) if text != @text or align != @align self.contents.clear self.contents.font.color = normal_color self.contents.draw_text(4, 0, self.width - 40, 32, text, align) @text = text @align = align @actor = nil end self.visible = true end def set_actor(actor) if actor != @actor self.contents.clear draw_actor_name(actor, 4, 0) draw_actor_state(actor, 140, 0) draw_actor_hp(actor, 284, 0) draw_actor_sp(actor, 460, 0) @actor = actor @text = nil self.visible = true end end def set_enemy(enemy) text = enemy.name state_text = make_battler_state_text(enemy, 112, false) if state_text != "" text += " " + state_text end set_text(text, 1) end end class Window_EquipRight < Window_Selectable def initialize(actor) super(272, 64, 368, 192) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Arial" self.contents.font.size = 24 @actor = actor refresh self.index = 0 end def item return @data[self.index] end def update_actor(actor) @actor = actor refresh end def refresh self.contents.clear @data = [] @data.push($data_weapons[@actor.weapon_id]) @data.push($data_armors[@actor.armor1_id]) @data.push($data_armors[@actor.armor2_id]) @data.push($data_armors[@actor.armor3_id]) @data.push($data_armors[@actor.armor4_id]) @item_max = @data.size self.contents.font.color = system_color self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon) self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1) self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2) self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3) self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4) draw_item_name(@data[0], 92, 32 * 0) draw_item_name(@data[1], 92, 32 * 1) draw_item_name(@data[2], 92, 32 * 2) draw_item_name(@data[3], 92, 32 * 3) draw_item_name(@data[4], 92, 32 * 4) end def update_help @help_window.set_text(self.item == nil ? "" : self.item.description) end end class Menu_Selectable < Window_Base attr_reader :index attr_reader :help_window def initialize(x, y, width, height) super(x, y, width, height) @item_max = 1 @column_max = 1 @index = -1 end def index=(index) @index = index if @help_window != nil update_help end update_cursor_rect end def row_max return (@item_max + @column_max - 1) / @column_max end def top_row return self.oy / 32 end def top_row=(row) if row < 0 row = 0 end if row > row_max - 1 row = row_max - 1 end self.oy = row * 32 end def page_row_max return (self.height - 32) / 32 end def page_item_max return page_row_max * @column_max end def help_window=(help_window) @help_window = help_window if @help_window != nil update_help end end def update_cursor_rect if @index < 0 self.cursor_rect.empty return end row = @index / @column_max if row < self.top_row self.top_row = row end if row > self.top_row + (self.page_row_max - 1) self.top_row = row - (self.page_row_max - 1) end cursor_width = self.width / @column_max - 32 x = @index % @column_max * (cursor_width + 32) y = @index / @column_max * 128 self.cursor_rect.set(y, x, 100, 32) end def update super if self.active and @item_max > 0 and @index >= 0 if Input.repeat?(Input::RIGHT) if (@column_max == 1 and Input.trigger?(Input::LEFT)) or @index < @item_max - @column_max $game_system.se_play($data_system.cursor_se) @index = (@index + @column_max) % @item_max end end if Input.repeat?(Input::LEFT) if (@column_max == 1 and Input.trigger?(Input::UP)) or @index >= @column_max $game_system.se_play($data_system.cursor_se) @index = (@index - @column_max + @item_max) % @item_max end end if Input.repeat?(Input::RIGHT) if @column_max >= 2 and @index < @item_max - 1 $game_system.se_play($data_system.cursor_se) @index += 1 end end if Input.repeat?(Input::LEFT) if @column_max >= 2 and @index > 0 $game_system.se_play($data_system.cursor_se) @index -= 1 end end if Input.repeat?(Input::R) if self.top_row + (self.page_row_max - 1) < (self.row_max - 1) $game_system.se_play($data_system.cursor_se) @index = [@index + self.page_item_max, @item_max - 1].min self.top_row += self.page_row_max end end if Input.repeat?(Input::L) if self.top_row > 0 $game_system.se_play($data_system.cursor_se) @index = [@index - self.page_item_max, 0].max self.top_row -= self.page_row_max end end end if @help_window != nil update_help end update_cursor_rect end end class Window_MenuCommand < Window_Selectable def initialize(width, commands) super(0, 0, width, commands.size * 32 + 32) @item_max = commands.size @commands = commands self.contents = Bitmap.new(width - 32, @item_max * 32) self.contents.font.name = "Arial" self.contents.font.size = 24 refresh self.index = 0 end def refresh self.contents.clear for i in 0...@item_max draw_item(i, normal_color) end end def draw_item(index, color) self.contents.font.color = color rect = Rect.new(4, 32 * index, self.contents.width - 8, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) self.contents.draw_text(rect, @commands[index],1) end def disable_item(index) draw_item(index, disabled_color) end end class Menu_Command < Menu_Selectable def initialize(width, commands) super(0, 0, 700, 500) @item_max = commands.size @commands = commands self.contents = Bitmap.new(width - 32, @item_max * 32) self.contents.font.name = "Arial" self.contents.font.size = 24 self.back_opacity = 0 refresh self.index = 0 end def refresh self.contents.clear for i in 0...@item_max draw_item(i, normal_color) end end def draw_item(index, color) self.contents.font.color = color rect = Rect.new(-16+128*index, 5, 128, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) self.contents.draw_text(rect, @commands[index],1) end def disable_item(index) draw_item(index, disabled_color) end end # D&N Script - If you are using the script, uncomment all of this. # class Window_Time < Window_Base # def initialize #super(0, 0, 160, 64) #self.contents = Bitmap.new(width - 32, height - 32) #self.contents.font.name = "Arial" # "Time" window font #self.contents.font.size = 24 #refresh #end #def refresh #self.contents.clear #@total_sec = Graphics.frame_count / Graphics.frame_rate #@minute=$game_time.get_minute.floor #hour = $game_time.get_hour #pm_flag= hour >=12 ? true : false #hour= hour >= 12 ? hour-12 : hour #day=$game_time.get_day #month=$game_time.get_month #year=$game_time.get_year #if hour.floor==0 #text=sprintf("%02d:%02d",12,@minute) #else #text=sprintf("%02d:%02d",hour,@minute) #end #if pm_flag # text += " PM" #else #text += " AM" #end #self.contents.font.color = normal_color #self.contents.draw_text(4, 0, 120, 32, text, 2) #end #def update #if $game_time.get_minute.floor != @minute #refresh #end #end #end class Scene_Menu def initialize(menu_index = 0, actor_index = 0, equip_index = 0) @menu_index = menu_index @actor_index = actor_index @equip_index = equip_index end def main #@sprite = Spriteset_Map.new s1 = $data_system.words.item s2 = $data_system.words.equip s3 = $data_system.words.skill s4 = "Status" s5 = "Game" @dummy_window = Window_Base.new(0, 0, 640, 64) @command_window = Menu_Command.new(640, [s1, s2, s3, s4, s5]) @command_window.index = @menu_index @command_window.width = 700 @command_window.height = 500 @command_window.y = -5 @command_window.x = -5 @command_window.opacity = 0 @command_window.z += 10 @dummy_window.z += 10 if $game_party.actors.size == 0 @command_window.disable_item(0) @command_window.disable_item(1) @command_window.disable_item(2) @command_window.disable_item(3) end @playtime_window = Window_PlayTime.new @playtime_window.x = 640-@playtime_window.width @playtime_window.y = 64 @playtime_window.visible = false @playtime_window.active = false @mapname_window = Window_MapName.new @mapname_window.x = 640-@mapname_window.width @mapname_window.y = @playtime_window.y+@playtime_window.height @mapname_window.visible = false @mapname_window.active = false @steps_window = Window_Steps.new @steps_window.x = 640-@steps_window.width @steps_window.y = @playtime_window.y+@playtime_window.height + 96 @steps_window.visible = false @steps_window.active = false @gold_window = Window_Gold.new @gold_window.x = 640-@gold_window.width @gold_window.y = @steps_window.y+@steps_window.height @gold_window.visible = false @gold_window.active = false # D&N script #This is for use with Deke/NearFantasticas day night system, uncomment it if #you have this script. #@time_window = Window_Time.new #@time_window.x = 640-@time_window.width #@time_window.y = @gold_window.y+@gold_window.height #@time_window.visible = false #@time_window.active = false @help_window = Window_Help.new @help_window.x = 0 @help_window.y = 416 @item_window = Window_Item.new(1, 17) @item_window.help_window = @help_window @item_window.visible = false @item_window.active = false @drop1 = Window_MenuCommand.new(128,["Basic", "Weapons", "Armor", "Quest"]) @drop1.x = 0 @drop1.y = 64 @drop1.visible = false @drop1.active = false @drop2 = Window_MenuStatus.new @drop2.x = 128 @drop2.y = 64 @drop2.visible = false @drop2.active = false @drop3 = Window_MenuCommand.new(128,["Save","Quit"]) @drop3.x = 640-128 @drop3.y = 64 @drop3.visible = false @drop3.active = false @target_window = Window_Target.new @target_window.visible = false @target_window.active = false @actor = $game_party.actors[@actor_index] @equiphelp_window = Window_Help.new @left_window = Window_EquipLeft.new(@actor) @left_window.visible = false @left_window.active = false @right_window = Window_EquipRight.new(@actor) @right_window.help_window = @equiphelp_window @right_window.visible = false @right_window.active = false @item_window1 = Window_EquipItem.new(@actor, 0) @item_window1.help_window = @equiphelp_window @item_window1.visible = false @item_window1.active = false @item_window2 = Window_EquipItem.new(@actor, 1) @item_window2.help_window = @equiphelp_window @item_window2.visible = false @item_window2.active = false @item_window3 = Window_EquipItem.new(@actor, 2) @item_window3.help_window = @equiphelp_window @item_window3.visible = false @item_window3.active = false @item_window4 = Window_EquipItem.new(@actor, 3) @item_window4.help_window = @equiphelp_window @item_window4.visible = false @item_window4.active = false @item_window5 = Window_EquipItem.new(@actor, 4) @item_window5.help_window = @equiphelp_window @item_window5.visible = false @item_window5.active = false @equiphelp_window.active = false @equiphelp_window.visible = false @right_window.index = @equip_index @skillstatus_window = Window_SkillStatus.new(@actor) @skillstatus_window.visible = false @skillstatus_window.active = false @skill_window = Window_Skill.new(@actor) @skill_window.help_window = @help_window @skill_window.visible = false @skill_window.active = false @help_window.visible = false @help_window.active = false @skilltarget_window = Window_Target.new @skilltarget_window.visible = false @skilltarget_window.active = false @playerstatus_window = Window_Status.new(@actor) @playerstatus_window.visible = false @playerstatus_window.active = false Graphics.transition loop do Graphics.update Input.update update if $scene != self break end end Graphics.freeze @help_window.dispose @item_window.dispose @target_window.dispose @drop1.dispose @drop2.dispose @drop3.dispose @dummy_window.dispose @command_window.dispose @playtime_window.dispose @steps_window.dispose @mapname_window.dispose @gold_window.dispose #You will also have to take out this comment for the D&N script #@time_window.dispose @equiphelp_window.dispose @left_window.dispose @right_window.dispose @item_window1.dispose @item_window2.dispose @item_window3.dispose @item_window4.dispose @item_window5.dispose @skillstatus_window.dispose @skill_window.dispose @skilltarget_window.dispose @playerstatus_window.dispose end def equip_refresh @item_window1.visible = (@right_window.index == 0) @item_window2.visible = (@right_window.index == 1) @item_window3.visible = (@right_window.index == 2) @item_window4.visible = (@right_window.index == 3) @item_window5.visible = (@right_window.index == 4) item1 = @right_window.item case @right_window.index when 0 @eitem_window = @item_window1 newmode = 0 when 1 @eitem_window = @item_window2 newmode = 1 when 2 @eitem_window = @item_window3 newmode = 1 when 3 @eitem_window = @item_window4 newmode = 1 when 4 @eitem_window = @item_window5 newmode = 1 end if newmode != @left_window.mode @left_window.mode = newmode @left_window.refresh end if @right_window.active @left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil) end if @eitem_window.active item2 = @eitem_window.item last_hp = @actor.hp old_atk = @actor.atk old_pdef = @actor.pdef old_mdef = @actor.mdef old_str = @actor.str old_dex = @actor.dex old_agi = @actor.agi old_int = @actor.int old_eva = @actor.eva @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id) new_atk = @actor.atk new_pdef = @actor.pdef new_mdef = @actor.mdef new_str = @actor.str new_dex = @actor.dex new_agi = @actor.agi new_int = @actor.int new_eva = @actor.eva @left_window.changes = [0, 0, 0, 0, 0, 0, 0, 0] if new_atk > old_atk @left_window.changes[0] = 1 end if new_atk < old_atk @left_window.changes[0] = -1 end if new_pdef > old_pdef @left_window.changes[1] = 1 end if new_pdef < old_pdef @left_window.changes[1] = -1 end if new_mdef > old_mdef @left_window.changes[2] = 1 end if new_mdef < old_mdef @left_window.changes[2] = -1 end if new_str > old_str @left_window.changes[3] = 1 end if new_str < old_str @left_window.changes[3] = -1 end if new_dex > old_dex @left_window.changes[4] = 1 end if new_dex < old_dex @left_window.changes[4] = -1 end if new_agi > old_agi @left_window.changes[5] = 1 end if new_agi < old_agi @left_window.changes[5] = -1 end if new_int > old_int @left_window.changes[6] = 1 end if new_int < old_int @left_window.changes[6] = -1 end @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id) @actor.hp = last_hp @left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex, new_agi, new_int) end end def update @help_window.update @item_window.update @target_window.update @dummy_window.update @mapname_window.update @drop1.update @drop2.update @drop3.update @command_window.update @playtime_window.update @steps_window.update @gold_window.update #You'll also have to take out this comment for the D&N script #@time_window.update @left_window.update @right_window.update @equiphelp_window.update @skillstatus_window.update @skill_window.update @skilltarget_window.update @playerstatus_window.update if @playerstatus_window.active update_playerstatus return end if @skill_window.active update_skill return end if @skilltarget_window.active update_skilltarget return end if @eitem_window != nil if @eitem_window.visible equip_refresh @eitem_window.update end end if @right_window.active update_right return end if @eitem_window != nil if @eitem_window.active update_eitem return end end if @command_window.active update_command return end if @drop1.active update_drop1 return end if @drop2.active update_drop2 return end if @drop3.active update_drop3 return end if @item_window.active update_item return end if @target_window.active update_target return end end def update_playerstatus if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @playerstatus_window.active = false @playerstatus_window.visible = false @playtime_window.visible = false @gold_window.visible = false @steps_window.visible = false @mapname_window.visible = false # D&N Script - Uncomment this line: #@time_window.visible = false @command_window.active = true return end end def update_skill if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @skill_window.active = false @skill_window.visible = false @skillstatus_window.visible = false @help_window.visible = false @command_window.active = true return end if Input.trigger?(Input::C) @skill = @skill_window.skill if @skill == nil or not @actor.skill_can_use?(@skill.id) $game_system.se_play($data_system.buzzer_se) return end $game_system.se_play($data_system.decision_se) if @skill.scope >= 3 @skill_window.active = false @skilltarget_window.x = (@skill_window.index + 1) % 2 * 304 @skilltarget_window.visible = true @skilltarget_window.active = true if @skill.scope == 4 @skill.scope == 6 @skilltarget_window.index = -1 elsif @skill.scope == 7 @skilltarget_window.index = @actor_index - 10 else @skilltarget_window.index = 0 end else if @skill.common_event_id > 0 $game_temp.common_event_id = @skill.common_event_id $game_system.se_play(@skill.menu_se) @actor.sp -= @skill.sp_cost @skillstatus_window.refresh @skill_window.refresh @skilltarget_window.refresh $scene = Scene_Map.new return end end return end end def update_skilltarget if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @skill_window.active = true @skilltarget_window.visible = false @skilltarget_window.active = false return end if Input.trigger?(Input::C) unless @actor.skill_can_use?(@skill.id) $game_system.se_play($data_system.buzzer_se) return end if @skilltarget_window.index == -1 used = false for i in $game_party.actors used |= i.skill_effect(@actor, @skill) end end if @skilltarget_window.index <= -2 target = $game_party.actors[@skilltarget_window.index + 10] used = target.skill_effect(@actor, @skill) end if @skilltarget_window.index >= 0 target = $game_party.actors[@skilltarget_window.index] used = target.skill_effect(@actor, @skill) end if used $game_system.se_play(@skill.menu_se) @actor.sp -= @skill.sp_cost @skillstatus_window.refresh @skill_window.refresh @skilltarget_window.refresh if $game_party.all_dead? $scene = Scene_Gameover.new return end if @skill.common_event_id > 0 $game_temp.common_event_id = @skill.common_event_id $scene = Scene_Map.new return end end unless used $game_system.se_play($data_system.buzzer_se) end return end end def update_right if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @right_window.visible = false @right_window.active = false @left_window.visible = false @equiphelp_window.visible = false @item_window1.visible = false @item_window2.visible = false @item_window3.visible = false @item_window4.visible = false @item_window5.visible = false @eitem_window.visible = false @command_window.active = true return end if Input.trigger?(Input::C) if @actor.equip_fix?(@right_window.index) $game_system.se_play($data_system.buzzer_se) return end $game_system.se_play($data_system.decision_se) @right_window.active = false @eitem_window.active = true @eitem_window.index = 0 return end end def update_eitem if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @right_window.active = true @eitem_window.active = false @eitem_window.index = -1 return end if Input.trigger?(Input::C) $game_system.se_play($data_system.equip_se) item = @eitem_window.item @actor.equip(@right_window.index, item == nil ? 0 : item.id) @right_window.active = true @eitem_window.active = false @eitem_window.index = -1 @right_window.refresh @eitem_window.refresh return end end def update_command if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) $scene = Scene_Map.new return end if Input.trigger?(Input::C) if $game_party.actors.size == 0 and @command_window.index < 4 $game_system.se_play($data_system.buzzer_se) return end case @command_window.index when 0 $game_system.se_play($data_system.decision_se) @command_window.active = false @drop1.visible = true @drop1.active = true return when 1 $game_system.se_play($data_system.decision_se) @command_window.active = false @drop2.x = 128 @drop2.visible = true @drop2.active = true return when 2 $game_system.se_play($data_system.decision_se) @command_window.active = false @drop2.x = 256 @drop2.visible = true @drop2.active = true return when 3 $game_system.se_play($data_system.decision_se) @command_window.active = false @drop2.x = 384 @drop2.visible = true @drop2.active = true return when 4 $game_system.se_play($data_system.decision_se) @command_window.active = false @drop3.visible = true @drop3.active = true return end return end end def update_drop1 if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @drop1.visible = false @drop1.active = false @drop1.index = 0 @command_window.active = true return end if Input.trigger?(Input::C) case @drop1.index when 0 @item_window.setids(1,17) when 1 @item_window.setids(2, 18) when 2 @item_window.setids(3, 19) when 3 @item_window.setids(1, 20) end @drop1.visible = false @drop1.active = false @drop1.index = 0 @item_window.visible = true @item_window.active = true @help_window.visible = true return end end def update_drop2 if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @drop2.visible = false @drop2.active = false @drop2.index = 0 @command_window.active = true return end if Input.trigger?(Input::C) case @command_window.index when 1 $game_system.se_play($data_system.decision_se) @actor = $game_party.actors[@drop2.index] @right_window.update_actor(@actor) @left_window.update_actor(@actor) @item_window1.update_actor(@actor, 0) @item_window2.update_actor(@actor, 1) @item_window3.update_actor(@actor, 2) @item_window4.update_actor(@actor, 3) @item_window5.update_actor(@actor, 4) @right_window.index = 0 @drop2.visible = false @drop2.active = false @drop2.index = 0 @right_window.visible = true @right_window.active = true @left_window.visible = true @equiphelp_window.visible = true @item_window1.visible = true @item_window2.visible = true @item_window3.visible = true @item_window4.visible = true @item_window5.visible = true equip_refresh return when 2 $game_system.se_play($data_system.decision_se) @actor = $game_party.actors[@drop2.index] @skill_window.update_actor(@actor) @drop2.visible = false @drop2.active = false @drop2.index = 0 @skill_window.visible = true @skill_window.active = true @skillstatus_window.visible = true @skillstatus_window.update_actor(@actor) @help_window.visible = true return when 3 $game_system.se_play($data_system.decision_se) @actor = $game_party.actors[@drop2.index] @playerstatus_window.update_actor(@actor) @drop2.visible = false @drop2.active = false @drop2.index = 0 @playerstatus_window.visible = true @playerstatus_window.active = true @playtime_window.visible = true @gold_window.visible = true @mapname_window.visible = true @steps_window.visible = true # D&N Script - Uncomment this line. #@time_window.visible = true return end end end def update_drop3 if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @drop3.visible = false @drop3.active = false @drop3.index = 0 @command_window.active = true return end if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) case @drop3.index when 0 $scene = Scene_Save.new when 1 $scene = Scene_End.new end end end def update_item if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @item_window.active = false @item_window.visible = false @help_window.visible = false @command_window.active = true return end if Input.trigger?(Input::C) @item = @item_window.item unless @item.is_a?(RPG::Item) $game_system.se_play($data_system.buzzer_se) return end unless $game_party.item_can_use?(@item.id) $game_system.se_play($data_system.buzzer_se) return end $game_system.se_play($data_system.decision_se) if @item.scope >= 3 @target_window.x = (@item_window.index + 1) % 2 * 304 @target_window.visible = true @target_window.active = true @item_window.active = false if @item.scope == 4 @item.scope == 6 @target_window.index = -1 else @target_window.index = 0 end else if @item.common_event_id > 0 $game_temp.common_event_id = @item.common_event_i $game_system.se_play(@item.menu_se) if @item.consumable $game_party.lose_item(@item.id, 1) @item_window.draw_item(@item_window.index) end $scene = Scene_Map.new return end end return end end def update_target if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) unless $game_party.item_can_use?(@item.id) @item_window.refresh end @item_window.active = true @target_window.visible = false @target_window.active = false return end if Input.trigger?(Input::C) if $game_party.item_number(@item.id) == 0 $game_system.se_play($data_system.buzzer_se) return end if @target_window.index == -1 used = false for i in $game_party.actors used |= i.item_effect(@item) end end if @target_window.index >= 0 target = $game_party.actors[@target_window.index] used = target.item_effect(@item) end if used $game_system.se_play(@item.menu_se) if @item.consumable $game_party.lose_item(@item.id, 1) @item_window.draw_item(@item_window.index) end @target_window.refresh if $game_party.all_dead? $scene = Scene_Gameover.new return end if @item.common_event_id > 0 $game_temp.common_event_id = @item.common_event_id $scene = Scene_Map.new return end end unless used $game_system.se_play($data_system.buzzer_se) end return end end end