RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

Key Items Window?!

Started by ldkraven, January 03, 2010, 04:36:42 PM

0 Members and 1 Guest are viewing this topic.

ldkraven

I remember seeing someone ask for one just can't remember where. Anyways I found this one the only difference is it calls them relics but thats easy enough to change, well i've already done that. ^.^

[spoiler]
#==============================================================================
# Vampyr Relic Window   ***Mod for Key Items
#==============================================================================

# To Create a Key Item, put on the notes of item, the comment: KI
# To call the scene, use: $scene = Scene_Relic.new

#------------------------------------------------------------------------------
Vampyr_Kernel.register("Vampyr Relic", 1.0, "09/01/2009")
#------------------------------------------------------------------------------
class Window_Item < Window_Selectable
 
  def initialize(x, y, width, height, relic=false)
    @relic = relic
    super(x, y, width, height)
    @column_max = 2
    self.index = 0
    refresh
  end
 
  def item
    return @data[self.index]
  end
 
  def include?(item)
    return false if item == nil
    if $game_temp.in_battle
      return false unless item.is_a?(RPG::Item)
    end
    return true
  end
 
  def enable?(item)
    return $game_party.item_can_use?(item)
  end
 
  def refresh
    @data = []
    for item in $game_party.items
      next unless include?(item)
      if @relic
        next unless item.note.include?("KI")
      else
        next if item.note.include?("KI")
      end
      @data.push(item)
      if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id
        self.index = @data.size - 1
      end
    end
    @data.push(nil) if include?(nil)
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end
 
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    item = @data[index]
    if item != nil
      number = $game_party.item_number(item)
      enabled = enable?(item)
      rect.width -= 4
      draw_item_name(item, rect.x, rect.y, enabled)
      self.contents.draw_text(rect, sprintf(":%2d", number), 2) unless @relic
    end
  end
 
  def update_help
    @help_window.set_text(item == nil ? "" : item.description)
  end
 
end

#------------------------------------------------------------------------------
class Scene_Relic < Scene_Base
 
  def start
    super
    create_menu_background
    @help_window = Window_Help.new
    @relic_window = Window_Item.new(0, 56, 544, 360, true)
    @relic_window.help_window = @help_window
  end
 
  def terminate
    super
    dispose_menu_background
    @help_window.dispose
    @relic_window.dispose
  end
 
  def update
    super
    update_menu_background
    @help_window.update
    @relic_window.update
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Menu.new(3)
    end
  end
 
end

[/spoiler]




If you want the key items option in the menu then edit the Scene_Menu around line 55:


  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    s1 = Vocab::item
    s2 = Vocab::skill
    s3 = Vocab::equip
    s4 = Vocab::status
    s5 = Vocab::save
    s6 = Vocab::game_end
   


And add it where you want it for example:


#--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    s1 = Vocab::item
    s2 = Vocab::skill
    s3 = Vocab::equip
    s4 = Vocab::status
    s5 = Vocab::save
    s6 = "Key Items"
    s7 = Vocab::game_end



You would then go down to around line 95:


      Sound.play_decision
      case @command_window.index
      when 0      # Item
        $scene = Scene_Item.new
      when 1,2,3  # Skill, equipment, status
        start_actor_selection
      when 4      # Save
        $scene = Scene_File.new(true, false, false)
      when 5      # End Game
        $scene = Scene_End.new
      end
    end
  end


And change it to this:




Sound.play_decision
      case @command_window.index
      when 0      # Item
        $scene = Scene_Item.new
      when 1,2,3  # Skill, equipment, status
        start_actor_selection
      when 4      # Save
        $scene = Scene_File.new(true, false, false)
      when 5      # Key Items
        $scene = Scene_Relic.new
      when 6      # End Game
        $scene = Scene_End.new
      end
    end
  end


The original script can be found here: http://vampyrcoders.net/
All credit goes to them.

Hope this helps ^.^