#=============================================================================== # Collectables Menu # By Jet10985 (Jet) # Some code by: Woratana #=============================================================================== # This script will allow you to specify items to be "collectable". # These items will not show up in the Items menu, and will only be shown # in the Collectables menu. # This script has: 3 customization option. #=============================================================================== # Overwritten Methods: # None #------------------------------------------------------------------------------- # Aliased methods: # Window_Item: include? # Scene_Menu: create_command_window, update_command_window, # update_actor_selection # Window_Command: initialize, draw_item #=============================================================================== =begin How to make an item collectable: to make an item be considered as "collectable", place this in the item's notebox -------------------------------------------------------------------------------- How to call the collectable menu: if you choose not to have this as a menu option, you can call the collectables menu with this code in an event "Script..." command: $scene = Scene_Collectable.new =end module JetCollectableScene # Do you want the collectables menu to be accessed by the menu? # Put false if you have some sort of custom menu option thing. USE_MENU_OPTION = false # If the baove is true, what is the menu option called? COLLECTABLE_MENU_OPTION_NAME = "Collectables" # What index will the option have in the menu? COLLECTABLE_MENU_INDEX = 4 end #=============================================================================== # DON'T EDIT FURTHER UNLESS YOU KNOW WHAT TO DO. #=============================================================================== class RPG::BaseItem def collectable? if @collectable.nil? txt = note[/<(?:collectable)>/i].nil? @collectable = !txt end return @collectable end end class Window_Item alias jet6547_include? include? unless $@ def include?(item) return false if item.nil? return false if item.collectable? jet6547_include?(item) end end class Window_Collectable < Window_Item def initialize(x, y, width, height) super(x, y, width, height) end def include?(item) return false if item == nil return false unless item.collectable? return true end def enable?(item) return true end def draw_item(index) rect = item_rect(index) self.contents.clear_rect(rect) item = @data[index] if item != nil enabled = enable?(item) rect.width -= 4 draw_item_name(item, rect.x, rect.y, enabled) end end end class Scene_Collectable < Scene_Base include JetCollectableScene def initialize @came_from = $scene.class.to_s end def start super create_menu_background @help_window = Window_Help.new @relic_window = Window_Collectable.new(0, 56, 544, 360) @relic_window.help_window = @help_window end def terminate super dispose_menu_background @help_window.dispose @relic_window.dispose end def dummy_method end def update super update_menu_background @help_window.update @relic_window.update if Input.trigger?(Input::B) Sound.play_cancel eval("$scene = #{@came_from}.new( #{@came_from == "Scene_Menu" ? COLLECTABLE_MENU_INDEX.to_s : dummy_method})") end end end if JetCollectableScene::USE_MENU_OPTION class Window_Command < Window_Selectable alias jet4569_initialize initialize unless $@ alias jet9374_draw_item draw_item unless $@ def initialize(*args) @disabled_commands = [] jet4569_initialize(*args) end def draw_item(*args) jet9374_draw_item(*args) @disabled_commands[args[0]] = args[1].nil? || args[1] ? nil : true end def ins_command(index, text) @commands.insert(index, text) @disabled_commands.insert(index, nil) old_disabled_commands = @disabled_commands.dup self.height = (@commands.size + @column_max - 1) / @column_max * WLH + 32 @item_max = @commands.size create_contents refresh old_disabled_commands.each_index do |i| if !old_disabled_commands[i].nil? draw_item(i, false) end end end def add_command(text) ins_command(@commands.size, text) end end class Scene_Menu < Scene_Base include JetCollectableScene def sort_newcommand @sorted_command ||= [] newcommand = @newcommand - @sorted_command newcommand.sort.each {|i| @menu_index += 1 if @menu_index >= i } @command_window.index = @menu_index @sorted_command = @sorted_command + @newcommand end alias jet6993_create_command_window create_command_window unless $@ def create_command_window(*args) jet6993_create_command_window(*args) @command_window.ins_command(COLLECTABLE_MENU_INDEX, COLLECTABLE_MENU_OPTION_NAME) @newcommand ||= [] @newcommand << COLLECTABLE_MENU_INDEX sort_newcommand end alias jet3943_update_command_selection update_command_selection unless $@ def update_command_selection(*args) @menucomorpg_change = false if Input.trigger?(Input::C) && @command_window.index == COLLECTABLE_MENU_INDEX Sound.play_decision $scene = Scene_Collectable.new else if Input.trigger?(Input::C) && @command_window.index > COLLECTABLE_MENU_INDEX @command_window.index -= 1 @menucomorpg_change = true end jet3943_update_command_selection(*args) end @command_window.index += 1 if @menucomorpg_change end alias jet3446_update_actor_selection update_actor_selection unless $@ def update_actor_selection(*args) @menucomorpg_change = false if Input.trigger?(Input::C) && @command_window.index > COLLECTABLE_MENU_INDEX @command_window.index -= 1 @menucomorpg_change = true end jet3446_update_actor_selection(*args) @command_window.index += 1 if @menucomorpg_change end end end