RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Item Cap

0 Members and 1 Guest are viewing this topic.

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Item Cap
Version: 2.3
Author: Pacman
Date: December 29th, 2011

Version History


  • <Version 2.3> 2011.12.29 - Draws item names more efficiently.
  • <Version 2.2> 2011.11.06 - 'No crashing' feature now extended.
  • <Version 2.1> 2011.09.21 - Now features a 'no crashing' feature.
  • <Version 2.0> 2011.09.19 - Rewritten.
  • <Version 1.1> 2011.08.20 - Allowed for types of items not to have their cap drawn.
  • <Version 1.0> 2011.08.15 - Original Release

Planned Future Versions

  • I'M BORED AND HAVE NO IDEAS! SUGGEST SOMETHING!

Description


There are quite a few scripts that serve a similar purpose to this one, but to my knowledge this is the only one that does this specifically: gives each item, weapon or armor it's own possession cap, that is displayed in shop, equip and item screens. You can also set (and change in-game) the maximum amount of gold attainable. You can also now set certain items to not have their cap drawn in the windows.

Features

  • Notebox tag for setting individual item caps on each item
  • Notebox tag for not drawing the item's cap in windows
  • Altering limit on gold, also changeable in-game
  • Displays item cap in item (battle), equip and shop scenes
  • You can set which types of items (items, weapons and armors) have their cap displayed in the inventory scenes


Instructions

See script header.

Script


Code: [Select]
#===============================================================================
#
# Item Cap - Pacman (29/12/2011)
# Version 2.3
# Written for rgangsta (http://www.omega-dev.net/forums/showthread.php?tid=1280)
# Suggestion by Scalinger2
# Use the tag <item cap: x> to set the cap of an item to number x.
# Use the tax \EXEMPT_CAP to make the windows not draw the cap at all in the
# item and shop scenes.
# Set the default maximum gold in the module below.
# Set the default caps of items (when not set through notebox) in the module.
# Change the TEXT if you want for some reason.
# You can change the maximum amount of gold with the script call:
# $game_system.gold_max = x
# Where x is the maximum amount of gold.
# Set which items can have their item cap drawn in the below module. The
# available options are:
#   :items
#   :weapons
#   :armors
# New in 2.1: no longer crashes upon entering equip scene.
# New in 2.2: no longer crashes upon entering shop scene.
# New in 2.3: draws item name more efficiently.
#
#===============================================================================
#
# CONFIGURATION
#
#===============================================================================

module ITEM_CAP
  GOLD_MAX = 40000    # Maximum amount of gold
  DEFAULT_LIMIT = 50  # Default item cap (if not set through notebox)
  TEXT = ": %s / %s"    # Text to display the cap
  SHOW_CAP = [        # Show cap of which items?
    :items,           # Items
    :weapons,         # Weapons
    :armors,          # Armors
  ]
end

#===============================================================================
#
# NO EDITING >:D
#
#===============================================================================

#==============================================================================
# ** RPG::BaseItem
#------------------------------------------------------------------------------
# Superclass of Skill, Item, Weapon, and Armor.
#==============================================================================

class RPG::BaseItem
  #--------------------------------------------------------------------------
  # * Maximum possession of item
  #--------------------------------------------------------------------------
  def item_cap
    return if self.is_a?(RPG::Skill)  # Only items, weapons and armors
    return @item_cap if @item_cap != nil  # Don't perform if already set
    @item_cap = ITEM_CAP::DEFAULT_LIMIT
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when /<(?:ITEM_CAP|item cap):[ ](\d+)>/i
        @item_cap = $1.to_i
      end
    }
    return @item_cap
  end
  #--------------------------------------------------------------------------
  # * Don't draw the item's cap
  #--------------------------------------------------------------------------
  def exempt_cap?
    return if self.is_a?(RPG::Skill)
    return @exempt if @exempt != nil
    @exempt = false
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when /\\EXEMPT_CAP/i
        @exempt = true
      end
    }
    return @exempt
  end
end

#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles system-related data. Also manages vehicles and BGM, etc.
# The instance of this class is referenced by $game_system.
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :gold_cap
  #--------------------------------------------------------------------------
  # alias listing
  #--------------------------------------------------------------------------
  alias item_max_initialize initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    item_max_initialize
    @gold_cap = ITEM_CAP::GOLD_MAX
  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.
#==============================================================================

class Game_Party < Game_Unit
  #--------------------------------------------------------------------------
  # alias listing
  #--------------------------------------------------------------------------
  alias item_max_gain_gold gain_gold
  alias item_max_gain_item gain_item
  #--------------------------------------------------------------------------
  # * Gain Gold (or lose)
  #     n : amount of gold
  #--------------------------------------------------------------------------
  def gain_gold(n)
    new_gold = item_max_gain_gold(n)
    @gold = [new_gold, $game_system.gold_cap].min
  end
  #--------------------------------------------------------------------------
  # * Gain Items (or lose)
  #     item          : Item
  #     n             : Number
  #     include_equip : Include equipped items
  #--------------------------------------------------------------------------
  def gain_item(item, n, include_equip = false)
    unless $scene.is_a?(Scene_Equip)
      number = item_number(item)
      cap = item.item_cap
      case item
      when RPG::Item
        @items[item.id] = [[number + n, 0].max, cap].min
      when RPG::Weapon
        @weapons[item.id] = [[number + n, 0].max, cap].min
      when RPG::Armor
        @armors[item.id] = [[number + n, 0].max, cap].min
      end
      n += number
      if include_equip and n < 0
        for actor in members
          while n < 0 and actor.equips.include?(item)
            actor.discard_equip(item)
            n += 1
          end
        end
      end
    else
      item_max_gain_item(item, n, include_equip)
    end
  end
end

#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  This is a superclass of all windows in the game.
#==============================================================================

class Window_Base
  #--------------------------------------------------------------------------
  # * Draw Item Name
  #     item    : Item (skill, weapon, armor are also possible)
  #     x       : draw spot x-coordinate
  #     y       : draw spot y-coordinate
  #     enabled : Enabled flag. When false, draw semi-transparently.
  #     ctext   : Text to display the cap.
  #--------------------------------------------------------------------------
  def draw_item_name(item, x, y, enabled = true, ctext = "")
    if item != nil
      w = self.contents.text_size(ctext).width - 48
      draw_icon(item.icon_index, x, y, enabled)
      self.contents.font.color = normal_color
      self.contents.font.color.alpha = enabled ? 255 : 128
      self.contents.draw_text(x + 24, y, 172 - w, WLH, item.name)
    end
  end
end

#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
#  This window displays a list of inventory items for the item screen, etc.
#==============================================================================

class Window_Item < Window_Selectable
  #--------------------------------------------------------------------------
  # alias listing
  #--------------------------------------------------------------------------
  alias item_cap_draw_item draw_item
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    if draw_cap?(index)
      rect = item_rect(index)
      self.contents.clear_rect(rect)
      item = @data[index]
      if item != nil
        number1 = $game_party.item_number(item); number2 = item.item_cap
        enabled = enable?(item)
        rect.width -= 4
        ctext = sprintf(ITEM_CAP::TEXT, number1, number2)
        draw_item_name(item, rect.x, rect.y, enabled, ctext)
        self.contents.draw_text(rect, ctext, 2)
      end
    else
      item_cap_draw_item(index)
    end
  end
  #--------------------------------------------------------------------------
  # * Determine whether or not to draw cap
  #     item : item to be checked
  #--------------------------------------------------------------------------
  def draw_cap?(index)
    check = ITEM_CAP::SHOW_CAP
    item = @data[index]
    return true if item == nil and $scene.is_a?(Scene_Equip)
    return false if item.exempt_cap?
    return true if check.include?(:items) and item.is_a?(RPG::Item)
    return true if check.include?(:weapons) and item.is_a?(RPG::Weapon)
    return true if check.include?(:armors) and item.is_a?(RPG::Armor)
    return false
  end
end

#==============================================================================
# ** Window_ShopBuy
#------------------------------------------------------------------------------
#  This window displays buyable goods on the shop screen.
#==============================================================================

class Window_ShopBuy < Window_Selectable
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    number = $game_party.item_number(item)
    enabled = (item.price <= $game_party.gold and number < item.item_cap)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    draw_item_name(item, rect.x, rect.y, enabled)
    rect.width -= 4
    self.contents.draw_text(rect, item.price, 2)
  end
end

#==============================================================================
# ** Window_ShopStatus
#------------------------------------------------------------------------------
#  This window displays number of items in possession and the actor's equipment
# on the shop screen.
#==============================================================================

class Window_ShopStatus < Window_Base
  #--------------------------------------------------------------------------
  # Alias listing
  #--------------------------------------------------------------------------
  alias item_cap_refresh refresh
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if draw_cap?(@item)
      self.contents.clear
      if @item != nil
        number = $game_party.item_number(@item); cap = @item.item_cap
        text = sprintf(ITEM_CAP::TEXT, number, cap)
        self.contents.font.color = system_color
        self.contents.draw_text(4, 0, 200, WLH, Vocab::Possession)
        self.contents.font.color = normal_color
        self.contents.draw_text(4, 0, 200, WLH, text, 2)
        for actor in $game_party.members
          x = 4
          y = WLH * (2 + actor.index * 2)
          draw_actor_parameter_change(actor, x, y)
        end
      end
    else
      item_cap_refresh
    end
  end
  #--------------------------------------------------------------------------
  # * Determine whether or not to draw cap
  #     item : item to be checked
  #--------------------------------------------------------------------------
  def draw_cap?(index)
    check = ITEM_CAP::SHOW_CAP
    item = @item
    return true unless item
    return false if item.exempt_cap?
    return true if check.include?(:items) and item.is_a?(RPG::Item)
    return true if check.include?(:weapons) and item.is_a?(RPG::Weapon)
    return true if check.include?(:armors) and item.is_a?(RPG::Armor)
    return false
  end
end

#==============================================================================
# ** Scene_Shop
#------------------------------------------------------------------------------
#  This class performs shop screen processing.
#==============================================================================

class Scene_Shop < Scene_Base
  #--------------------------------------------------------------------------
  # * Update Buy Item Selection
  #--------------------------------------------------------------------------
  def update_buy_selection
    @status_window.item = @buy_window.item
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @command_window.active = true
      @dummy_window.visible = true
      @buy_window.active = false
      @buy_window.visible = false
      @status_window.visible = false
      @status_window.item = nil
      @help_window.set_text("")
      return
    end
    if Input.trigger?(Input::C)
      @item = @buy_window.item
      number = $game_party.item_number(@item)
      if @item == nil or @item.price > $game_party.gold or
       number == @item.item_cap
        Sound.play_buzzer
      else
        Sound.play_decision
        max = @item.price == 0 ? @item.item_cap : $game_party.gold / @item.price
        max = [max, @item.item_cap - number].min
        @buy_window.active = false
        @buy_window.visible = false
        @number_window.set(@item, max, @item.price)
        @number_window.active = true
        @number_window.visible = true
      end
    end
  end
end

#===============================================================================
#
# END OF SCRIPT
#
#===============================================================================

Credit


  • Pacman

Thanks

  • Rgangsta, for the request
  • Xzygon for reporting a kind of bug
  • Scalinger2, for suggesting something
  • Mog, I used his similar XP script as guidance
  • The usual scripting mob around here for being awesome

Support


Post here. No matter how old the topic is.

Known Compatibility Issues

I overwrote some methods, but I don't know if that was avoidable. Paste at the top of your script list for improved compatibility. If you discover an issue, post it here.

Author's Notes


This script took me little more than half an hour and a bowl of ice cream to write.

Restrictions

Free for use (with credit) in non-commercial games. If you want to use it in a commercial game, contact me via PM or here.
« Last Edit: December 29, 2011, 07:21:37 AM by Pacman »
it's like a metaphor or something i don't know

****
Rep:
Level 69
How do you modify this to where it only shows  amount/max # only beside items?
cuz the weapons and armor look wierd with that next to it xD

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Updated to cater for that idea.
it's like a metaphor or something i don't know

****
Rep:
Level 69

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Updated to 2.0.
it's like a metaphor or something i don't know

****
Rep:
Level 69
I got this

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
I can't seem to recreate the error, but try this:
Code: [Select]
#===============================================================================
#
# Item Cap - Pacman (19/9/2011)
# Version 2.0
# Written for rgangsta (http://www.omega-dev.net/forums/showthread.php?tid=1280)
# Suggestion by Scalinger2
# Use the tag <item cap: x> to set the cap of an item to number x.
# Use the tax \EXEMPT_CAP to make the windows not draw the cap at all in the
# item and shop scenes.
# Set the default maximum gold in the module below.
# Set the default caps of items (when not set through notebox) in the module.
# Change the TEXT if you want for some reason.
# You can change the maximum amount of gold with the script call:
# $game_system.gold_max = x
# Where x is the maximum amount of gold.
# Set which items can have their item cap drawn in the below module. The
# available options are:
#   :items
#   :weapons
#   :armors
#
#===============================================================================
#
# CONFIGURATION
#
#===============================================================================

module ITEM_CAP
  GOLD_MAX = 40000    # Maximum amount of gold
  DEFAULT_LIMIT = 50  # Default item cap (if not set through notebox)
  TEXT = "%s / %s"    # Text to display the cap
  SHOW_CAP = [        # Show cap of which items?
    :items,           # Items
    :weapons,         # Weapons
    :armors,          # Armors
  ]
end

#===============================================================================
#
# NO EDITING >:D
#
#===============================================================================

#==============================================================================
# ** RPG::BaseItem
#------------------------------------------------------------------------------
# Superclass of Skill, Item, Weapon, and Armor.
#==============================================================================

class RPG::BaseItem
  #--------------------------------------------------------------------------
  # * Maximum possession of item
  #--------------------------------------------------------------------------
  def item_cap
    return if self.is_a?(RPG::Skill)  # Only items, weapons and armors
    return @item_cap if @item_cap != nil  # Don't perform if already set
    @item_cap = ITEM_CAP::DEFAULT_LIMIT
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when /<(?:ITEM_CAP|item cap):[ ](\d+)>/i
        @item_cap = $1.to_i
      end
    }
    return @item_cap
  end
  #--------------------------------------------------------------------------
  # * Don't draw the item's cap
  #--------------------------------------------------------------------------
  def exempt_cap?
    return if self.is_a?(RPG::Skill)
    return @exempt if @exempt != nil
    @exempt = false
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when /\\EXEMPT_CAP/i
        @exempt = true
      end
    }
    return @exempt
  end
end

#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles system-related data. Also manages vehicles and BGM, etc.
# The instance of this class is referenced by $game_system.
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :gold_cap
  #--------------------------------------------------------------------------
  # alias listing
  #--------------------------------------------------------------------------
  alias item_max_initialize initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    item_max_initialize
    @gold_cap = ITEM_CAP::GOLD_MAX
  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.
#==============================================================================

class Game_Party < Game_Unit
  #--------------------------------------------------------------------------
  # alias listing
  #--------------------------------------------------------------------------
  alias item_max_gain_gold gain_gold
  alias item_max_gain_item gain_item
  #--------------------------------------------------------------------------
  # * Gain Gold (or lose)
  #     n : amount of gold
  #--------------------------------------------------------------------------
  def gain_gold(n)
    new_gold = item_max_gain_gold(n)
    @gold = [new_gold, $game_system.gold_cap].min
  end
  #--------------------------------------------------------------------------
  # * Gain Items (or lose)
  #     item          : Item
  #     n             : Number
  #     include_equip : Include equipped items
  #--------------------------------------------------------------------------
  def gain_item(item, n, include_equip = false)
    unless $scene.is_a?(Scene_Equip)
      number = item_number(item)
      cap = item.item_cap
      case item
      when RPG::Item
        @items[item.id] = [[number + n, 0].max, cap].min
      when RPG::Weapon
        @weapons[item.id] = [[number + n, 0].max, cap].min
      when RPG::Armor
        @armors[item.id] = [[number + n, 0].max, cap].min
      end
      n += number
      if include_equip and n < 0
        for actor in members
          while n < 0 and actor.equips.include?(item)
            actor.discard_equip(item)
            n += 1
          end
        end
      end
    else
      item_max_gain_item(item, n, include_equip)
    end
  end
end

#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
#  This window displays a list of inventory items for the item screen, etc.
#==============================================================================

class Window_Item < Window_Selectable
  #--------------------------------------------------------------------------
  # alias listing
  #--------------------------------------------------------------------------
  alias item_cap_draw_item draw_item
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    if draw_cap?(index)
      rect = item_rect(index)
      self.contents.clear_rect(rect)
      item = @data[index]
      if item != nil
        number1 = $game_party.item_number(item); number2 = item.item_cap
        enabled = enable?(item)
        rect.width -= 4
        draw_item_name(item, rect.x, rect.y, enabled)
        self.contents.draw_text(rect, sprintf(ITEM_CAP::TEXT, number1,
        number2), 2)
      end
    else
      item_cap_draw_item(index)
    end
  end
  #--------------------------------------------------------------------------
  # * Determine whether or not to draw cap
  #     item : item to be checked
  #--------------------------------------------------------------------------
  def draw_cap?(index)
    check = ITEM_CAP::SHOW_CAP
    item = @data[index]
    return false if item.exempt_cap? unless $scene.is_a?(Scene_Equip)
    return true if check.include?(:items) and item.is_a?(RPG::Item)
    return true if check.include?(:weapons) and item.is_a?(RPG::Weapon)
    return true if check.include?(:armors) and item.is_a?(RPG::Armor)
    return false
  end
end

#==============================================================================
# ** Window_ShopBuy
#------------------------------------------------------------------------------
#  This window displays buyable goods on the shop screen.
#==============================================================================

class Window_ShopBuy < Window_Selectable
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    number = $game_party.item_number(item)
    enabled = (item.price <= $game_party.gold and number < item.item_cap)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    draw_item_name(item, rect.x, rect.y, enabled)
    rect.width -= 4
    self.contents.draw_text(rect, item.price, 2)
  end
end

#==============================================================================
# ** Window_ShopStatus
#------------------------------------------------------------------------------
#  This window displays number of items in possession and the actor's equipment
# on the shop screen.
#==============================================================================

class Window_ShopStatus < Window_Base
  #--------------------------------------------------------------------------
  # Alias listing
  #--------------------------------------------------------------------------
  alias item_cap_refresh refresh
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if draw_cap?(@item)
      self.contents.clear
      if @item != nil
        number = $game_party.item_number(@item); cap = @item.item_cap
        text = sprintf(ITEM_CAP::TEXT, number, cap)
        self.contents.font.color = system_color
        self.contents.draw_text(4, 0, 200, WLH, Vocab::Possession)
        self.contents.font.color = normal_color
        self.contents.draw_text(4, 0, 200, WLH, text, 2)
        for actor in $game_party.members
          x = 4
          y = WLH * (2 + actor.index * 2)
          draw_actor_parameter_change(actor, x, y)
        end
      end
    else
      item_cap_refresh
    end
  end
  #--------------------------------------------------------------------------
  # * Determine whether or not to draw cap
  #     item : item to be checked
  #--------------------------------------------------------------------------
  def draw_cap?(index)
    check = ITEM_CAP::SHOW_CAP
    item = @data[index]
    return false if item.exempt_cap?
    return true if check.include?(:items) and item.is_a?(RPG::Item)
    return true if check.include?(:weapons) and item.is_a?(RPG::Weapon)
    return true if check.include?(:armors) and item.is_a?(RPG::Armor)
    return false
  end
end

#==============================================================================
# ** Scene_Shop
#------------------------------------------------------------------------------
#  This class performs shop screen processing.
#==============================================================================

class Scene_Shop < Scene_Base
  #--------------------------------------------------------------------------
  # * Update Buy Item Selection
  #--------------------------------------------------------------------------
  def update_buy_selection
    @status_window.item = @buy_window.item
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @command_window.active = true
      @dummy_window.visible = true
      @buy_window.active = false
      @buy_window.visible = false
      @status_window.visible = false
      @status_window.item = nil
      @help_window.set_text("")
      return
    end
    if Input.trigger?(Input::C)
      @item = @buy_window.item
      number = $game_party.item_number(@item)
      if @item == nil or @item.price > $game_party.gold or
       number == @item.item_cap
        Sound.play_buzzer
      else
        Sound.play_decision
        max = @item.price == 0 ? @item.item_cap : $game_party.gold / @item.price
        max = [max, @item.item_cap - number].min
        @buy_window.active = false
        @buy_window.visible = false
        @number_window.set(@item, max, @item.price)
        @number_window.active = true
        @number_window.visible = true
      end
    end
  end
end

#===============================================================================
#
# END OF SCRIPT
#
#===============================================================================
I actually don't know if that's different from the one you had.
it's like a metaphor or something i don't know

****
Rep:
Level 69
I got the same error. It might be another script creating problems with it, ill check.

**
Rep:
Level 83
Love SOSA
I get the same error when using BigEd's Item Backup and Restore found HERE

Whenever I restore the player's equipment, I get that same error.

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Success!
Code: [Select]
#===============================================================================
#
# Item Cap - Pacman (21/9/2011)
# Version 2.1
# Written for rgangsta (http://www.omega-dev.net/forums/showthread.php?tid=1280)
# Suggestion by Scalinger2
# Use the tag <item cap: x> to set the cap of an item to number x.
# Use the tax \EXEMPT_CAP to make the windows not draw the cap at all in the
# item and shop scenes.
# Set the default maximum gold in the module below.
# Set the default caps of items (when not set through notebox) in the module.
# Change the TEXT if you want for some reason.
# You can change the maximum amount of gold with the script call:
# $game_system.gold_max = x
# Where x is the maximum amount of gold.
# Set which items can have their item cap drawn in the below module. The
# available options are:
#   :items
#   :weapons
#   :armors
# New in 2.1: no longer crashes upon entering equip scene.
#
#===============================================================================
#
# CONFIGURATION
#
#===============================================================================

module ITEM_CAP
  GOLD_MAX = 40000    # Maximum amount of gold
  DEFAULT_LIMIT = 50  # Default item cap (if not set through notebox)
  TEXT = ": %s / %s"    # Text to display the cap
  SHOW_CAP = [        # Show cap of which items?
    :items,           # Items
    :weapons,         # Weapons
    :armors,          # Armors
  ]
end

#===============================================================================
#
# NO EDITING >:D
#
#===============================================================================

#==============================================================================
# ** RPG::BaseItem
#------------------------------------------------------------------------------
# Superclass of Skill, Item, Weapon, and Armor.
#==============================================================================

class RPG::BaseItem
  #--------------------------------------------------------------------------
  # * Maximum possession of item
  #--------------------------------------------------------------------------
  def item_cap
    return if self.is_a?(RPG::Skill)  # Only items, weapons and armors
    return @item_cap if @item_cap != nil  # Don't perform if already set
    @item_cap = ITEM_CAP::DEFAULT_LIMIT
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when /<(?:ITEM_CAP|item cap):[ ](\d+)>/i
        @item_cap = $1.to_i
      end
    }
    return @item_cap
  end
  #--------------------------------------------------------------------------
  # * Don't draw the item's cap
  #--------------------------------------------------------------------------
  def exempt_cap?
    return if self.is_a?(RPG::Skill)
    return @exempt if @exempt != nil
    @exempt = false
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when /\\EXEMPT_CAP/i
        @exempt = true
      end
    }
    return @exempt
  end
end

#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles system-related data. Also manages vehicles and BGM, etc.
# The instance of this class is referenced by $game_system.
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :gold_cap
  #--------------------------------------------------------------------------
  # alias listing
  #--------------------------------------------------------------------------
  alias item_max_initialize initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    item_max_initialize
    @gold_cap = ITEM_CAP::GOLD_MAX
  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.
#==============================================================================

class Game_Party < Game_Unit
  #--------------------------------------------------------------------------
  # alias listing
  #--------------------------------------------------------------------------
  alias item_max_gain_gold gain_gold
  alias item_max_gain_item gain_item
  #--------------------------------------------------------------------------
  # * Gain Gold (or lose)
  #     n : amount of gold
  #--------------------------------------------------------------------------
  def gain_gold(n)
    new_gold = item_max_gain_gold(n)
    @gold = [new_gold, $game_system.gold_cap].min
  end
  #--------------------------------------------------------------------------
  # * Gain Items (or lose)
  #     item          : Item
  #     n             : Number
  #     include_equip : Include equipped items
  #--------------------------------------------------------------------------
  def gain_item(item, n, include_equip = false)
    unless $scene.is_a?(Scene_Equip)
      number = item_number(item)
      cap = item.item_cap
      case item
      when RPG::Item
        @items[item.id] = [[number + n, 0].max, cap].min
      when RPG::Weapon
        @weapons[item.id] = [[number + n, 0].max, cap].min
      when RPG::Armor
        @armors[item.id] = [[number + n, 0].max, cap].min
      end
      n += number
      if include_equip and n < 0
        for actor in members
          while n < 0 and actor.equips.include?(item)
            actor.discard_equip(item)
            n += 1
          end
        end
      end
    else
      item_max_gain_item(item, n, include_equip)
    end
  end
end

#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
#  This window displays a list of inventory items for the item screen, etc.
#==============================================================================

class Window_Item < Window_Selectable
  #--------------------------------------------------------------------------
  # alias listing
  #--------------------------------------------------------------------------
  alias item_cap_draw_item draw_item
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    if draw_cap?(index)
      rect = item_rect(index)
      self.contents.clear_rect(rect)
      item = @data[index]
      if item != nil
        number1 = $game_party.item_number(item); number2 = item.item_cap
        enabled = enable?(item)
        rect.width -= 4
        draw_item_name(item, rect.x, rect.y, enabled)
        self.contents.draw_text(rect, sprintf(ITEM_CAP::TEXT, number1, number2),
         2)
      end
    else
      item_cap_draw_item(index)
    end
  end
  #--------------------------------------------------------------------------
  # * Determine whether or not to draw cap
  #     item : item to be checked
  #--------------------------------------------------------------------------
  def draw_cap?(index)
    check = ITEM_CAP::SHOW_CAP
    item = @data[index]
    return true if item == nil and $scene.is_a?(Scene_Equip)
    return false if item.exempt_cap?
    return true if check.include?(:items) and item.is_a?(RPG::Item)
    return true if check.include?(:weapons) and item.is_a?(RPG::Weapon)
    return true if check.include?(:armors) and item.is_a?(RPG::Armor)
    return false
  end
end

#==============================================================================
# ** Window_ShopBuy
#------------------------------------------------------------------------------
#  This window displays buyable goods on the shop screen.
#==============================================================================

class Window_ShopBuy < Window_Selectable
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    number = $game_party.item_number(item)
    enabled = (item.price <= $game_party.gold and number < item.item_cap)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    draw_item_name(item, rect.x, rect.y, enabled)
    rect.width -= 4
    self.contents.draw_text(rect, item.price, 2)
  end
end

#==============================================================================
# ** Window_ShopStatus
#------------------------------------------------------------------------------
#  This window displays number of items in possession and the actor's equipment
# on the shop screen.
#==============================================================================

class Window_ShopStatus < Window_Base
  #--------------------------------------------------------------------------
  # Alias listing
  #--------------------------------------------------------------------------
  alias item_cap_refresh refresh
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if draw_cap?(@item)
      self.contents.clear
      if @item != nil
        number = $game_party.item_number(@item); cap = @item.item_cap
        text = sprintf(ITEM_CAP::TEXT, number, cap)
        self.contents.font.color = system_color
        self.contents.draw_text(4, 0, 200, WLH, Vocab::Possession)
        self.contents.font.color = normal_color
        self.contents.draw_text(4, 0, 200, WLH, text, 2)
        for actor in $game_party.members
          x = 4
          y = WLH * (2 + actor.index * 2)
          draw_actor_parameter_change(actor, x, y)
        end
      end
    else
      item_cap_refresh
    end
  end
  #--------------------------------------------------------------------------
  # * Determine whether or not to draw cap
  #     item : item to be checked
  #--------------------------------------------------------------------------
  def draw_cap?(index)
    check = ITEM_CAP::SHOW_CAP
    item = @data[index]
    return false if item.exempt_cap?
    return true if check.include?(:items) and item.is_a?(RPG::Item)
    return true if check.include?(:weapons) and item.is_a?(RPG::Weapon)
    return true if check.include?(:armors) and item.is_a?(RPG::Armor)
    return false
  end
end

#==============================================================================
# ** Scene_Shop
#------------------------------------------------------------------------------
#  This class performs shop screen processing.
#==============================================================================

class Scene_Shop < Scene_Base
  #--------------------------------------------------------------------------
  # * Update Buy Item Selection
  #--------------------------------------------------------------------------
  def update_buy_selection
    @status_window.item = @buy_window.item
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @command_window.active = true
      @dummy_window.visible = true
      @buy_window.active = false
      @buy_window.visible = false
      @status_window.visible = false
      @status_window.item = nil
      @help_window.set_text("")
      return
    end
    if Input.trigger?(Input::C)
      @item = @buy_window.item
      number = $game_party.item_number(@item)
      if @item == nil or @item.price > $game_party.gold or
       number == @item.item_cap
        Sound.play_buzzer
      else
        Sound.play_decision
        max = @item.price == 0 ? @item.item_cap : $game_party.gold / @item.price
        max = [max, @item.item_cap - number].min
        @buy_window.active = false
        @buy_window.visible = false
        @number_window.set(@item, max, @item.price)
        @number_window.active = true
        @number_window.visible = true
      end
    end
  end
end

#===============================================================================
#
# END OF SCRIPT
#
#===============================================================================
« Last Edit: September 21, 2011, 09:28:41 AM by Pacman »
it's like a metaphor or something i don't know

**
Rep:
Level 83
Love SOSA
Sweetness! I'll give this a try right away.

.:EDIT:.
It works! I love you! Thanks a bunch.  ;D
« Last Edit: September 24, 2011, 10:38:07 PM by rgangsta »

**
Rep: +0/-0Level 75
RMRK Junior
Yo.
I found a wierd error...
Whenever I open a shop scenes I get this error

Script 'Item Cap' line 276: NoMethodError occurred.
undefined method '[]' for nil:NilClass

I am unsure if I did something wrong...

MrD

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Intriguing. It's odd I didn't notice this sooner.
This'll fix it.
Code: [Select]
#===============================================================================
#
# Item Cap - Pacman (6/11/2011)
# Version 2.2
# Written for rgangsta (http://www.omega-dev.net/forums/showthread.php?tid=1280)
# Suggestion by Scalinger2
# Use the tag <item cap: x> to set the cap of an item to number x.
# Use the tax \EXEMPT_CAP to make the windows not draw the cap at all in the
# item and shop scenes.
# Set the default maximum gold in the module below.
# Set the default caps of items (when not set through notebox) in the module.
# Change the TEXT if you want for some reason.
# You can change the maximum amount of gold with the script call:
# $game_system.gold_max = x
# Where x is the maximum amount of gold.
# Set which items can have their item cap drawn in the below module. The
# available options are:
#   :items
#   :weapons
#   :armors
# New in 2.1: no longer crashes upon entering equip scene.
# New in 2.2: no longer crashes upon entering shop scene.
#
#===============================================================================
#
# CONFIGURATION
#
#===============================================================================

module ITEM_CAP
  GOLD_MAX = 40000    # Maximum amount of gold
  DEFAULT_LIMIT = 50  # Default item cap (if not set through notebox)
  TEXT = ": %s / %s"    # Text to display the cap
  SHOW_CAP = [        # Show cap of which items?
    :items,           # Items
    :weapons,         # Weapons
    :armors,          # Armors
  ]
end

#===============================================================================
#
# NO EDITING >:D
#
#===============================================================================

#==============================================================================
# ** RPG::BaseItem
#------------------------------------------------------------------------------
# Superclass of Skill, Item, Weapon, and Armor.
#==============================================================================

class RPG::BaseItem
  #--------------------------------------------------------------------------
  # * Maximum possession of item
  #--------------------------------------------------------------------------
  def item_cap
    return if self.is_a?(RPG::Skill)  # Only items, weapons and armors
    return @item_cap if @item_cap != nil  # Don't perform if already set
    @item_cap = ITEM_CAP::DEFAULT_LIMIT
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when /<(?:ITEM_CAP|item cap):[ ](\d+)>/i
        @item_cap = $1.to_i
      end
    }
    return @item_cap
  end
  #--------------------------------------------------------------------------
  # * Don't draw the item's cap
  #--------------------------------------------------------------------------
  def exempt_cap?
    return if self.is_a?(RPG::Skill)
    return @exempt if @exempt != nil
    @exempt = false
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when /\\EXEMPT_CAP/i
        @exempt = true
      end
    }
    return @exempt
  end
end

#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles system-related data. Also manages vehicles and BGM, etc.
# The instance of this class is referenced by $game_system.
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :gold_cap
  #--------------------------------------------------------------------------
  # alias listing
  #--------------------------------------------------------------------------
  alias item_max_initialize initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    item_max_initialize
    @gold_cap = ITEM_CAP::GOLD_MAX
  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.
#==============================================================================

class Game_Party < Game_Unit
  #--------------------------------------------------------------------------
  # alias listing
  #--------------------------------------------------------------------------
  alias item_max_gain_gold gain_gold
  alias item_max_gain_item gain_item
  #--------------------------------------------------------------------------
  # * Gain Gold (or lose)
  #     n : amount of gold
  #--------------------------------------------------------------------------
  def gain_gold(n)
    new_gold = item_max_gain_gold(n)
    @gold = [new_gold, $game_system.gold_cap].min
  end
  #--------------------------------------------------------------------------
  # * Gain Items (or lose)
  #     item          : Item
  #     n             : Number
  #     include_equip : Include equipped items
  #--------------------------------------------------------------------------
  def gain_item(item, n, include_equip = false)
    unless $scene.is_a?(Scene_Equip)
      number = item_number(item)
      cap = item.item_cap
      case item
      when RPG::Item
        @items[item.id] = [[number + n, 0].max, cap].min
      when RPG::Weapon
        @weapons[item.id] = [[number + n, 0].max, cap].min
      when RPG::Armor
        @armors[item.id] = [[number + n, 0].max, cap].min
      end
      n += number
      if include_equip and n < 0
        for actor in members
          while n < 0 and actor.equips.include?(item)
            actor.discard_equip(item)
            n += 1
          end
        end
      end
    else
      item_max_gain_item(item, n, include_equip)
    end
  end
end

#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
#  This window displays a list of inventory items for the item screen, etc.
#==============================================================================

class Window_Item < Window_Selectable
  #--------------------------------------------------------------------------
  # alias listing
  #--------------------------------------------------------------------------
  alias item_cap_draw_item draw_item
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    if draw_cap?(index)
      rect = item_rect(index)
      self.contents.clear_rect(rect)
      item = @data[index]
      if item != nil
        number1 = $game_party.item_number(item); number2 = item.item_cap
        enabled = enable?(item)
        rect.width -= 4
        draw_item_name(item, rect.x, rect.y, enabled)
        self.contents.draw_text(rect, sprintf(ITEM_CAP::TEXT, number1, number2),
         2)
      end
    else
      item_cap_draw_item(index)
    end
  end
  #--------------------------------------------------------------------------
  # * Determine whether or not to draw cap
  #     item : item to be checked
  #--------------------------------------------------------------------------
  def draw_cap?(index)
    check = ITEM_CAP::SHOW_CAP
    item = @data[index]
    return true if item == nil and $scene.is_a?(Scene_Equip)
    return false if item.exempt_cap?
    return true if check.include?(:items) and item.is_a?(RPG::Item)
    return true if check.include?(:weapons) and item.is_a?(RPG::Weapon)
    return true if check.include?(:armors) and item.is_a?(RPG::Armor)
    return false
  end
end

#==============================================================================
# ** Window_ShopBuy
#------------------------------------------------------------------------------
#  This window displays buyable goods on the shop screen.
#==============================================================================

class Window_ShopBuy < Window_Selectable
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    number = $game_party.item_number(item)
    enabled = (item.price <= $game_party.gold and number < item.item_cap)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    draw_item_name(item, rect.x, rect.y, enabled)
    rect.width -= 4
    self.contents.draw_text(rect, item.price, 2)
  end
end

#==============================================================================
# ** Window_ShopStatus
#------------------------------------------------------------------------------
#  This window displays number of items in possession and the actor's equipment
# on the shop screen.
#==============================================================================

class Window_ShopStatus < Window_Base
  #--------------------------------------------------------------------------
  # Alias listing
  #--------------------------------------------------------------------------
  alias item_cap_refresh refresh
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if draw_cap?(@item)
      self.contents.clear
      if @item != nil
        number = $game_party.item_number(@item); cap = @item.item_cap
        text = sprintf(ITEM_CAP::TEXT, number, cap)
        self.contents.font.color = system_color
        self.contents.draw_text(4, 0, 200, WLH, Vocab::Possession)
        self.contents.font.color = normal_color
        self.contents.draw_text(4, 0, 200, WLH, text, 2)
        for actor in $game_party.members
          x = 4
          y = WLH * (2 + actor.index * 2)
          draw_actor_parameter_change(actor, x, y)
        end
      end
    else
      item_cap_refresh
    end
  end
  #--------------------------------------------------------------------------
  # * Determine whether or not to draw cap
  #     item : item to be checked
  #--------------------------------------------------------------------------
  def draw_cap?(index)
    check = ITEM_CAP::SHOW_CAP
    item = @item
    return true unless item
    return false if item.exempt_cap?
    return true if check.include?(:items) and item.is_a?(RPG::Item)
    return true if check.include?(:weapons) and item.is_a?(RPG::Weapon)
    return true if check.include?(:armors) and item.is_a?(RPG::Armor)
    return false
  end
end

#==============================================================================
# ** Scene_Shop
#------------------------------------------------------------------------------
#  This class performs shop screen processing.
#==============================================================================

class Scene_Shop < Scene_Base
  #--------------------------------------------------------------------------
  # * Update Buy Item Selection
  #--------------------------------------------------------------------------
  def update_buy_selection
    @status_window.item = @buy_window.item
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @command_window.active = true
      @dummy_window.visible = true
      @buy_window.active = false
      @buy_window.visible = false
      @status_window.visible = false
      @status_window.item = nil
      @help_window.set_text("")
      return
    end
    if Input.trigger?(Input::C)
      @item = @buy_window.item
      number = $game_party.item_number(@item)
      if @item == nil or @item.price > $game_party.gold or
       number == @item.item_cap
        Sound.play_buzzer
      else
        Sound.play_decision
        max = @item.price == 0 ? @item.item_cap : $game_party.gold / @item.price
        max = [max, @item.item_cap - number].min
        @buy_window.active = false
        @buy_window.visible = false
        @number_window.set(@item, max, @item.price)
        @number_window.active = true
        @number_window.visible = true
      end
    end
  end
end

#===============================================================================
#
# END OF SCRIPT
#
#===============================================================================
it's like a metaphor or something i don't know

**
Rep: +0/-0Level 75
RMRK Junior
Thats better.
Thanks for your time.
:)
MrD

**
Rep:
Level 82
If the name of the item happens to be too long, and the max cap is over 99, they overlap each other. Anyway to fix that?

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Hrrmmm... It's a spacing issue. There are four options.
1. Let it slide. Not recommended.
2. Make that item not display the cap. Not optimal.
3. Change the name / cap size. Not optimal.
4. Change the size of the name. This is probably the best option. It wouldn't be that difficult to fix.

Do you want me to do that?
it's like a metaphor or something i don't know

**
Rep:
Level 82
It's probably too much of a waste of your time, so probably not. :P
Just went with not displaying the cap. Ah well, it's not needed to know how many bullets the player can have...

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
I fixed it anyway.
Code: [Select]
#===============================================================================
#
# Item Cap - Pacman (29/12/2011)
# Version 2.3
# Written for rgangsta (http://www.omega-dev.net/forums/showthread.php?tid=1280)
# Suggestion by Scalinger2
# Use the tag <item cap: x> to set the cap of an item to number x.
# Use the tax \EXEMPT_CAP to make the windows not draw the cap at all in the
# item and shop scenes.
# Set the default maximum gold in the module below.
# Set the default caps of items (when not set through notebox) in the module.
# Change the TEXT if you want for some reason.
# You can change the maximum amount of gold with the script call:
# $game_system.gold_max = x
# Where x is the maximum amount of gold.
# Set which items can have their item cap drawn in the below module. The
# available options are:
#   :items
#   :weapons
#   :armors
# New in 2.1: no longer crashes upon entering equip scene.
# New in 2.2: no longer crashes upon entering shop scene.
# New in 2.3: draws item name more efficiently.
#
#===============================================================================
#
# CONFIGURATION
#
#===============================================================================

module ITEM_CAP
  GOLD_MAX = 40000    # Maximum amount of gold
  DEFAULT_LIMIT = 50  # Default item cap (if not set through notebox)
  TEXT = ": %s / %s"    # Text to display the cap
  SHOW_CAP = [        # Show cap of which items?
    :items,           # Items
    :weapons,         # Weapons
    :armors,          # Armors
  ]
end

#===============================================================================
#
# NO EDITING >:D
#
#===============================================================================

#==============================================================================
# ** RPG::BaseItem
#------------------------------------------------------------------------------
# Superclass of Skill, Item, Weapon, and Armor.
#==============================================================================

class RPG::BaseItem
  #--------------------------------------------------------------------------
  # * Maximum possession of item
  #--------------------------------------------------------------------------
  def item_cap
    return if self.is_a?(RPG::Skill)  # Only items, weapons and armors
    return @item_cap if @item_cap != nil  # Don't perform if already set
    @item_cap = ITEM_CAP::DEFAULT_LIMIT
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when /<(?:ITEM_CAP|item cap):[ ](\d+)>/i
        @item_cap = $1.to_i
      end
    }
    return @item_cap
  end
  #--------------------------------------------------------------------------
  # * Don't draw the item's cap
  #--------------------------------------------------------------------------
  def exempt_cap?
    return if self.is_a?(RPG::Skill)
    return @exempt if @exempt != nil
    @exempt = false
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when /\\EXEMPT_CAP/i
        @exempt = true
      end
    }
    return @exempt
  end
end

#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles system-related data. Also manages vehicles and BGM, etc.
# The instance of this class is referenced by $game_system.
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :gold_cap
  #--------------------------------------------------------------------------
  # alias listing
  #--------------------------------------------------------------------------
  alias item_max_initialize initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    item_max_initialize
    @gold_cap = ITEM_CAP::GOLD_MAX
  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.
#==============================================================================

class Game_Party < Game_Unit
  #--------------------------------------------------------------------------
  # alias listing
  #--------------------------------------------------------------------------
  alias item_max_gain_gold gain_gold
  alias item_max_gain_item gain_item
  #--------------------------------------------------------------------------
  # * Gain Gold (or lose)
  #     n : amount of gold
  #--------------------------------------------------------------------------
  def gain_gold(n)
    new_gold = item_max_gain_gold(n)
    @gold = [new_gold, $game_system.gold_cap].min
  end
  #--------------------------------------------------------------------------
  # * Gain Items (or lose)
  #     item          : Item
  #     n             : Number
  #     include_equip : Include equipped items
  #--------------------------------------------------------------------------
  def gain_item(item, n, include_equip = false)
    unless $scene.is_a?(Scene_Equip)
      number = item_number(item)
      cap = item.item_cap
      case item
      when RPG::Item
        @items[item.id] = [[number + n, 0].max, cap].min
      when RPG::Weapon
        @weapons[item.id] = [[number + n, 0].max, cap].min
      when RPG::Armor
        @armors[item.id] = [[number + n, 0].max, cap].min
      end
      n += number
      if include_equip and n < 0
        for actor in members
          while n < 0 and actor.equips.include?(item)
            actor.discard_equip(item)
            n += 1
          end
        end
      end
    else
      item_max_gain_item(item, n, include_equip)
    end
  end
end

#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  This is a superclass of all windows in the game.
#==============================================================================

class Window_Base
  #--------------------------------------------------------------------------
  # * Draw Item Name
  #     item    : Item (skill, weapon, armor are also possible)
  #     x       : draw spot x-coordinate
  #     y       : draw spot y-coordinate
  #     enabled : Enabled flag. When false, draw semi-transparently.
  #     ctext   : Text to display the cap.
  #--------------------------------------------------------------------------
  def draw_item_name(item, x, y, enabled = true, ctext = "")
    if item != nil
      w = self.contents.text_size(ctext).width - 48
      draw_icon(item.icon_index, x, y, enabled)
      self.contents.font.color = normal_color
      self.contents.font.color.alpha = enabled ? 255 : 128
      self.contents.draw_text(x + 24, y, 172 - w, WLH, item.name)
    end
  end
end

#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
#  This window displays a list of inventory items for the item screen, etc.
#==============================================================================

class Window_Item < Window_Selectable
  #--------------------------------------------------------------------------
  # alias listing
  #--------------------------------------------------------------------------
  alias item_cap_draw_item draw_item
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    if draw_cap?(index)
      rect = item_rect(index)
      self.contents.clear_rect(rect)
      item = @data[index]
      if item != nil
        number1 = $game_party.item_number(item); number2 = item.item_cap
        enabled = enable?(item)
        rect.width -= 4
        ctext = sprintf(ITEM_CAP::TEXT, number1, number2)
        draw_item_name(item, rect.x, rect.y, enabled, ctext)
        self.contents.draw_text(rect, ctext, 2)
      end
    else
      item_cap_draw_item(index)
    end
  end
  #--------------------------------------------------------------------------
  # * Determine whether or not to draw cap
  #     item : item to be checked
  #--------------------------------------------------------------------------
  def draw_cap?(index)
    check = ITEM_CAP::SHOW_CAP
    item = @data[index]
    return true if item == nil and $scene.is_a?(Scene_Equip)
    return false if item.exempt_cap?
    return true if check.include?(:items) and item.is_a?(RPG::Item)
    return true if check.include?(:weapons) and item.is_a?(RPG::Weapon)
    return true if check.include?(:armors) and item.is_a?(RPG::Armor)
    return false
  end
end

#==============================================================================
# ** Window_ShopBuy
#------------------------------------------------------------------------------
#  This window displays buyable goods on the shop screen.
#==============================================================================

class Window_ShopBuy < Window_Selectable
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    number = $game_party.item_number(item)
    enabled = (item.price <= $game_party.gold and number < item.item_cap)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    draw_item_name(item, rect.x, rect.y, enabled)
    rect.width -= 4
    self.contents.draw_text(rect, item.price, 2)
  end
end

#==============================================================================
# ** Window_ShopStatus
#------------------------------------------------------------------------------
#  This window displays number of items in possession and the actor's equipment
# on the shop screen.
#==============================================================================

class Window_ShopStatus < Window_Base
  #--------------------------------------------------------------------------
  # Alias listing
  #--------------------------------------------------------------------------
  alias item_cap_refresh refresh
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if draw_cap?(@item)
      self.contents.clear
      if @item != nil
        number = $game_party.item_number(@item); cap = @item.item_cap
        text = sprintf(ITEM_CAP::TEXT, number, cap)
        self.contents.font.color = system_color
        self.contents.draw_text(4, 0, 200, WLH, Vocab::Possession)
        self.contents.font.color = normal_color
        self.contents.draw_text(4, 0, 200, WLH, text, 2)
        for actor in $game_party.members
          x = 4
          y = WLH * (2 + actor.index * 2)
          draw_actor_parameter_change(actor, x, y)
        end
      end
    else
      item_cap_refresh
    end
  end
  #--------------------------------------------------------------------------
  # * Determine whether or not to draw cap
  #     item : item to be checked
  #--------------------------------------------------------------------------
  def draw_cap?(index)
    check = ITEM_CAP::SHOW_CAP
    item = @item
    return true unless item
    return false if item.exempt_cap?
    return true if check.include?(:items) and item.is_a?(RPG::Item)
    return true if check.include?(:weapons) and item.is_a?(RPG::Weapon)
    return true if check.include?(:armors) and item.is_a?(RPG::Armor)
    return false
  end
end

#==============================================================================
# ** Scene_Shop
#------------------------------------------------------------------------------
#  This class performs shop screen processing.
#==============================================================================

class Scene_Shop < Scene_Base
  #--------------------------------------------------------------------------
  # * Update Buy Item Selection
  #--------------------------------------------------------------------------
  def update_buy_selection
    @status_window.item = @buy_window.item
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @command_window.active = true
      @dummy_window.visible = true
      @buy_window.active = false
      @buy_window.visible = false
      @status_window.visible = false
      @status_window.item = nil
      @help_window.set_text("")
      return
    end
    if Input.trigger?(Input::C)
      @item = @buy_window.item
      number = $game_party.item_number(@item)
      if @item == nil or @item.price > $game_party.gold or
       number == @item.item_cap
        Sound.play_buzzer
      else
        Sound.play_decision
        max = @item.price == 0 ? @item.item_cap : $game_party.gold / @item.price
        max = [max, @item.item_cap - number].min
        @buy_window.active = false
        @buy_window.visible = false
        @number_window.set(@item, max, @item.price)
        @number_window.active = true
        @number_window.visible = true
      end
    end
  end
end

#===============================================================================
#
# END OF SCRIPT
#
#===============================================================================
it's like a metaphor or something i don't know

**
Rep:
Level 82
Why thank ye, good sir. I'll be sure to make good use of this script.

**
Rep:
Level 63
:3
This script is so cool! I don't think it'll mesh with my current projects, but it's still a very neat idea. ^^ For some reason, I can see this being useful with maybe a Breath of Fire project since those games typically have low-ish caps. Gives me an idea of what I can do with this later on, at least. :P
When life gives you lemons~