#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ #_/ ◆ Command Menu Customization - KGC_CustomMenuCommand ◆ VX ◆ #_/ ◇ Last Update: 2008/08/28 #_/ ◆ Written by TOMY #_/ ◆ Translation & Extended Updates by Mr. Anonymous #_/ ◆ KGC Site: #_/ ◆ http://ytomy.sakura.ne.jp/ #_/ ◆ Translator's Blog: #_/ ◆ http://mraprojects.wordpress.com #_/---------------------------------------------------------------------------- #_/ Installation: This script should be inserted above most custom scripts - #_/ specifically scripts that add items to the main command menu. #_/ Insert below KGC_HelpExtension, DrawFormatText, MathReinforce, Win32API, #_/ LimitBreak, and ScreenCapture. #_/============================================================================ #_/ This script allows you to customize the order in which items in the main #_/ command menu are displayed. Also, it extends the ability of easily creating #_/ additional menu commands and adding them into the command menu, with a #_/ little scripting skill. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ #=============================================================================# # ★ BEGIN Customization ★ # #=============================================================================# module KGC module CustomMenuCommand # ◆ Default Menu Items ◆ # Each menu item is assigned a number. These can be rearranged to your liking # in MENU_COMMANDS. # 0..Items 1..Skills 2..Equipment 3..Status 4..Save 5..Quit # # ◆ KGC Menu Items ◆ # ** If the corresponding scripts are not installed, don't bother with # using its listed option. # 10: Party (KGC_LargeParty) # 11: View AP (KGC_EquipLearnSkill) # 12: Skill Slots (KGC_SkillCPSystem) # 13: Difficulty (KGC_BattleDifficulty) # 14: Level Up (KGC_DistributeParameter) # 15: Beastiary (KGC_MonsterGuide) # 16: Outline (KGC_Outline) # # ◆ Extra Menu Items ◆ # ** [ExMenu_CustomCommand] # ** These are for future use for scripters. # 100: Extra Command 1 # 101: Extra Command 2 # 102: Extra Command 3 # (Up to 199 available slots.) # ◆ Menu Commands Order ◆ # Arrange your menu commands with the cooresponding number here. # Example: MENU_COMMANDS = [0, 1, 2, 3, 12, 14, 11, 10, 13, 100, 15, 4, 5] MENU_COMMANDS = [0, 1, 12, 2, 11, 10, 3, 16, 15, 4, 5] # ◆ Menu Items Row Maximum ◆ # Designate the amount of command menu items are in use here. # If there are more menu commands than is designated below, the menu command # box effectively becomes a scroll box. ROW_MAX = 11 end end #=============================================================================# # ★ END Customization ★ # #=============================================================================# #=================================================# # IMPORT # #=================================================# $imported = {} if $imported == nil $imported["CustomMenuCommand"] = true #================================================= module KGC::CustomMenuCommand # [ExMenu_CustomCommand] definitions EXMNU_CTCMD_OK = defined?(EXMNU_CTCMD_COMMANDS) end #================================================= #============================================================================== # □ KGC::Commands #============================================================================== module KGC module Commands module_function #-------------------------------------------------------------------------- # ○ Call Item Scene #-------------------------------------------------------------------------- def call_item return if $game_temp.in_battle $game_temp.next_scene = :menu_item $game_temp.next_scene_actor_index = 0 $game_temp.menu_command_index = {} end #-------------------------------------------------------------------------- # ○ Call Skill Scene # actor_index : Actor index in the database #-------------------------------------------------------------------------- def call_skill(actor_index = 0) return if $game_temp.in_battle $game_temp.next_scene = :menu_skill $game_temp.next_scene_actor_index = actor_index $game_temp.menu_command_index = {} end #-------------------------------------------------------------------------- # ○ Call Equip Scene # actor_index : Actor index in the database #-------------------------------------------------------------------------- def call_equip(actor_index = 0) return if $game_temp.in_battle $game_temp.next_scene = :menu_equip $game_temp.next_scene_actor_index = actor_index $game_temp.menu_command_index = {} end #-------------------------------------------------------------------------- # ○ Call Status Scene # actor_index : Actor index in the database #-------------------------------------------------------------------------- def call_status(actor_index = 0) return if $game_temp.in_battle $game_temp.next_scene = :menu_status $game_temp.next_scene_actor_index = actor_index $game_temp.menu_command_index = {} end end end #================================================= class Game_Interpreter include KGC::Commands end #================================================= #============================================================================== # ■ Game_Temp #============================================================================== class Game_Temp #-------------------------------------------------------------------------- # ● Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :menu_command_index # Menu Command Index attr_accessor :next_scene_actor_index # Next Scene (Actor) Index #-------------------------------------------------------------------------- # ● Initialization #-------------------------------------------------------------------------- alias initialize_KGC_CustomMenuCommand initialize def initialize initialize_KGC_CustomMenuCommand @menu_command_index = {} @next_scene_actor_index = 0 end end #================================================= #============================================================================== # ■ Scene_Map #============================================================================== class Scene_Map < Scene_Base #-------------------------------------------------------------------------- # ● Update Scene Change #-------------------------------------------------------------------------- alias update_scene_change_KGC_CustomMenuCommand update_scene_change def update_scene_change return if $game_player.moving? # Return if the player is in motion. case $game_temp.next_scene when :menu_item call_menu_item when :menu_skill call_menu_skill when :menu_equip call_menu_equip when :menu_status call_menu_status else update_scene_change_KGC_CustomMenuCommand end end #-------------------------------------------------------------------------- # ○ Call Item Menu #-------------------------------------------------------------------------- def call_menu_item $game_temp.next_scene = nil $scene = Scene_Item.new end #-------------------------------------------------------------------------- # ○ Call Skill Menu #-------------------------------------------------------------------------- def call_menu_skill $game_temp.next_scene = nil $scene = Scene_Skill.new($game_temp.next_scene_actor_index) $game_temp.next_scene_actor_index = 0 end #-------------------------------------------------------------------------- # ○ Call Equip Menu #-------------------------------------------------------------------------- def call_menu_equip $game_temp.next_scene = nil $scene = Scene_Equip.new($game_temp.next_scene_actor_index) $game_temp.next_scene_actor_index = 0 end #-------------------------------------------------------------------------- # ○ Call Status Scene #-------------------------------------------------------------------------- def call_menu_status $game_temp.next_scene = nil $scene = Scene_Status.new($game_temp.next_scene_actor_index) $game_temp.next_scene_actor_index = 0 end end #================================================= #============================================================================== # ■ Scene_Menu #============================================================================== class Scene_Menu < Scene_Base #-------------------------------------------------------------------------- # ● Create Command Window #-------------------------------------------------------------------------- def create_command_window commands = create_command_list @command_window = Window_Command.new(160, commands) @command_window.height = [@command_window.height, KGC::CustomMenuCommand::ROW_MAX * Window_Base::WLH + 32].min @command_window.index = [@menu_index, commands.size - 1].min set_command_enabled end #-------------------------------------------------------------------------- # ○ Create Command List # Defines command list names for command selections. #-------------------------------------------------------------------------- def create_command_list commands = [] index_list = {} @exmenu_command_scene = {} @disabled_command_index = [] KGC::CustomMenuCommand::MENU_COMMANDS.each_with_index { |c, i| case c when 0 # Item index_list[:item] = commands.size commands << Vocab.item when 1 # Skill index_list[:skill] = commands.size commands << Vocab.skill when 2 # Equip index_list[:equip] = commands.size commands << Vocab.equip when 3 # Status index_list[:status] = commands.size commands << Vocab.status when 4 # Save index_list[:save] = commands.size commands << Vocab.save when 5 # Game End index_list[:game_end] = commands.size commands << Vocab.game_end when 10 # Large Party next unless $imported["LargeParty"] index_list[:partyform] = commands.size @__command_partyform_index = commands.size commands << Vocab.partyform when 11 # AP Viewer next unless $imported["EquipLearnSkill"] index_list[:ap_viewer] = commands.size @__command_ap_viewer_index = commands.size commands << Vocab.ap_viewer when 12 # CP Skill System next unless $imported["SkillCPSystem"] index_list[:set_battle_skill] = commands.size @__command_set_battle_skill_index = commands.size commands << Vocab.set_battle_skill when 13 # Battle Difficulty next unless $imported["BattleDifficulty"] index_list[:set_difficulty] = commands.size @__command_set_difficulty_index = commands.size commands << KGC::BattleDifficulty.get[:name] when 14 # Distribute Parameter next unless $imported["DistributeParameter"] index_list[:distribute_parameter] = commands.size @__command_distribute_parameter_index = commands.size commands << Vocab.distribute_parameter when 15 # Enemy Guide next unless $imported["EnemyGuide"] index_list[:enemy_guide] = commands.size @__command_enemy_guide_index = commands.size commands << Vocab.enemy_guide when 16 # Outline next unless $imported["Outline"] index_list[:outline] = commands.size @__command_outline_index = commands.size commands << Vocab.outline when 100..199 # ExMenu_CustomCommand next unless KGC::CustomMenuCommand::EXMNU_CTCMD_OK # ExMenu Comm enable excommand = EXMNU_CTCMD_COMMANDS[c - 100] # ExMenu Comm index unless command_visible?(excommand) || command_inputable?(excommand) next # Invisible commands end index_list[excommand[2]] = commands.size commands << excommand[2] @exmenu_command_scene[excommand[2]] = excommand[3] end } $game_temp.menu_command_index = index_list return commands end #-------------------------------------------------------------------------- # ○ Set Command Enabled #-------------------------------------------------------------------------- def set_command_enabled disable_items = [] # If Party Members = 0, disable buttons. if $game_party.members.size == 0 disable_items.push(:item, :skill, :equip, :status, :partyform, :ap_viewer, :set_battle_skill, :distribute_parameter) end # Disable save if $game_system.save_disabled disable_items.push(:save) end # Disable partyform if $imported["LargeParty"] && !$game_party.partyform_enable? disable_items.push(:partyform) end # [ExMenu_CustomCommand] disablement if KGC::CustomMenuCommand::EXMNU_CTCMD_OK disable_items += get_exmenu_disable_commands end # Set up disabled items disable_items.each { |i| if $game_temp.menu_command_index.has_key?(i) index = $game_temp.menu_command_index[i] @command_window.draw_item(index, false) @disabled_command_index << index end } end #-------------------------------------------------------------------------- # ○ Obtain Disabled [ExMenu_CustomCommand] Commands #-------------------------------------------------------------------------- def get_exmenu_disable_commands disable_items = [] $game_temp.menu_command_index.each { |k, v| next unless k.is_a?(String) # Assign commands command = EXMNU_CTCMD_COMMANDS.find { |c| c[2] == k } next if command == nil # Disable commands unless command_inputable?(command) disable_items.push(k) end } return disable_items end #-------------------------------------------------------------------------- # ● Update Command Selection #-------------------------------------------------------------------------- def update_command_selection if Input.trigger?(Input::B) Sound.play_cancel $scene = Scene_Map.new elsif Input.trigger?(Input::C) index = @command_window.index unless command_enabled?(index) # Unless Command is enabled, cancel Sound.play_buzzer return end Sound.play_decision # [ExMenu_CustomCommand] excommand = nil if KGC::CustomMenuCommand::EXMNU_CTCMD_OK excommand = @command_window.commands[index] end # Set up @command_window.index case index when $game_temp.menu_command_index[:item] # Item $scene = Scene_Item.new when $game_temp.menu_command_index[:skill], # Skill, equip, status $game_temp.menu_command_index[:equip], $game_temp.menu_command_index[:status] start_actor_selection when $game_temp.menu_command_index[:save] # Save $scene = Scene_File.new(true, false, false) when $game_temp.menu_command_index[:game_end] # Game End $scene = Scene_End.new when $game_temp.menu_command_index[excommand] # [ExMenu_CustomCommand] $game_party.last_menu_index = index $scene = eval("#{@exmenu_command_scene[excommand]}.new") end end end #-------------------------------------------------------------------------- # ○ Command Enabled Flag # index : command_window index #-------------------------------------------------------------------------- def command_enabled?(index) # Save if $game_system.save_disabled && index == $game_temp.menu_command_index[:save] return false end # [ExMenu_CustomCommand] if KGC::CustomMenuCommand::EXMNU_CTCMD_OK command = @command_window.commands[index] if @disabled_command_index.include?($game_temp.menu_command_index[command]) return false end end # Disable commands if party size = 0 if $game_party.members.size == 0 && @disabled_command_index.include?(index) return false end return true end #-------------------------------------------------------------------------- # ● Update Actor Selection #-------------------------------------------------------------------------- def update_actor_selection if Input.trigger?(Input::B) Sound.play_cancel end_actor_selection elsif Input.trigger?(Input::C) $game_party.last_actor_index = @status_window.index Sound.play_decision case @command_window.index when $game_temp.menu_command_index[:skill] # Skill $scene = Scene_Skill.new(@status_window.index) when $game_temp.menu_command_index[:equip] # Equip $scene = Scene_Equip.new(@status_window.index) when $game_temp.menu_command_index[:status] # Status $scene = Scene_Status.new(@status_window.index) end end end end #================================================= #============================================================================== # ■ Scene_Item #============================================================================== class Scene_Item < Scene_Base #-------------------------------------------------------------------------- # ● Return Scene #-------------------------------------------------------------------------- def return_scene if $game_temp.menu_command_index.has_key?(:item) $scene = Scene_Menu.new($game_temp.menu_command_index[:item]) else $scene = Scene_Map.new end end end #================================================= #============================================================================== # ■ Scene_Skill #============================================================================== class Scene_Skill < Scene_Base #-------------------------------------------------------------------------- # ● Return Scene #-------------------------------------------------------------------------- def return_scene if $game_temp.menu_command_index.has_key?(:skill) $scene = Scene_Menu.new($game_temp.menu_command_index[:skill]) else $scene = Scene_Map.new end end end #================================================= #============================================================================== # ■ Scene_Equip #============================================================================== class Scene_Equip < Scene_Base #-------------------------------------------------------------------------- # ● Return Scene #-------------------------------------------------------------------------- def return_scene if $game_temp.menu_command_index.has_key?(:equip) $scene = Scene_Menu.new($game_temp.menu_command_index[:equip]) else $scene = Scene_Map.new end end end #================================================= #============================================================================== # ■ Scene_Status #============================================================================== class Scene_Status < Scene_Base #-------------------------------------------------------------------------- # ● Return Scene #-------------------------------------------------------------------------- def return_scene if $game_temp.menu_command_index.has_key?(:status) $scene = Scene_Menu.new($game_temp.menu_command_index[:status]) else $scene = Scene_Map.new end end end #================================================= #============================================================================== # ■ Scene_File #============================================================================== class Scene_File < Scene_Base #-------------------------------------------------------------------------- # ● Return Scene #-------------------------------------------------------------------------- alias return_scene_KGC_CustomMenuCommand return_scene def return_scene if @from_title || @from_event return_scene_KGC_CustomMenuCommand elsif $game_temp.menu_command_index.has_key?(:save) $scene = Scene_Menu.new($game_temp.menu_command_index[:save]) else $scene = Scene_Map.new end end end #================================================= #============================================================================== # ■ Scene_End #============================================================================== class Scene_End < Scene_Base #-------------------------------------------------------------------------- # ● Return Scene #-------------------------------------------------------------------------- def return_scene if $game_temp.menu_command_index.has_key?(:game_end) $scene = Scene_Menu.new($game_temp.menu_command_index[:game_end]) else $scene = Scene_Map.new end end end