Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Key Items

Is there a scripts anyone can make that i can do something like add to the notes section KEY and it is sent to a seperate menue in the items menu called Key Items?

it'd really help.
 
This script will take what you want even further! It has Key items and other categories. I didn't make it, but credit the dude in the script who did.
Code:
#==============================================================================
# ** Scene Item Enhanced
#------------------------------------------------------------------------------
# Author  : puppeto4 (puppeto5@hotmail.com)
# Version : 0.2 revision 1
# Date    : 17 / 06 / 2008
# Note    : Order Pizza Hut, support the rebellion.
# Check RPG RPG Revolution(http://www.rpgrevolution.com) for support
#------------------------------------------------------------------------------
# Function :  
#   This script will add filter function in Item Screen. For now only "All",
#   "Item", "Weapon", "Armor", "Key" categories available. At least for now...
# Upcoming Feature :
#   - Ability to toss item from inventory
#   ...I'll add more later :P
#
# Change Log : 
#  (24 / 06 / 2008)
#  version 0.2 : - Removed "number of item" for key item.
#                - Modify out key item so that it would be
#                  sorted after weapons & armors.
#                - Added help window description.
#==============================================================================
# ** SceneItemEnhanced : Configuration
#==============================================================================
# ** Puppeto
#------------------------------------------------------------------------------
#  This module handles setup for any script writen by me ^^.
#==============================================================================

module Puppeto
#==============================================================================
# ** ItemEnhance
#------------------------------------------------------------------------------
#  This module handles setup for the scene item enhanced script.
#==============================================================================
  
module ItemEnhance
    #------------------------------------------------------------------------
    # * Misc. Text
    #------------------------------------------------------------------------
    # Text for item note field 
    Key_Note    = "*KEY"
    # All text
    All_Text    = "Inventory"
    # Item text
    Item_Text   = "Items"
    # Weapon Text
    Weapon_Text = "Weapons"
    # Armor text
    Armor_Text  = "Armors"
    # Key Item text
    Key_Text    = "Key Items"
    
    #------------------------------------------------------------------------
    # * Help Text
    #------------------------------------------------------------------------
    # All item description
    All_Desc = "Shows the whole inventory(Press SHIFT to change cat.)"
    # Item description
    Item_Desc = "Shows healing, beneficial, damaging, and ammunition items."
    # Weapon description
    Weapon_Desc = "Shows weapons in your inventory."
    # Armor description
    Armor_Desc = "Shows armors in your inventory."
    # Key item description
    Key_Desc = "Shows important Key Items in your inventory."
    
#==============================================================================
# ** End of ItemEnhance module
#------------------------------------------------------------------------------    
end
#==============================================================================
# ** End of Puppeto module
#------------------------------------------------------------------------------
end  
#==============================================================================
# ** End of  : Configuration
#==============================================================================
# ** SceneItemEnhanced : Script
#------------------------------------------------------------------------------
# ** Class Alias
#==============================================================================
# * Aliased Class(es) : Game_Temp, Window_Item, Scene_Item, Game_Party
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
#  This class handles temporary data that is not included with save data.
# The instance of this class is referenced by $game_temp.
#==============================================================================
# * Aliased Method(s) : initialize 
#------------------------------------------------------------------------------

class Game_Temp
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias puppet_item_enhance_initialize initialize
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :show_items                # show item only
  attr_accessor :show_weapons              # show weapon only
  attr_accessor :show_armors               # show armor only
  attr_accessor :show_keys                 # show key item only
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    puppet_item_enhance_initialize          # The usual
    @show_items = false                     # show item flag
    @show_weapons = false                   # show weapon flag
    @show_armors = false                    # show armor flag
    @show_keys = false                      # show key item flag
  end
end
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
#  This class handles the party. It includes information on amount of gold 
# and items. The instance of this class is referenced by $game_party.
#==============================================================================
# * Aliased Method(s) : items
#------------------------------------------------------------------------------

class Game_Party < Game_Unit
  #--------------------------------------------------------------------------
  # * Get Item Object Array (including weapons and armor)
  #--------------------------------------------------------------------------
  def items
    result = []
    for i in @items.keys.sort
      item = $data_items[i]
      unless item.note.include?("*KEY")
        result.push($data_items[i]) if @items[i] > 0
      end  
    end
    for i in @weapons.keys.sort
      result.push($data_weapons[i]) if @weapons[i] > 0
    end
    for i in @armors.keys.sort
      result.push($data_armors[i]) if @armors[i] > 0
    end
    for i in @items.keys.sort
      item = $data_items[i]
      if @items[i] > 0 and item.note.include?("*KEY")
        result.push($data_items[i]) 

      end  
    end    
    return result
  end
end
#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
#  This window displays a list of inventory items for the item screen, etc.
#==============================================================================
# Aliased Method(s) : include?
# Rewrite Method(s) : draw_item
#------------------------------------------------------------------------------

class Window_Item < Window_Selectable
  #--------------------------------------------------------------------------
  # * Include Puppeto::ItemEnhance modules
  #--------------------------------------------------------------------------  
  include Puppeto::ItemEnhance
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias puppet_enhance_item_include? include?  
  #--------------------------------------------------------------------------
  # * Whether or not to include in item list
  #     item : item
  #--------------------------------------------------------------------------
  def include?(item)
    puppet_enhance_item_include?(item)
    return false if item == nil
    if $game_temp.show_items
      # Don't show item with Key_Note text
      return false if item.note.include?(Key_Note)
      # Only show items
      return false unless item.is_a?(RPG::Item)
    elsif $game_temp.show_weapons
      # Only show weapons
      return false unless item.is_a?(RPG::Weapon)
    elsif $game_temp.show_armors
      # Only show armors
      return false unless item.is_a?(RPG::Armor)
    elsif $game_temp.show_keys
      # Only show item with Key_Note text 
      return false unless item.note.include?(Key_Note)
    end  
    if $game_temp.in_battle
      return false unless item.is_a?(RPG::Item)
    end
    return true
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  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)
      unless item.note.include?("*KEY")
        self.contents.draw_text(rect, sprintf(":%2d", number), 2)
      end  
    end
  end
end
#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
#  This class performs the item screen processing.
#==============================================================================
# Aliased Method(s) : start, terminate, update, return_scene
# New Method(s)     : update_input_filter, create_filter_window,
#                     set_filter, update_help_window
#------------------------------------------------------------------------------

class Scene_Item < Scene_Base
  #--------------------------------------------------------------------------
  # * Include Puppeto::ItemEnhance modules
  #--------------------------------------------------------------------------  
  include Puppeto::ItemEnhance  
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias puppet_item_enhance_start start
  alias puppet_item_enhance_terminate terminate
  alias puppet_item_enhance_return_scene return_scene
  alias puppet_item_enhance_update update
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    puppet_item_enhance_start
    create_filter_window
    @help_window.y = 56
    @item_window.y = 112
    @item_window.height = 304
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    puppet_item_enhance_terminate
    @filter_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Return to Original Screen
  #--------------------------------------------------------------------------
  def return_scene
    set_filter(0)
    puppet_item_enhance_return_scene
  end  
  #--------------------------------------------------------------------------
  # * Update Frame
  #--------------------------------------------------------------------------
  def update
    puppet_item_enhance_update
    @filter_window.update
    update_input_filter 
    update_help_window
  end
  #--------------------------------------------------------------------------
  # * Update Input Filter
  #--------------------------------------------------------------------------
  def update_input_filter
    if @item_window.active
      if Input.trigger?(Input::A)
        Sound.play_decision
        @item_window.active = false
        @filter_window.active = true
        @item_window.index = 0
      end
    elsif @filter_window.active
      if Input.trigger?(Input::B)
        Sound.play_cancel
        @filter_window.active = false          
        @item_window.active = true
      elsif Input.trigger?(Input::C) 
        case @filter_window.index
        when 0;  set_filter(0)
        when 1;  set_filter(1)
        when 2;  set_filter(2)  
        when 3;  set_filter(3)  
        when 4;  set_filter(4)  
        end
      end
    end  
  end  
  #--------------------------------------------------------------------------
  # * Update Help Window
  #--------------------------------------------------------------------------
  def update_help_window
    if @filter_window.active
      case @filter_window.index
      when 0;  @help_window.set_text(All_Desc, 1)
      when 1;  @help_window.set_text(Item_Desc, 1)
      when 2;  @help_window.set_text(Weapon_Desc, 1)
      when 3;  @help_window.set_text(Armor_Desc, 1)
      when 4;  @help_window.set_text(Key_Desc, 1)
      end
    end  
  end  
  #--------------------------------------------------------------------------
  # * Create Filter Window
  #--------------------------------------------------------------------------
  def create_filter_window
    s1 = All_Text
    s2 = Item_Text
    s3 = Weapon_Text
    s4 = Armor_Text
    s5 = Key_Text
    @filter_window = Window_Command.new(544, [s1, s2, s3, s4, s5], 5)
    @filter_window.y = 0
    @filter_window.viewport = @viewport
    @filter_window.active = false
    @filter_window.contents.font.size = 20
    @filter_window.draw_item(0, true, 1)
    @filter_window.draw_item(1, true, 1)
    @filter_window.draw_item(2, true, 1)
    @filter_window.draw_item(3, true, 1)
    @filter_window.draw_item(4, true, 1)
  end  
  #--------------------------------------------------------------------------
  # * Set Filter Type
  #       filter : type of item showed
  #--------------------------------------------------------------------------
  def set_filter(filter = 0)
    Sound.play_decision
    @filter = filter
    if @filter == 1
      $game_temp.show_items = true
    else
      $game_temp.show_items = false
    end
    if @filter == 2
      $game_temp.show_weapons = true
    else  
      $game_temp.show_weapons = false
    end
    if @filter == 3
      $game_temp.show_armors = true
    else  
      $game_temp.show_armors = false
    end
    if @filter == 4
      $game_temp.show_keys = true
    else  
      $game_temp.show_keys = false
    end 
    @item_window.refresh
  end  
end
#==============================================================================
# ** End of Class Alias 
#------------------------------------------------------------------------------
# ** Class Rewrite
#==============================================================================
# ** Window_Command
#------------------------------------------------------------------------------
#  This window deals with general command choices.
#==============================================================================
# * Rewrite Method(s) : draw_item(Adding alignment function)
#------------------------------------------------------------------------------

class Window_Command < Window_Selectable
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index   : item number
  #     enabled : enabled flag. When false, draw semi-transparently.
  #     align   : alignment flag.
  #--------------------------------------------------------------------------
  def draw_item(index, enabled = true, align = 0)
    rect = item_rect(index)
    rect.x += 4
    rect.width -= 8
    @align = align
    self.contents.clear_rect(rect)
    self.contents.font.color = normal_color
    self.contents.font.color.alpha = enabled ? 255 : 128
    self.contents.draw_text(rect, @commands[index], @align)
  end
end
#==============================================================================
# ** End of Class Rewrite
#------------------------------------------------------------------------------
# ** End of SceneItemEnhanced : Script
#==============================================================================
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top