"Storage" and "Items Limits" compatibility.

● ARCHIVED · READ-ONLY
Started by Blue001 8 posts View original ↗
  1. Good evening forum.

    I am trying to implement a system where if a chest is opened by the player and their max item limit for that particular item is already reached, then it will send the item to a storage box in their home for later retrieval. I have this part working already as it's easy enough to just check it conditionally with events.

    The issue I am having is with the "Bravo Storage System" Shown in this spoiler for reference...

    Spoiler
    #==============================================================================# Bravo Storage System#------------------------------------------------------------------------------# Author: Bravo2Kilo# Version: 2.0## Version History:# v1.0 = Initial Release# v1.1 = Fixed a bug and added some commands.# v2.0 = Added the ability to have multiple storage containers.#==============================================================================# Notes# If category and gold are both set to false, you can only exchange items,# if category is set to false and gold is set to true, you can only exchange# gold.#==============================================================================# To open the storage scene use this command in a script call.# open_storage(name, name_window, category, gold)# name = the name of the storage# name_window = (true or false)true to show the name window# category = (true or false)true to show the category window# gold = (true or false)true to show gold in the category window## To add or remove items from a certain storage use this command in a script call# storage_add_item(name, type, id, amount)# storage_remove_item(name, type, id, amount)# name = the name of the storage# type = the type of item, can be:)item, :weapon, :armor)# id = the database id of the item# amount = the amount to add or remove## To remove all items and gold in a certain storage use this command in a script call# clear_storage(name)# name = the name of the storage## To check the amount of an item in a certain storage use this command in a script call# storage_item_number(name, type, id)# name = the name of the storage# type = the type of item, can be:)item, :weapon, :armor)# id = the database id of the item## To add or remove gold from a certain storage use this command in a script call# storage_add_gold(name, amount)# storage_remove_gold(name, amount)# name = the name of the storage# amount = the amount to add or remove## To check the amount of gold in a certain storage use this command in a script call# storage_gold_number(name)# name = the name of the storage## If you want to set the max ammount of each item that can be in the storage,# use this notetag, if a notetage isn't used it will use the default max that# is defined below.# <storagemax: X> were X = the max.#==============================================================================module BRAVO_STORAGE # The default max of an item that can be in storage. ITEM_MAX = 99 # The max amount of gold that can be stored. GOLD_MAX = 99999999 # The command name for removing items from storage. WITHDRAW_TEXT = "Take Out" # The command name for putting items into storage. STORE_TEXT = "Put In" # The command name for leaving the storage scene. CANCEL_TEXT = "Leave" # The storage name window width NAME_WIDTH = 160#==============================================================================# End of Configuration#==============================================================================end$imported ||= {}$imported[:Bravo_Storage] = true#==============================================================================# ** RPG::BaseItem#==============================================================================class RPG::BaseItem #-------------------------------------------------------------------------- # * Item Storage Max #-------------------------------------------------------------------------- def storage_max if @note =~ /<storagemax: (.*)>/i return $1.to_i else return BRAVO_STORAGE::ITEM_MAX end endend#==============================================================================# ** Game_Temp#==============================================================================class Game_Temp #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :storage_gold attr_accessor :storage_category attr_accessor :storage_name_window #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- alias bravo_storage_initialize initialize def initialize bravo_storage_initialize @storage_gold = true @storage_category = true @storage_name_window = true endend#==============================================================================# ** Game_Party#==============================================================================class Game_Party < Game_Unit #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_reader :storage_name #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- alias bravo_storage_initialize initialize def initialize bravo_storage_initialize @storage_gold = {} @storage_items = {} @storage_weapons = {} @storage_armors = {} @storage_name = nil end #-------------------------------------------------------------------------- # * Initialize Storage #-------------------------------------------------------------------------- def init_storage(name) @storage_gold[name] ||= 0 @storage_items[name] ||= {} @storage_weapons[name] ||= {} @storage_armors[name] ||= {} end #-------------------------------------------------------------------------- # * Storage Name = #-------------------------------------------------------------------------- def storage_name=(name) return if @storage_name == name @storage_name = name init_storage(name) end #-------------------------------------------------------------------------- # * Clear Storage #-------------------------------------------------------------------------- def clear_storage @storage_gold[name] = 0 @storage_items[name] = {} @storage_weapons[name] = {} @storage_armors[name] = {} end #-------------------------------------------------------------------------- # * Get Item Object Array #-------------------------------------------------------------------------- def storage_items @storage_items[@storage_name].keys.sort.collect {|id| $data_items[id] } end #-------------------------------------------------------------------------- # * Get Weapon Object Array #-------------------------------------------------------------------------- def storage_weapons @storage_weapons[@storage_name].keys.sort.collect {|id| $data_weapons[id] } end #-------------------------------------------------------------------------- # * Get Armor Object Array #-------------------------------------------------------------------------- def storage_armors @storage_armors[@storage_name].keys.sort.collect {|id| $data_armors[id] } end #-------------------------------------------------------------------------- # * Get Array of All Equipment Objects #-------------------------------------------------------------------------- def storage_equip_items storage_weapons + storage_armors end #-------------------------------------------------------------------------- # * Get Array of All Item Objects #-------------------------------------------------------------------------- def storage_all_items storage_items + storage_equip_items end #-------------------------------------------------------------------------- # * Get Container Object Corresponding to Item Class #-------------------------------------------------------------------------- def storage_item_container(item_class) return @storage_items[@storage_name] if item_class == RPG::Item return @storage_weapons[@storage_name] if item_class == RPG::Weapon return @storage_armors[@storage_name] if item_class == RPG::Armor return nil end #-------------------------------------------------------------------------- # * Storage Gold #-------------------------------------------------------------------------- def storage_gold @storage_gold[@storage_name] end #-------------------------------------------------------------------------- # * Increase Storage Gold #-------------------------------------------------------------------------- def storage_gain_gold(amount) @storage_gold[@storage_name] = [[@storage_gold[@storage_name] + amount, 0].max, BRAVO_STORAGE::GOLD_MAX].min end #-------------------------------------------------------------------------- # * Decrease Storage Gold #-------------------------------------------------------------------------- def storage_lose_gold(amount) storage_gain_gold(-amount) end #-------------------------------------------------------------------------- # * Get Maximum Number of Items in Storage #-------------------------------------------------------------------------- def storage_max_item_number(item) return item.storage_max end #-------------------------------------------------------------------------- # * Determine if Maximum Number of Items Are Possessed #-------------------------------------------------------------------------- def storage_item_max?(item) storage_item_number(item) >= storage_max_item_number(item) end #-------------------------------------------------------------------------- # * Get Number of Items Possessed #-------------------------------------------------------------------------- def storage_item_number(item) container = storage_item_container(item.class) container ? container[item.id] || 0 : 0 end #-------------------------------------------------------------------------- # * Increase/Decrease Storage Items #-------------------------------------------------------------------------- def storage_gain_item(item, amount) container = storage_item_container(item.class) return unless container last_number = storage_item_number(item) new_number = last_number + amount container[item.id] = [[new_number, 0].max, storage_max_item_number(item)].min container.delete(item.id) if container[item.id] == 0 end #-------------------------------------------------------------------------- # * Remove Storage Items #-------------------------------------------------------------------------- def storage_lose_item(item, amount) storage_gain_item(item, -amount) endend#==============================================================================# ** Game_Interpreter#==============================================================================class Game_Interpreter #-------------------------------------------------------------------------- # * Open Storage Scene #-------------------------------------------------------------------------- def open_storage(name, name_window = true, category = true, gold = true) $game_party.storage_name = name $game_temp.storage_name_window = name_window $game_temp.storage_category = category $game_temp.storage_gold = gold SceneManager.call(Scene_Storage) end #-------------------------------------------------------------------------- # * Clear Storage #-------------------------------------------------------------------------- def clear_storage(name) $game_party.clear_storage(name) end #-------------------------------------------------------------------------- # * Storage Add Item #-------------------------------------------------------------------------- def storage_add_item(name, type, id, amount) $game_party.storage_name = name case type when :item item = $data_items[id] when :weapon item = $data_weapons[id] when :armor item = $data_armors[id] end $game_party.storage_gain_item(item, amount) end #-------------------------------------------------------------------------- # * Storage Remove Item #-------------------------------------------------------------------------- def storage_remove_item(name, type, id, amount) $game_party.storage_name = name case type when :item item = $data_items[id] when :weapon item = $data_weapons[id] when :armor item = $data_armors[id] end $game_party.storage_lose_item(item, amount) end #-------------------------------------------------------------------------- # * Storage Item Number #-------------------------------------------------------------------------- def storage_item_number(name, type, id) $game_party.storage_name = name case type when :item item = $data_items[id] when :weapon item = $data_weapons[id] when :armor item = $data_armors[id] end $game_party.storage_item_number(item) end #-------------------------------------------------------------------------- # * Storage Add Gold #-------------------------------------------------------------------------- def storage_add_gold(name, amount) $game_party.storage_name = name $game_party.storage_gain_gold(amount) end #-------------------------------------------------------------------------- # * Storage Remove Gold #-------------------------------------------------------------------------- def storage_remove_gold(name, amount) $game_party.storage_name = name $game_party.storage_lose_gold(amount) end #-------------------------------------------------------------------------- # * Storage Gold Number #-------------------------------------------------------------------------- def storage_gold_number(name) $game_party.storage_name = name $game_party.storage_gold endend#==============================================================================# ** Window_StorageCategory#==============================================================================class Window_StorageCategory < Window_ItemCategory #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(gold) @gold = gold super() end #-------------------------------------------------------------------------- # * Get Digit Count #-------------------------------------------------------------------------- def col_max if @gold == true return 4 else return 3 end end #-------------------------------------------------------------------------- # * Create Command List #-------------------------------------------------------------------------- def make_command_list add_command(Vocab::item, :item) add_command(Vocab::weapon, :weapon) add_command(Vocab::armor, :armor) add_command(Vocab::currency_unit, :gold) if @gold == true endend#==============================================================================# ** Window_ItemList#------------------------------------------------------------------------------# This window displays a list of party items on the item screen.#==============================================================================class Window_StorageItemList < Window_ItemList #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(x, y, width, height) super(x, y, width, height) @storage = :none end #-------------------------------------------------------------------------- # * Set Storage Flag #-------------------------------------------------------------------------- def storage=(storage) return if @storage == storage @storage = storage refresh self.oy = 0 end #-------------------------------------------------------------------------- # * Include in Item List? #-------------------------------------------------------------------------- def include?(item) case @category when :item item.is_a?(RPG::Item) when :weapon item.is_a?(RPG::Weapon) when :armor item.is_a?(RPG::Armor) when :all item else false end end #-------------------------------------------------------------------------- # * Display in Enabled State? #-------------------------------------------------------------------------- def enable?(item) if item.is_a?(RPG::Item) return true if !item.key_item? elsif item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor) return true else return false end end #-------------------------------------------------------------------------- # * Create Item List #-------------------------------------------------------------------------- def make_item_list case @storage when :store @data = $game_party.all_items.select {|item| include?(item) } @data.push(nil) if include?(nil) when :withdraw @data = $game_party.storage_all_items.select {|item| include?(item) } @data.push(nil) if include?(nil) end end #-------------------------------------------------------------------------- # * Draw Number of Items #-------------------------------------------------------------------------- def draw_item_number(rect, item) case @storage when :store draw_text(rect, sprintf(":%2d", $game_party.item_number(item)), 2) when :withdraw draw_text(rect, sprintf(":%2d", $game_party.storage_item_number(item)), 2) end endend#==============================================================================# ** Window_StorageCommand#==============================================================================class Window_StorageCommand < Window_HorzCommand #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 0) end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width if $game_temp.storage_name_window == false return 544 else Graphics.width - BRAVO_STORAGE::NAME_WIDTH end end #-------------------------------------------------------------------------- # * Get Digit Count #-------------------------------------------------------------------------- def col_max return 3 end #-------------------------------------------------------------------------- # * Create Command List #-------------------------------------------------------------------------- def make_command_list add_command(BRAVO_STORAGE::WITHDRAW_TEXT, :withdraw) #add_command(BRAVO_STORAGE::STORE_TEXT, :store) add_command(BRAVO_STORAGE::CANCEL_TEXT, :cancel) endend#==============================================================================# ** Window_StorageName#==============================================================================class Window_StorageName < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 0, window_width, fitting_height(1)) refresh end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width return BRAVO_STORAGE::NAME_WIDTH end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh contents.clear name = $game_party.storage_name draw_text(0, 0, window_width, line_height, name) end #-------------------------------------------------------------------------- # * Open Window #-------------------------------------------------------------------------- def open refresh super endend#==============================================================================# ** Window_StorageNumber#==============================================================================class Window_StorageNumber < Window_Selectable #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_reader :number # quantity entered #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 0, window_width, window_height) @item = nil @max = 1 @number = 1 end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width return 304 end #-------------------------------------------------------------------------- # * Get Window Height #-------------------------------------------------------------------------- def window_height return 48 end #-------------------------------------------------------------------------- # * Set Item, Max Quantity #-------------------------------------------------------------------------- def set(item, max) @item = item @max = max @number = 1 refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh contents.clear draw_item_name(@item, 0, 0) draw_number end #-------------------------------------------------------------------------- # * Draw Quantity #-------------------------------------------------------------------------- def draw_number change_color(normal_color) draw_text(cursor_x - 28, 0, 22, line_height, "×") draw_text(cursor_x, 0, cursor_width - 4, line_height, @number, 2) end #-------------------------------------------------------------------------- # * Get Cursor Width #-------------------------------------------------------------------------- def cursor_width figures * 10 + 12 end #-------------------------------------------------------------------------- # * Get X Coordinate of Cursor #-------------------------------------------------------------------------- def cursor_x contents_width - cursor_width - 4 end #-------------------------------------------------------------------------- # * Get Maximum Number of Digits for Quantity Display #-------------------------------------------------------------------------- def figures return 2 end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super if active last_number = @number update_number if @number != last_number Sound.play_cursor refresh end end end #-------------------------------------------------------------------------- # * Update Quantity #-------------------------------------------------------------------------- def update_number change_number(1) if Input.repeat?:)RIGHT) change_number(-1) if Input.repeat?:)LEFT) change_number(10) if Input.repeat?:)UP) change_number(-10) if Input.repeat?:)DOWN) end #-------------------------------------------------------------------------- # * Change Quantity #-------------------------------------------------------------------------- def change_number(amount) @number = [[@number + amount, @max].min, 1].max end #-------------------------------------------------------------------------- # * Update Cursor #-------------------------------------------------------------------------- def update_cursor cursor_rect.set(cursor_x, 0, cursor_width, line_height) endend#==============================================================================# ** Window_GoldTransfer#==============================================================================class Window_GoldTransfer < Window_Selectable #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_reader :number # quantity entered #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 0, window_width, window_height) @item = nil @max = 1 @number = 1 @cursor_y = 0 end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width return 330 end #-------------------------------------------------------------------------- # * Get Window Height #-------------------------------------------------------------------------- def window_height return 72 end #-------------------------------------------------------------------------- # * Set Item, Max Quantity #-------------------------------------------------------------------------- def set(max, position) @max = max @number = 1 @cursor_y = position refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh contents.clear draw_gold_info draw_number end #-------------------------------------------------------------------------- # * Display in Enabled State? #-------------------------------------------------------------------------- def enabled? if @cursor_y == 0 return true if $game_party.gold > 0 else return true if $game_party.storage_gold > 0 end return false end #-------------------------------------------------------------------------- # * Processing When OK Button Is Pressed #-------------------------------------------------------------------------- def process_ok if enabled? Sound.play_ok Input.update deactivate call_ok_handler else Sound.play_buzzer end end #-------------------------------------------------------------------------- # * Draw Gold Info #-------------------------------------------------------------------------- def draw_gold_info party = "Party " + Vocab::currency_unit + " :" storage = "Storage " + Vocab::currency_unit + " :" draw_text(0, 0, 280, line_height, party) draw_text(0, 24, 280, line_height, storage) draw_text(0, 0, 225, line_height, $game_party.gold, 2) draw_text(0, 24, 225, line_height, $game_party.storage_gold, 2) end #-------------------------------------------------------------------------- # * Draw Quantity #-------------------------------------------------------------------------- def draw_number change_color(normal_color) draw_text(cursor_x - 28, @cursor_y, 22, line_height, "×") draw_text(cursor_x, @cursor_y, cursor_width - 4, line_height, @number, 2) end #-------------------------------------------------------------------------- # * Get Cursor Width #-------------------------------------------------------------------------- def cursor_width figures * 10 + 12 end #-------------------------------------------------------------------------- # * Get X Coordinate of Cursor #-------------------------------------------------------------------------- def cursor_x contents_width - cursor_width - 4 end #-------------------------------------------------------------------------- # * Get Maximum Number of Digits for Quantity Display #-------------------------------------------------------------------------- def figures return 3 end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super if active last_number = @number update_number if @number != last_number Sound.play_cursor refresh end end end #-------------------------------------------------------------------------- # * Update Quantity #-------------------------------------------------------------------------- def update_number change_number(1) if Input.repeat?:)RIGHT) change_number(-1) if Input.repeat?:)LEFT) change_number(10) if Input.repeat?:)UP) change_number(-10) if Input.repeat?:)DOWN) end #-------------------------------------------------------------------------- # * Change Quantity #-------------------------------------------------------------------------- def change_number(amount) @number = [[@number + amount, @max].min, 1].max end #-------------------------------------------------------------------------- # * Update Cursor #-------------------------------------------------------------------------- def update_cursor @cursor_y ||= 0 cursor_rect.set(cursor_x, @cursor_y, cursor_width, line_height) endend#==============================================================================# ** Scene_Storage#==============================================================================class Scene_Storage < Scene_MenuBase #-------------------------------------------------------------------------- # * Start Processing #-------------------------------------------------------------------------- def start super @storage_gold = $game_temp.storage_gold @storage_category = $game_temp.storage_category @storage_name_window = $game_temp.storage_name_window create_help_window create_command_window create_name_window create_dummy_window create_category_window create_item_window create_number_window create_gold_window end #-------------------------------------------------------------------------- # * Create Command Window #-------------------------------------------------------------------------- def create_command_window @command_window = Window_StorageCommand.new @command_window.viewport = @viewport @command_window.y = @help_window.height @command_window.set_handler:)withdraw, method:)command_withdraw)) @command_window.set_handler:)store, method:)command_store)) @command_window.set_handler:)cancel, method:)return_scene)) end #-------------------------------------------------------------------------- # * Create Storage Name Window #-------------------------------------------------------------------------- def create_name_window @name_window = Window_StorageName.new @name_window.viewport = @viewport @name_window.x = @command_window.width @name_window.y = @help_window.height if @storage_name_window == true @name_window.show end end #-------------------------------------------------------------------------- # * Create Dummy Window #-------------------------------------------------------------------------- def create_dummy_window wy = @command_window.y + @command_window.height wh = Graphics.height - wy @dummy_window = Window_Base.new(0, wy, Graphics.width, wh) @dummy_window.viewport = @viewport end #-------------------------------------------------------------------------- # * Create Quantity Input Window #-------------------------------------------------------------------------- def create_number_window @number_window = Window_StorageNumber.new @number_window.viewport = @viewport @number_window.x = ((Graphics.width / 2) - (@number_window.width / 2)) @number_window.y = ((Graphics.height / 2) - (@number_window.height / 2)) @number_window.hide @number_window.set_handler:)ok, method:)on_number_ok)) @number_window.set_handler:)cancel, method:)on_number_cancel)) end #-------------------------------------------------------------------------- # * Create Category Window #-------------------------------------------------------------------------- def create_category_window @category_window = Window_StorageCategory.new(@storage_gold) @category_window.viewport = @viewport @category_window.help_window = @help_window @category_window.y = @dummy_window.y @category_window.hide.deactivate @category_window.set_handler:)ok, method:)on_category_ok)) @category_window.set_handler:)cancel, method:)on_category_cancel)) end #-------------------------------------------------------------------------- # * Create Item Window #-------------------------------------------------------------------------- def create_item_window if @storage_category == false wy = @command_window.y + @command_window.height else wy = @category_window.y + @category_window.height end wh = Graphics.height - wy @item_window = Window_StorageItemList.new(0, wy, Graphics.width, wh) @item_window.viewport = @viewport @item_window.help_window = @help_window @item_window.hide @item_window.set_handler:)ok, method:)on_item_ok)) @item_window.set_handler:)cancel, method:)on_item_cancel)) if @storage_category == false @item_window.category = :all else @category_window.item_window = @item_window end end #-------------------------------------------------------------------------- # * Create Item Window #-------------------------------------------------------------------------- def create_gold_window @gold_window = Window_GoldTransfer.new @gold_window.viewport = @viewport @gold_window.x = ((Graphics.width / 2) - (@gold_window.width / 2)) @gold_window.y = ((Graphics.height / 2) - (@gold_window.height / 2)) @gold_window.hide @gold_window.set_handler:)ok, method:)on_gold_ok)) @gold_window.set_handler:)cancel, method:)on_gold_cancel)) end #-------------------------------------------------------------------------- # * Start Category Selection #-------------------------------------------------------------------------- def start_category_selection @dummy_window.hide @item_window.show @item_window.unselect @item_window.refresh @item_window.storage = @command_window.current_symbol @category_window.show.activate end #-------------------------------------------------------------------------- # * [Withdraw] Command #-------------------------------------------------------------------------- def command_withdraw if @storage_category == false and @storage_gold == true case @command_window.current_symbol when :withdraw @gold_window.set(max_withdraw, 24) when :store @gold_window.set(max_store, 0) end @gold_window.show.activate elsif @storage_category == false @dummy_window.hide @item_window.show.activate @item_window.storage = @command_window.current_symbol @item_window.select_last else start_category_selection end end #-------------------------------------------------------------------------- # * [Store] Command #-------------------------------------------------------------------------- def command_store if @storage_category == false and @storage_gold == true case @command_window.current_symbol when :withdraw @gold_window.set(max_withdraw, 24) when :store @gold_window.set(max_store, 0) end @gold_window.show.activate elsif @storage_category == false @dummy_window.hide @item_window.show.activate @item_window.storage = @command_window.current_symbol @item_window.select_last else start_category_selection end end #-------------------------------------------------------------------------- # * Category [OK] #-------------------------------------------------------------------------- def on_category_ok case @category_window.current_symbol when :item, :weapon, :armor @item_window.activate @item_window.select_last when :gold case @command_window.current_symbol when :withdraw @gold_window.set(max_withdraw, 24) when :store @gold_window.set(max_store, 0) end @gold_window.show.activate end end #-------------------------------------------------------------------------- # * Category [Cancel] #-------------------------------------------------------------------------- def on_category_cancel @command_window.activate @dummy_window.show @item_window.hide @category_window.hide end #-------------------------------------------------------------------------- # * Item [OK] #-------------------------------------------------------------------------- def on_item_ok @item = @item_window.item case @command_window.current_symbol when :withdraw @number_window.set(@item, max_withdraw) when :store @number_window.set(@item, max_store) end @number_window.show.activate end #-------------------------------------------------------------------------- # * Item [Cancel] #-------------------------------------------------------------------------- def on_item_cancel @item_window.unselect if @storage_category == false @item_window.hide @dummy_window.show @command_window.activate else @category_window.activate end end #-------------------------------------------------------------------------- # * Quantity Input [OK] #-------------------------------------------------------------------------- def on_number_ok Sound.play_ok case @command_window.current_symbol when :withdraw do_withdraw(@number_window.number) when :store do_store(@number_window.number) end @number_window.hide @item_window.refresh @item_window.activate @item_window.select_last end #-------------------------------------------------------------------------- # * Quantity Input [Cancel] #-------------------------------------------------------------------------- def on_number_cancel Sound.play_cancel @number_window.hide @item_window.activate end #-------------------------------------------------------------------------- # * Gold Quantity Input [OK] #-------------------------------------------------------------------------- def on_gold_ok case @command_window.current_symbol when :withdraw gold_withdraw(@gold_window.number) @gold_window.set(max_withdraw, 24) when :store gold_store(@gold_window.number) @gold_window.set(max_store, 0) end @gold_window.show.activate @gold_window.refresh Sound.play_ok end #-------------------------------------------------------------------------- # * Gold Quantity Input [Cancel] #-------------------------------------------------------------------------- def on_gold_cancel Sound.play_cancel if @storage_category == false && @storage_gold == true @command_window.activate else start_category_selection end @gold_window.hide end #-------------------------------------------------------------------------- # * Execute Withdraw #-------------------------------------------------------------------------- def do_withdraw(number) if (something goes here....) Sound.play_buzzer else $game_party.storage_lose_item(@item, number) $game_party.gain_item(@item, number) end end #-------------------------------------------------------------------------- # * Execute Store #-------------------------------------------------------------------------- def do_store(number) $game_party.storage_gain_item(@item, number) $game_party.lose_item(@item, number) end #-------------------------------------------------------------------------- # * Gold Withdraw #-------------------------------------------------------------------------- def gold_withdraw(number) $game_party.storage_lose_gold(number) $game_party.gain_gold(number) end #-------------------------------------------------------------------------- # * Gold Store #-------------------------------------------------------------------------- def gold_store(number) $game_party.lose_gold(number) $game_party.storage_gain_gold(number) end #-------------------------------------------------------------------------- # * Get Maximum Quantity Withdrawable #-------------------------------------------------------------------------- def max_withdraw case @category_window.current_symbol when :item, :weapon, :armor if $game_party.storage_item_number(@item) > 99 return 99 else $game_party.storage_item_number(@item) end when :gold if $game_party.storage_gold > 999 return 999 else $game_party.storage_gold end end end #-------------------------------------------------------------------------- # * Get Maximum Quantity Storable #-------------------------------------------------------------------------- def max_store case @category_window.current_symbol when :item, :weapon, :armor if $game_party.item_number(@item) > 99 return 99 else $game_party.item_number(@item) end when :gold if $game_party.gold > 999 return 999 else $game_party.gold end end endend 
    I have removed the ability in the storage system for the player to Add items, and it has become retrieve only.

    But the problem is that I am using Yanfly's Increase Limits script to make certain items have lower limits. (potions can only be carried up to 10).

    My settings in that script can be seen here.

    Spoiler
    #==============================================================================# # ▼ Yanfly Engine Ace - Adjust Limits v1.00# -- Last Updated: 2011.12.03# -- Level: Normal# -- Requires: n/a# #==============================================================================$imported = {} if $imported.nil?$imported["YEA-AdjustLimits"] = true#==============================================================================# ▼ Updates# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# 2011.12.03 - Finished Script.# 2011.12.02 - Started Script.# #==============================================================================# ▼ Introduction# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# There exists some limitations in RPG Maker VX Ace that not everybody's fond# of. With this script, you can easily adjust the limits of each limitation.# Here's the list of various limits that can be changed:# # - Gold Max - Have more than 99,999,999 gold.# - Item Max - Have more than 99 items. Customizable per item, too.# - Level Max - Exceed 99 levels. Parameters are automatically calculated based# on the level 99 and level 98 stats in the class parameters.# - Stat Max - Stats can exceed 999. Does not adjust for current formulas.# #==============================================================================# ▼ Instructions# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# To install this script, open up your script editor and copy/paste this script# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.# # -----------------------------------------------------------------------------# Actor Notetags - These notetags go in the actors notebox in the database.# -----------------------------------------------------------------------------# <initial level: x># Sets the initial level for the specific actor. Can go above level 99 as long# as the max level is higher than 99. Default initial level limit is 99.# # <max level: x># Sets the max level for the specific actor. Can go above level 99 as long as# the higher limit is defined in the module. Default max level is level 99.# # -----------------------------------------------------------------------------# Class Notetags - These notetags go in the class notebox in the database.# -----------------------------------------------------------------------------# <learn at level: x># This actually goes inside of the skill learning "notes" box. Replace x with# the level you wish for the class to learn the skill at. This enables classes# to learn new skills past level 99.# # -----------------------------------------------------------------------------# Item Notetags - These notetags go in the items notebox in the database.# -----------------------------------------------------------------------------# <max limit: x># Changes the maximum number of items that can be held from whatever the# normal amount that can be held. Default amount is 99.# # <price: x># Changes the price of the item to x. Allows you to go over the price of# 999,999 gold if your maximum gold exceeds that amount. Default maximum gold# is 99,999,999 gold.# # -----------------------------------------------------------------------------# Weapon Notetags - These notetags go in the weapons notebox in the database.# -----------------------------------------------------------------------------# <max limit: x># Changes the maximum number of items that can be held from whatever the# normal amount that can be held. Default amount is 99.# # <price: x># Changes the price of the item to x. Allows you to go over the price of# 999,999 gold if your maximum gold exceeds that amount. Default maximum gold# is 99,999,999 gold.# # <stat: +x># <stat: -x># Changes the stat bonus of the piece of equipment to yield +x or -x. Allows# bonus to go over +500 and under -500. Replace stat with one of the following:# MAXHP, MAXMP, ATK, DEF, MAT, MDF, AGI, LUK# # -----------------------------------------------------------------------------# Armour Notetags - These notetags go in the armours notebox in the database.# -----------------------------------------------------------------------------# <max limit: x># Changes the maximum number of items that can be held from whatever the# normal amount that can be held. Default amount is 99.# # <price: x># Changes the price of the item to x. Allows you to go over the price of# 999,999 gold if your maximum gold exceeds that amount. Default maximum gold# is 99,999,999 gold.# # <stat: +x># <stat: -x># Changes the stat bonus of the piece of equipment to yield +x or -x. Allows# bonus to go over +500 and under -500. Replace stat with one of the following:# MAXHP, MAXMP, ATK, DEF, MAT, MDF, AGI, LUK# # -----------------------------------------------------------------------------# Enemy Notetags - These notetags go in the enemy notebox in the database.# -----------------------------------------------------------------------------# <stat: x># Changes the stat of the enemy to x value. Allows going over the database max# values. Replace stat with one of the following:# MAXHP, MAXMP, ATK, DEF, MAT, MDF, AGI, LUK, EXP, GOLD# # -----------------------------------------------------------------------------# Script Calls - These commands are used with script calls.# -----------------------------------------------------------------------------# gain_gold(x)# lose_gold(x)# Causes the player to gain/lose x gold. Allows you to go over 9,999,999 gold.# Default maximum gold is 99,999,999.# # gain_item(x, y)# lose_item(x, y)# gain_weapon(x, y)# lose_weapon(x, y)# gain_armour(x, y)# lose_armour(x, y)# Causes the player to gain/lose x item in y amount. Allows you to go over 99# quantity. Default quantity is 99.# #==============================================================================# ▼ Compatibility# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that# it will run with RPG Maker VX without adjusting.# #==============================================================================module YEA module LIMIT #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # - Gold Settings - #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # Adjust gold settings here. You can change the maximum amount of gold to # whatever you want. In addition to that, you can also adjust whether or # not you wish for your gold display to show an icon instead, (and change # the font size if needed). If there's too much gold that's to be displayed # then you can change the text shown in place of that. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- GOLD_MAX = 99999999 # Maximum gold. GOLD_ICON = 361 # Icon used for gold. Use 0 for text currency. GOLD_FONT = 16 # Font size used to display gold. TOO_MUCH_GOLD = "99,999,999+!" # Text used when gold cannot fit. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # - Item Settings - #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # Adjust item settings here. You can change the maximum number of items # held from 99 to whatever you want. In addition to that, change the prefix # used for items when shown in the item display menu (and the font size if # needed). Items can have individual maximums through usage of the # <max limit: x> notetag. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ITEM_MAX = 999 # The default maximum number of items held each. ITEM_FONT = 16 # Font size used to display item quantity. SHOP_FONT = 16 # Font size used for shop item costs. ITEM_PREFIX = "×%s" # Prefix used for item quantity in item lists. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # - Parameter Settings - #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # Adjust the limits for each of the various stats (for MaxHP, MaxMP, ATK, # DEF, MAT, and more). Adjust them as you see fit. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- LEVEL_MAX = 1 # Sets max level to x for those with 99 level limit. MAXHP_MAX = 2000 # Sets MaxHP to something higher than 9999. MAXMP_MAX = 2000 # Sets MaxMP to something higher than 9999. PARAM_MAX = 2000 # Sets stat max for something higher than 999. EQUIP_FONT = 16 # Changes the default equip window font size. end # LIMITend # YEA#==============================================================================# ▼ Editting anything past this point may potentially result in causing# computer damage, incontinence, explosion of user's head, coma, death, and/or# halitosis so edit at your own risk.#==============================================================================module YEA module REGEXP module ACTOR MAX_LEVEL = /<(?:MAX_LEVEL|max level):[ ](\d+)>/i INI_LEVEL = /<(?:INITIAL_LEVEL|initial level):[ ](\d+)>/i end # ACTOR module CLASS LEARN_AT_LV = /<(?:LEARN_AT_LEVEL|learn at level):[ ](\d+)>/i end # CLASS module BASEITEM PRICE = /<(?:GOLD|price|COST):[ ](\d+)>/i MAX_LIMIT = /<(?:MAX_LIMIT|max limit):[ ](\d+)>/i STAT_SET = /<(.*):[ ]*([\+\-]\d+)>/i end # BASEITEM module ENEMY STAT_SET = /<(.*):[ ]*(\d+)>/i end # ENEMY end # REGEXPend # YEA#==============================================================================# ■ Icon#==============================================================================module Icon #-------------------------------------------------------------------------- # self.gold #-------------------------------------------------------------------------- def self.gold; return YEA::LIMIT::GOLD_ICON; end end # Icon #==============================================================================# ■ Numeric#==============================================================================class Numeric #-------------------------------------------------------------------------- # new method: group_digits #-------------------------------------------------------------------------- unless $imported["YEA-CoreEngine"] def group; return self.to_s; end end # $imported["YEA-CoreEngine"] end # Numeric#==============================================================================# ■ DataManager#==============================================================================module DataManager #-------------------------------------------------------------------------- # alias method: load_database #-------------------------------------------------------------------------- class <<self; alias load_database_al load_database; end def self.load_database load_database_al load_notetags_al end #-------------------------------------------------------------------------- # new method: load_notetags_al #-------------------------------------------------------------------------- def self.load_notetags_al groups = [$data_actors, $data_items, $data_weapons, $data_armors, $data_enemies, $data_classes] for group in groups for obj in group next if obj.nil? obj.load_notetags_al end end end end # DataManager#==============================================================================# ■ RPG::Actor#==============================================================================class RPG::Actor < RPG::BaseItem #-------------------------------------------------------------------------- # common cache: load_notetags_al #-------------------------------------------------------------------------- def load_notetags_al @max_level = YEA::LIMIT::LEVEL_MAX if @max_level == 99 #--- self.note.split(/[\r\n]+/).each { |line| case line #--- when YEA::REGEXP::ACTOR::MAX_LEVEL @max_level = [[$1.to_i, 1].max, YEA::LIMIT::LEVEL_MAX].min @ini_level = [@ini_level, @max_level].min when YEA::REGEXP::ACTOR::INI_LEVEL @ini_level = [[$1.to_i, 1].max, @max_level].min #--- end } # self.note.split #--- end end # RPG::Actor#==============================================================================# ■ RPG::Class#==============================================================================class RPG::Class < RPG::BaseItem #-------------------------------------------------------------------------- # new method: above_lv99_params #-------------------------------------------------------------------------- def above_lv99_params(param_id, level) return @params[param_id, level] if level <= 99 n = @params[param_id, 99] multiplier = [level - 99, 1].max change = (@params[param_id, 99] - @params[param_id, 98]) + 1 n += change * multiplier return n end #-------------------------------------------------------------------------- # new method: load_notetags_al #-------------------------------------------------------------------------- def load_notetags_al for item in @learnings; item.load_notetags_al; end end end # RPG::Class#==============================================================================# ■ RPG::Class::Learning#==============================================================================class RPG::Class::Learning #-------------------------------------------------------------------------- # common cache: load_notetags_al #-------------------------------------------------------------------------- def load_notetags_al #--- self.note.split(/[\r\n]+/).each { |line| case line #--- when YEA::REGEXP::CLASS::LEARN_AT_LV @level = [[$1.to_i, 1].max, YEA::LIMIT::LEVEL_MAX].min #--- end } # self.note.split #--- end end # RPG::Class::Learning#==============================================================================# ■ RPG::BaseItem#==============================================================================class RPG::BaseItem #-------------------------------------------------------------------------- # public instance variables #-------------------------------------------------------------------------- attr_accessor :max_limit #-------------------------------------------------------------------------- # common cache: load_notetags_al #-------------------------------------------------------------------------- def load_notetags_al @max_limit = YEA::LIMIT::ITEM_MAX #--- self.note.split(/[\r\n]+/).each { |line| case line #--- when YEA::REGEXP::BASEITEM::pRICE @price = [$1.to_i, YEA::LIMIT::GOLD_MAX].min when YEA::REGEXP::BASEITEM::MAX_LIMIT @max_limit = [$1.to_i, 1].max when YEA::REGEXP::BASEITEM::STAT_SET case $1.upcase when "HP", "MAXHP", "MHP" @params[0] = $2.to_i when "MP", "MAXMP", "MMP", "SP", "MAXSP", "MSP" @params[1] = $2.to_i when "ATK" @params[2] = $2.to_i when "DEF" @params[3] = $2.to_i when "MAT", "INT", "SPI" @params[4] = $2.to_i when "MDF", "RES" @params[5] = $2.to_i when "AGI", "SPD" @params[6] = $2.to_i when "LUK", "LUCK" @params[7] = $2.to_i end #--- end } # self.note.split #--- end #-------------------------------------------------------------------------- # new method: max_limit #-------------------------------------------------------------------------- def max_limit; return @max_limit; end end # RPG::BaseItem#==============================================================================# ■ RPG::Enemy#==============================================================================class RPG::Enemy < RPG::BaseItem #-------------------------------------------------------------------------- # common cache: load_notetags_al #-------------------------------------------------------------------------- def load_notetags_al #--- self.note.split(/[\r\n]+/).each { |line| case line #--- when YEA::REGEXP::ENEMY::STAT_SET case $1.upcase when "HP", "MAXHP", "MHP" @params[0] = $2.to_i when "MP", "MAXMP", "MMP", "SP", "MAXSP", "MSP" @params[1] = $2.to_i when "ATK" @params[2] = $2.to_i when "DEF" @params[3] = $2.to_i when "MAT", "INT", "SPI" @params[4] = $2.to_i when "MDF", "RES" @params[5] = $2.to_i when "AGI", "SPD" @params[6] = $2.to_i when "LUK", "LUCK" @params[7] = $2.to_i when "EXP", "XP" @exp = $2.to_i when "GOLD", "GP" @gold = $2.to_i end #--- end } # self.note.split #--- end end # RPG::Enemy#==============================================================================# ■ Game_BattlerBase#==============================================================================class Game_BattlerBase #-------------------------------------------------------------------------- # overwrite method: param_max #-------------------------------------------------------------------------- def param_max(param_id) return YEA::LIMIT::MAXHP_MAX if param_id == 0 return YEA::LIMIT::MAXMP_MAX if param_id == 1 return YEA::LIMIT::pARAM_MAX end end # Game_BattlerBase#==============================================================================# ■ Game_Actor#==============================================================================class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # overwrite method: param_max #-------------------------------------------------------------------------- def param_max(param_id) return super end #-------------------------------------------------------------------------- # overwrite method: param_base #-------------------------------------------------------------------------- def param_base(param_id) return self.class.params[param_id, @level] if @level <= 99 return self.class.above_lv99_params(param_id, @level) end #-------------------------------------------------------------------------- # new method: check_levels #-------------------------------------------------------------------------- def check_levels last_level = @level @level = [[@level, max_level].min, 1].max return if @level == last_level change_exp(exp_for_level(@level), false) end end # Game_Actor#==============================================================================# ■ Game_Party#==============================================================================class Game_Party < Game_Unit #-------------------------------------------------------------------------- # overwrite method: max_gold #-------------------------------------------------------------------------- def max_gold; return YEA::LIMIT::GOLD_MAX; end #-------------------------------------------------------------------------- # overwrite method: max_item_number #-------------------------------------------------------------------------- def max_item_number(item); return item.max_limit; end end # Game_Party#==============================================================================# ■ Game_Interpreter#==============================================================================class Game_Interpreter #-------------------------------------------------------------------------- # new method: gain_gold #-------------------------------------------------------------------------- def gain_gold(value); $game_party.gain_gold(value); end #-------------------------------------------------------------------------- # new method: lose_gold #-------------------------------------------------------------------------- def lose_gold(value); $game_party.lose_gold(value); end #-------------------------------------------------------------------------- # new method: gain_item #-------------------------------------------------------------------------- def gain_item(id, amount) return if $data_items[id].nil? $game_party.gain_item($data_items[id], amount) end #-------------------------------------------------------------------------- # new method: lose_item #-------------------------------------------------------------------------- def lose_item(id, amount) return if $data_items[id].nil? $game_party.lose_item($data_items[id], amount) end #-------------------------------------------------------------------------- # new method: gain_weapon #-------------------------------------------------------------------------- def gain_weapon(id, amount) return if $data_weapons[id].nil? $game_party.gain_item($data_weapons[id], amount) end #-------------------------------------------------------------------------- # new method: lose_weapon #-------------------------------------------------------------------------- def lose_weapon(id, amount) return if $data_weapons[id].nil? $game_party.lose_item($data_weapons[id], amount) end #-------------------------------------------------------------------------- # new method: gain_armour #-------------------------------------------------------------------------- def gain_armour(id, amount) return if $data_armors[id].nil? $game_party.gain_item($data_armors[id], amount) end #-------------------------------------------------------------------------- # new method: lose_armour #-------------------------------------------------------------------------- def lose_armour(id, amount) return if $data_armors[id].nil? $game_party.lose_item($data_armors[id], amount) end #-------------------------------------------------------------------------- # new method: gain_armor #-------------------------------------------------------------------------- def gain_armor(id, amount) return if $data_armors[id].nil? $game_party.gain_item($data_armors[id], amount) end #-------------------------------------------------------------------------- # new method: lose_armor #-------------------------------------------------------------------------- def lose_armor(id, amount) return if $data_armors[id].nil? $game_party.lose_item($data_armors[id], amount) end end # Game_Interpreter#==============================================================================# ■ Window_Base#==============================================================================class Window_Base < Window #-------------------------------------------------------------------------- # overwrite method: draw_actor_level #-------------------------------------------------------------------------- def draw_actor_level(actor, dx, dy) dw = text_size(Vocab::level_a + YEA::LIMIT::LEVEL_MAX.to_s).width change_color(system_color) draw_text(dx, dy, dw, line_height, Vocab::level_a) change_color(normal_color) cx = text_size(Vocab::level_a).width draw_text(dx + cx, dy, dw, line_height, actor.level.group, 2) end #-------------------------------------------------------------------------- # overwrite method: draw_actor_param #-------------------------------------------------------------------------- def draw_actor_param(actor, dx, dy, param_id) change_color(system_color) draw_text(dx, dy, 120, line_height, Vocab::param(param_id)) change_color(normal_color) draw_text(dx, dy, 156, line_height, actor.param(param_id).group, 2) end #-------------------------------------------------------------------------- # draw_currency_value #-------------------------------------------------------------------------- def draw_currency_value(value, unit, dx, dy, dw) contents.font.size = YEA::LIMIT::GOLD_FONT cx = gold_icon?(unit) ? 24 : text_size(unit).width change_color(normal_color) text = value.group text = YEA::LIMIT::TOO_MUCH_GOLD if contents.text_size(text).width > dw-cx draw_text(dx, dy, dw - cx - 2, line_height, text, 2) change_color(system_color) draw_icon(Icon.gold, dx+dw-24, dy) if gold_icon?(unit) draw_text(dx, dy, dw, line_height, unit, 2) unless gold_icon?(unit) reset_font_settings end #-------------------------------------------------------------------------- # new method: gold_icon? #-------------------------------------------------------------------------- def gold_icon?(unit) return false if unit != Vocab.currency_unit return YEA::LIMIT::GOLD_ICON > 0 end end # Window_Base#==============================================================================# ■ Window_ItemList#==============================================================================class Window_ItemList < Window_Selectable #-------------------------------------------------------------------------- # overwrite method: draw_item_number #-------------------------------------------------------------------------- def draw_item_number(rect, item) contents.font.size = YEA::LIMIT::ITEM_FONT quantity = $game_party.item_number(item).group text = sprintf(YEA::LIMIT::ITEM_PREFIX, quantity) draw_text(rect, text, 2) reset_font_settings end end # Window_ItemList#==============================================================================# ■ Window_EquipStatus#==============================================================================class Window_EquipStatus < Window_Base #-------------------------------------------------------------------------- # overwrite method: draw_item #-------------------------------------------------------------------------- def draw_item(dx, dy, param_id) draw_param_name(dx + 4, dy, param_id) draw_current_param(dx + 64, dy, param_id) if @actor draw_right_arrow(dx + 110, dy) draw_new_param(dx + 132, dy, param_id) if @temp_actor reset_font_settings end #-------------------------------------------------------------------------- # overwrite method: draw_param_name #-------------------------------------------------------------------------- def draw_param_name(dx, dy, param_id) contents.font.size = YEA::LIMIT::EQUIP_FONT change_color(system_color) draw_text(dx, dy, contents.width, line_height, Vocab::param(param_id)) end #-------------------------------------------------------------------------- # overwrite method: draw_current_param #-------------------------------------------------------------------------- def draw_current_param(dx, dy, param_id) change_color(normal_color) draw_text(0, dy, dx+48, line_height, @actor.param(param_id).group, 2) reset_font_settings end #-------------------------------------------------------------------------- # overwrite method: draw_new_param #-------------------------------------------------------------------------- def draw_new_param(dx, dy, param_id) contents.font.size = YEA::LIMIT::EQUIP_FONT new_value = @temp_actor.param(param_id) change_color(param_change_color(new_value - @actor.param(param_id))) draw_text(0, dy, contents.width-4, line_height, new_value.group, 2) reset_font_settings end end # Window_EquipStatus#==============================================================================# ■ Window_ShopBuy#==============================================================================class Window_ShopBuy < Window_Selectable #-------------------------------------------------------------------------- # overwrite method: draw_item #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] rect = item_rect(index) draw_item_name(item, rect.x, rect.y, enable?(item)) rect.width -= 4 contents.font.size = YEA::LIMIT::SHOP_FONT draw_text(rect, price(item).group, 2) reset_font_settings end end # Window_ShopBuy#==============================================================================# ■ Scene_Load#==============================================================================class Scene_Load < Scene_File #-------------------------------------------------------------------------- # alias method: on_load_success #-------------------------------------------------------------------------- alias on_load_success_al on_load_success def on_load_success on_load_success_al perform_level_check end #-------------------------------------------------------------------------- # new method: perform_level_check #-------------------------------------------------------------------------- def perform_level_check for i in 1..$data_actors.size next if $game_actors.nil? $game_actors.check_levels end end end # Scene_Load#==============================================================================# # ▼ End of File# #============================================================================== 

    Currently when I try and withdraw items, the storage system doesn't care how many items I'm allowed to have and lets me withdraw as many as I want... they then vanish since the potions hit the 10 limit and can go no further.

    This following line is where I know I need to put some kind of conditional check...

      #--------------------------------------------------------------------------  # * Execute Withdraw  #--------------------------------------------------------------------------  def do_withdraw(number)    $game_party.storage_lose_item(@item, number)    $game_party.gain_item(@item, number)  end

    I have put the following together so far... but am not sure what goes in that IF line that will work as a check.

    I want it to basically check [current item count + storage lose item count = amount, if amount over limit, than fail]

    Code:
      #--------------------------------------------------------------------------  # * Execute Withdraw  #--------------------------------------------------------------------------  def do_withdraw(number)    if (something goes here....)    Sound.play_buzzer    else    $game_party.storage_lose_item(@item, number)    $game_party.gain_item(@item, number)    end  end

     

    I am still fairly new at this scripting language and have just been cobbling things together, and doing trial and error. So I do not really know how to check the function max_item_limit from Yanflys limiter, in this other script.

    Any help would be appreciated.

     

    Thanks ahead of time.

    Blue
  2.   def do_withdraw(number) current_possesion = $game_party.item_number(@item) if current_possesion == @item.max_limit Sound.play_buzzer else $game_party.storage_lose_item(@item, number)    $game_party.gain_item(@item, number)    end  endI don't know it that will work because the argument not passing the item, I suppose the @item instance variable is the object item so it should work, so try that, if not work I'm sorry :) .
  3. Thank you for offering your assistance.

    The script you provided 'partially' worked. The first set of items I take out can still be for more than I have... So if I am carrying 0, and take out 50, it will take 50 and give me 10, erasing 40.

    but after that, it indeed prevents me from taking more. So it's getting closer. I also added '>=' to the script you gave me.

    so I also need to check to make sure that the amount I am taking out will not cause current possession to go over the item max limit. So there is one math problem missing which will make this work.

    to_take_out = $game_party.storage_lose_item(@item, number)total_after = to_take_out + current_possesion if total_after >= @item.max_limitSound.play_buzzer2But I can't figure out how to properly define new variables to use in such math problem... :-/
  4.  No my code above is essential to make the script work to your liking, and now copy this method below and overwrite it in the bravo script :

    #-------------------------------------------------------------------------- # * Get Maximum Quantity Withdrawable #-------------------------------------------------------------------------- def max_withdraw case @category_window.current_symbol when :item, :weapon, :armor if $game_party.storage_item_number(@item) > @item.max_limit - $game_party.item_number(@item) return @item.max_limit - $game_party.item_number(@item) else $game_party.storage_item_number(@item) end when :gold if $game_party.storage_gold > 999 return 999 else $game_party.storage_gold end end endHopefully this works. :)
  5. ok. slightly confused by what you meant by overwrite it.

    This is what that whole section looks like now in my script.

    (I had to define the sound to play because that buzzer thing wasn't working for some reason.)

    #-------------------------------------------------------------------------- # * Execute Withdraw #-------------------------------------------------------------------------- def fail_sound_effect RPG::SE.new("Buzzer2", 100, 100).play end def do_withdraw(number) current_possesion = $game_party.item_number(@item) if current_possesion == @item.max_limit fail_sound_effect else $game_party.storage_lose_item(@item, number) $game_party.gain_item(@item, number) end end# $game_party.storage_lose_item(@item, number)# $game_party.gain_item(@item, number)#--------------------------------------------------------------------------# * Get Maximum Quantity Withdrawable#-------------------------------------------------------------------------- def max_withdraw case @category_window.current_symbol when :item, :weapon, :armor if $game_party.storage_item_number(@item) > @item.max_limit - $game_party.item_number(@item) return @item.max_limit - $game_party.item_number(@item) else $game_party.storage_item_number(@item) end when :gold if $game_party.storage_gold > 999 return 999 else $game_party.storage_gold end end endam I supposed to put that new max_withdraw somewhere in the first script you gave me?
  6. I mean write  overwrite(sigh) original max_withdraw method in bravo script with my new max_withdraw method, (damn my english -__-).

    For the Sound.play_buzzer if it's not play, check your database system for Buzzer, perhaps you remove it by any chance, or the play_buzzer method in module Sound has been overwrote or something's happen to it, I don't know because I can't check it from here haha.. sorry :p .
  7. Worked Perfectly, Thank you!!!!
     

    If anyone who comes along is interested in a Storage that acts like a mailbox (Remove Items Only) and you use Yanfly's Break Limits. Here is the edited Bravo Storage script below!

    Spoiler
    Code:
    #==============================================================================# Bravo Storage System#------------------------------------------------------------------------------# Author: Bravo2Kilo# Version: 2.0## Version History:#   v1.0 = Initial Release#   v1.1 = Fixed a bug and added some commands.#   v2.0 = Added the ability to have multiple storage containers.#==============================================================================# Notes#   If category and gold are both set to false, you can only exchange items,#   if category is set to false and gold is set to true, you can only exchange#   gold.#==============================================================================# To open the storage scene use this command in a script call.#   open_storage(name, name_window, category, gold)#     name = the name of the storage#     name_window = (true or false)true to show the name window#     category = (true or false)true to show the category window#     gold = (true or false)true to show gold in the category window## To add or remove items from a certain storage use this command in a script call#   storage_add_item(name, type, id, amount)#   storage_remove_item(name, type, id, amount)#     name = the name of the storage#     type = the type of item, can be(:item, :weapon, :armor)#     id = the database id of the item#     amount = the amount to add or remove## To remove all items and gold in a certain storage use this command in a script call#   clear_storage(name)#     name = the name of the storage## To check the amount of an item in a certain storage use this command in a script call#   storage_item_number(name, type, id)#     name = the name of the storage#     type = the type of item, can be(:item, :weapon, :armor)#     id = the database id of the item## To add or remove gold from a certain storage use this command in a script call#   storage_add_gold(name, amount)#   storage_remove_gold(name, amount)#     name = the name of the storage#     amount = the amount to add or remove## To check the amount of gold in a certain storage use this command in a script call#   storage_gold_number(name)#     name = the name of the storage## If you want to set the max ammount of each item that can be in the storage,# use this notetag, if a notetage isn't used it will use the default max that# is defined below.#   <storagemax: X> were X = the max.#==============================================================================module BRAVO_STORAGE  # The default max of an item that can be in storage.  ITEM_MAX = 99  # The max amount of gold that can be stored.  GOLD_MAX = 99999999  # The command name for removing items from storage.  WITHDRAW_TEXT = "Take Out"  # The command name for putting items into storage.  STORE_TEXT = "Put In"  # The command name for leaving the storage scene.  CANCEL_TEXT = "Leave"  # The storage name window width  NAME_WIDTH = 160#==============================================================================# End of Configuration#==============================================================================end$imported ||= {}$imported[:Bravo_Storage] = true#==============================================================================# ** RPG::BaseItem#==============================================================================class RPG::BaseItem  #--------------------------------------------------------------------------  # * Item Storage Max  #--------------------------------------------------------------------------  def storage_max    if @note =~ /<storagemax: (.*)>/i      return $1.to_i    else      return BRAVO_STORAGE::ITEM_MAX    end  endend#==============================================================================# ** Game_Temp#==============================================================================class Game_Temp  #--------------------------------------------------------------------------  # * Public Instance Variables  #--------------------------------------------------------------------------  attr_accessor :storage_gold  attr_accessor :storage_category  attr_accessor :storage_name_window  #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  alias bravo_storage_initialize initialize  def initialize    bravo_storage_initialize    @storage_gold = true    @storage_category = true    @storage_name_window = true  endend#==============================================================================# ** Game_Party#==============================================================================class Game_Party < Game_Unit  #--------------------------------------------------------------------------  # * Public Instance Variables  #--------------------------------------------------------------------------  attr_reader   :storage_name  #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  alias bravo_storage_initialize initialize  def initialize    bravo_storage_initialize    @storage_gold = {}    @storage_items = {}    @storage_weapons = {}    @storage_armors = {}    @storage_name = nil  end  #--------------------------------------------------------------------------  # * Initialize Storage  #--------------------------------------------------------------------------  def init_storage(name)    @storage_gold[name] ||= 0    @storage_items[name] ||= {}    @storage_weapons[name] ||= {}    @storage_armors[name] ||= {}  end  #--------------------------------------------------------------------------  # * Storage Name =  #--------------------------------------------------------------------------  def storage_name=(name)    return if @storage_name == name    @storage_name = name    init_storage(name)  end  #--------------------------------------------------------------------------  # * Clear Storage  #--------------------------------------------------------------------------  def clear_storage    @storage_gold[name] = 0    @storage_items[name] = {}    @storage_weapons[name] = {}    @storage_armors[name] = {}  end  #--------------------------------------------------------------------------  # * Get Item Object Array   #--------------------------------------------------------------------------  def storage_items    @storage_items[@storage_name].keys.sort.collect {|id| $data_items[id] }  end  #--------------------------------------------------------------------------  # * Get Weapon Object Array   #--------------------------------------------------------------------------  def storage_weapons    @storage_weapons[@storage_name].keys.sort.collect {|id| $data_weapons[id] }  end  #--------------------------------------------------------------------------  # * Get Armor Object Array   #--------------------------------------------------------------------------  def storage_armors    @storage_armors[@storage_name].keys.sort.collect {|id| $data_armors[id] }  end  #--------------------------------------------------------------------------  # * Get Array of All Equipment Objects  #--------------------------------------------------------------------------  def storage_equip_items    storage_weapons + storage_armors  end  #--------------------------------------------------------------------------  # * Get Array of All Item Objects  #--------------------------------------------------------------------------  def storage_all_items    storage_items + storage_equip_items  end  #--------------------------------------------------------------------------  # * Get Container Object Corresponding to Item Class  #--------------------------------------------------------------------------  def storage_item_container(item_class)    return @storage_items[@storage_name]   if item_class == RPG::Item    return @storage_weapons[@storage_name] if item_class == RPG::Weapon    return @storage_armors[@storage_name]  if item_class == RPG::Armor    return nil  end  #--------------------------------------------------------------------------  # * Storage Gold  #--------------------------------------------------------------------------  def storage_gold    @storage_gold[@storage_name]  end  #--------------------------------------------------------------------------  # * Increase Storage Gold  #--------------------------------------------------------------------------  def storage_gain_gold(amount)    @storage_gold[@storage_name] = [[@storage_gold[@storage_name] + amount, 0].max, BRAVO_STORAGE::GOLD_MAX].min  end  #--------------------------------------------------------------------------  # * Decrease Storage Gold  #--------------------------------------------------------------------------  def storage_lose_gold(amount)    storage_gain_gold(-amount)  end  #--------------------------------------------------------------------------  # * Get Maximum Number of Items in Storage  #--------------------------------------------------------------------------  def storage_max_item_number(item)    return item.storage_max  end  #--------------------------------------------------------------------------  # * Determine if Maximum Number of Items Are Possessed  #--------------------------------------------------------------------------  def storage_item_max?(item)    storage_item_number(item) >= storage_max_item_number(item)  end  #--------------------------------------------------------------------------  # * Get Number of Items Possessed  #--------------------------------------------------------------------------  def storage_item_number(item)    container = storage_item_container(item.class)    container ? container[item.id] || 0 : 0  end  #--------------------------------------------------------------------------  # * Increase/Decrease Storage Items  #--------------------------------------------------------------------------  def storage_gain_item(item, amount)    container = storage_item_container(item.class)    return unless container    last_number = storage_item_number(item)    new_number = last_number + amount    container[item.id] = [[new_number, 0].max, storage_max_item_number(item)].min    container.delete(item.id) if container[item.id] == 0  end  #--------------------------------------------------------------------------  # * Remove Storage Items  #--------------------------------------------------------------------------  def storage_lose_item(item, amount)    storage_gain_item(item, -amount)  endend#==============================================================================# ** Game_Interpreter#==============================================================================class Game_Interpreter  #--------------------------------------------------------------------------  # * Open Storage Scene  #--------------------------------------------------------------------------  def open_storage(name, name_window = true, category = true, gold = true)    $game_party.storage_name = name    $game_temp.storage_name_window = name_window    $game_temp.storage_category = category    $game_temp.storage_gold = gold    SceneManager.call(Scene_Storage)  end  #--------------------------------------------------------------------------  # * Clear Storage  #--------------------------------------------------------------------------  def clear_storage(name)    $game_party.clear_storage(name)  end  #--------------------------------------------------------------------------  # * Storage Add Item  #--------------------------------------------------------------------------  def storage_add_item(name, type, id, amount)    $game_party.storage_name = name    case type    when :item      item = $data_items[id]    when :weapon      item = $data_weapons[id]    when :armor      item = $data_armors[id]    end    $game_party.storage_gain_item(item, amount)  end  #--------------------------------------------------------------------------  # * Storage Remove Item  #--------------------------------------------------------------------------  def storage_remove_item(name, type, id, amount)    $game_party.storage_name = name    case type    when :item      item = $data_items[id]    when :weapon      item = $data_weapons[id]    when :armor      item = $data_armors[id]    end    $game_party.storage_lose_item(item, amount)  end  #--------------------------------------------------------------------------  # * Storage Item Number  #--------------------------------------------------------------------------  def storage_item_number(name, type, id)    $game_party.storage_name = name    case type    when :item      item = $data_items[id]    when :weapon      item = $data_weapons[id]    when :armor      item = $data_armors[id]    end    $game_party.storage_item_number(item)  end  #--------------------------------------------------------------------------  # * Storage Add Gold  #--------------------------------------------------------------------------  def storage_add_gold(name, amount)    $game_party.storage_name = name    $game_party.storage_gain_gold(amount)  end  #--------------------------------------------------------------------------  # * Storage Remove Gold  #--------------------------------------------------------------------------  def storage_remove_gold(name, amount)    $game_party.storage_name = name    $game_party.storage_lose_gold(amount)  end  #--------------------------------------------------------------------------  # * Storage Gold Number  #--------------------------------------------------------------------------  def storage_gold_number(name)    $game_party.storage_name = name    $game_party.storage_gold  endend#==============================================================================# ** Window_StorageCategory#==============================================================================class Window_StorageCategory < Window_ItemCategory  #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  def initialize(gold)    @gold = gold    super()  end  #--------------------------------------------------------------------------  # * Get Digit Count  #--------------------------------------------------------------------------  def col_max    if @gold == true      return 4    else      return 3    end  end  #--------------------------------------------------------------------------  # * Create Command List  #--------------------------------------------------------------------------  def make_command_list    add_command(Vocab::item, :item)    add_command(Vocab::weapon, :weapon)    add_command(Vocab::armor, :armor)    add_command(Vocab::currency_unit, :gold) if @gold == true  endend#==============================================================================# ** Window_ItemList#------------------------------------------------------------------------------#  This window displays a list of party items on the item screen.#==============================================================================class Window_StorageItemList < Window_ItemList  #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  def initialize(x, y, width, height)    super(x, y, width, height)    @storage = :none  end  #--------------------------------------------------------------------------  # * Set Storage Flag  #--------------------------------------------------------------------------  def storage=(storage)    return if @storage == storage    @storage = storage    refresh    self.oy = 0  end  #--------------------------------------------------------------------------  # * Include in Item List?  #--------------------------------------------------------------------------  def include?(item)    case @category    when :item      item.is_a?(RPG::Item)    when :weapon      item.is_a?(RPG::Weapon)    when :armor      item.is_a?(RPG::Armor)    when :all      item    else      false    end  end  #--------------------------------------------------------------------------  # * Display in Enabled State?  #--------------------------------------------------------------------------  def enable?(item)    if item.is_a?(RPG::Item)      return true if !item.key_item?    elsif item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor)      return true    else      return false    end  end  #--------------------------------------------------------------------------  # * Create Item List  #--------------------------------------------------------------------------  def make_item_list    case @storage    when :store      @data = $game_party.all_items.select {|item| include?(item) }      @data.push(nil) if include?(nil)    when :withdraw      @data = $game_party.storage_all_items.select {|item| include?(item) }      @data.push(nil) if include?(nil)    end  end  #--------------------------------------------------------------------------  # * Draw Number of Items  #--------------------------------------------------------------------------  def draw_item_number(rect, item)    case @storage    when :store      draw_text(rect, sprintf(":%2d", $game_party.item_number(item)), 2)    when :withdraw      draw_text(rect, sprintf(":%2d", $game_party.storage_item_number(item)), 2)    end  endend#==============================================================================# ** Window_StorageCommand#==============================================================================class Window_StorageCommand < Window_HorzCommand  #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  def initialize    super(0, 0)  end  #--------------------------------------------------------------------------  # * Get Window Width  #--------------------------------------------------------------------------  def window_width    if $game_temp.storage_name_window == false      return 544    else      Graphics.width - BRAVO_STORAGE::NAME_WIDTH    end  end  #--------------------------------------------------------------------------  # * Get Digit Count  #--------------------------------------------------------------------------  def col_max    return 3  end  #--------------------------------------------------------------------------  # * Create Command List  #--------------------------------------------------------------------------  def make_command_list    add_command(BRAVO_STORAGE::WITHDRAW_TEXT, :withdraw)    #add_command(BRAVO_STORAGE::STORE_TEXT, :store)    add_command(BRAVO_STORAGE::CANCEL_TEXT, :cancel)  endend#==============================================================================# ** Window_StorageName#==============================================================================class Window_StorageName < Window_Base  #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  def initialize    super(0, 0, window_width, fitting_height(1))    refresh  end  #--------------------------------------------------------------------------  # * Get Window Width  #--------------------------------------------------------------------------  def window_width    return BRAVO_STORAGE::NAME_WIDTH  end  #--------------------------------------------------------------------------  # * Refresh  #--------------------------------------------------------------------------  def refresh    contents.clear    name = $game_party.storage_name    draw_text(0, 0, window_width, line_height, name)  end  #--------------------------------------------------------------------------  # * Open Window  #--------------------------------------------------------------------------  def open    refresh    super  endend#==============================================================================# ** Window_StorageNumber#==============================================================================class Window_StorageNumber < Window_Selectable  #--------------------------------------------------------------------------  # * Public Instance Variables  #--------------------------------------------------------------------------  attr_reader   :number                   # quantity entered  #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  def initialize    super(0, 0, window_width, window_height)     @item = nil    @max = 1    @number = 1  end  #--------------------------------------------------------------------------  # * Get Window Width  #--------------------------------------------------------------------------  def window_width    return 304  end  #--------------------------------------------------------------------------  # * Get Window Height  #--------------------------------------------------------------------------  def window_height    return 48  end  #--------------------------------------------------------------------------  # * Set Item, Max Quantity  #--------------------------------------------------------------------------  def set(item, max)    @item = item    @max = max    @number = 1    refresh  end  #--------------------------------------------------------------------------  # * Refresh  #--------------------------------------------------------------------------  def refresh    contents.clear    draw_item_name(@item, 0, 0)    draw_number  end  #--------------------------------------------------------------------------  # * Draw Quantity  #--------------------------------------------------------------------------  def draw_number    change_color(normal_color)    draw_text(cursor_x - 28, 0, 22, line_height, "×")    draw_text(cursor_x, 0, cursor_width - 4, line_height, @number, 2)  end  #--------------------------------------------------------------------------  # * Get Cursor Width  #--------------------------------------------------------------------------  def cursor_width    figures * 10 + 12  end  #--------------------------------------------------------------------------  # * Get X Coordinate of Cursor  #--------------------------------------------------------------------------  def cursor_x    contents_width - cursor_width - 4  end  #--------------------------------------------------------------------------  # * Get Maximum Number of Digits for Quantity Display  #--------------------------------------------------------------------------  def figures    return 2  end  #--------------------------------------------------------------------------  # * Frame Update  #--------------------------------------------------------------------------  def update    super    if active      last_number = @number      update_number      if @number != last_number        Sound.play_cursor        refresh      end    end  end  #--------------------------------------------------------------------------  # * Update Quantity  #--------------------------------------------------------------------------  def update_number    change_number(1)   if Input.repeat?(:RIGHT)    change_number(-1)  if Input.repeat?(:LEFT)    change_number(10)  if Input.repeat?(:UP)    change_number(-10) if Input.repeat?(:DOWN)  end  #--------------------------------------------------------------------------  # * Change Quantity  #--------------------------------------------------------------------------  def change_number(amount)    @number = [[@number + amount, @max].min, 1].max  end  #--------------------------------------------------------------------------  # * Update Cursor  #--------------------------------------------------------------------------  def update_cursor    cursor_rect.set(cursor_x, 0, cursor_width, line_height)  endend#==============================================================================# ** Window_GoldTransfer#==============================================================================class Window_GoldTransfer < Window_Selectable  #--------------------------------------------------------------------------  # * Public Instance Variables  #--------------------------------------------------------------------------  attr_reader   :number                   # quantity entered  #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  def initialize    super(0, 0, window_width, window_height)     @item = nil    @max = 1    @number = 1    @cursor_y = 0  end  #--------------------------------------------------------------------------  # * Get Window Width  #--------------------------------------------------------------------------  def window_width    return 330  end  #--------------------------------------------------------------------------  # * Get Window Height  #--------------------------------------------------------------------------  def window_height    return 72  end  #--------------------------------------------------------------------------  # * Set Item, Max Quantity  #--------------------------------------------------------------------------  def set(max, position)    @max = max    @number = 1    @cursor_y = position    refresh  end  #--------------------------------------------------------------------------  # * Refresh  #--------------------------------------------------------------------------  def refresh    contents.clear    draw_gold_info    draw_number  end  #--------------------------------------------------------------------------  # * Display in Enabled State?  #--------------------------------------------------------------------------  def enabled?    if @cursor_y == 0      return true if $game_party.gold > 0    else      return true if $game_party.storage_gold > 0    end    return false  end  #--------------------------------------------------------------------------  # * Processing When OK Button Is Pressed  #--------------------------------------------------------------------------  def process_ok    if enabled?      Sound.play_ok      Input.update      deactivate      call_ok_handler    else      Sound.play_buzzer    end  end  #--------------------------------------------------------------------------  # * Draw Gold Info  #--------------------------------------------------------------------------  def draw_gold_info    party = "Party " + Vocab::currency_unit + " :"    storage = "Storage " + Vocab::currency_unit + " :"    draw_text(0, 0, 280, line_height, party)    draw_text(0, 24, 280, line_height, storage)    draw_text(0, 0, 225, line_height, $game_party.gold, 2)    draw_text(0, 24, 225, line_height, $game_party.storage_gold, 2)  end  #--------------------------------------------------------------------------  # * Draw Quantity  #--------------------------------------------------------------------------  def draw_number    change_color(normal_color)    draw_text(cursor_x - 28, @cursor_y, 22, line_height, "×")    draw_text(cursor_x, @cursor_y, cursor_width - 4, line_height, @number, 2)  end  #--------------------------------------------------------------------------  # * Get Cursor Width  #--------------------------------------------------------------------------  def cursor_width    figures * 10 + 12  end  #--------------------------------------------------------------------------  # * Get X Coordinate of Cursor  #--------------------------------------------------------------------------  def cursor_x    contents_width - cursor_width - 4  end  #--------------------------------------------------------------------------  # * Get Maximum Number of Digits for Quantity Display  #--------------------------------------------------------------------------  def figures    return 3  end  #--------------------------------------------------------------------------  # * Frame Update  #--------------------------------------------------------------------------  def update    super    if active      last_number = @number      update_number      if @number != last_number        Sound.play_cursor        refresh      end    end  end  #--------------------------------------------------------------------------  # * Update Quantity  #--------------------------------------------------------------------------  def update_number    change_number(1)   if Input.repeat?(:RIGHT)    change_number(-1)  if Input.repeat?(:LEFT)    change_number(10)  if Input.repeat?(:UP)    change_number(-10) if Input.repeat?(:DOWN)  end  #--------------------------------------------------------------------------  # * Change Quantity  #--------------------------------------------------------------------------  def change_number(amount)    @number = [[@number + amount, @max].min, 1].max  end  #--------------------------------------------------------------------------  # * Update Cursor  #--------------------------------------------------------------------------  def update_cursor    @cursor_y ||= 0    cursor_rect.set(cursor_x, @cursor_y, cursor_width, line_height)  endend#==============================================================================# ** Scene_Storage#==============================================================================class Scene_Storage < Scene_MenuBase  #--------------------------------------------------------------------------  # * Start Processing  #--------------------------------------------------------------------------  def start    super    @storage_gold = $game_temp.storage_gold    @storage_category = $game_temp.storage_category    @storage_name_window = $game_temp.storage_name_window    create_help_window    create_command_window    create_name_window    create_dummy_window    create_category_window    create_item_window    create_number_window    create_gold_window  end  #--------------------------------------------------------------------------  # * Create Command Window  #--------------------------------------------------------------------------  def create_command_window    @command_window = Window_StorageCommand.new    @command_window.viewport = @viewport    @command_window.y = @help_window.height    @command_window.set_handler(:withdraw, method(:command_withdraw))    @command_window.set_handler(:store, method(:command_store))    @command_window.set_handler(:cancel, method(:return_scene))  end  #--------------------------------------------------------------------------  # * Create Storage Name Window  #--------------------------------------------------------------------------  def create_name_window    @name_window = Window_StorageName.new    @name_window.viewport = @viewport    @name_window.x = @command_window.width    @name_window.y = @help_window.height    if @storage_name_window == true      @name_window.show    end  end  #--------------------------------------------------------------------------  # * Create Dummy Window  #--------------------------------------------------------------------------  def create_dummy_window    wy = @command_window.y + @command_window.height    wh = Graphics.height - wy    @dummy_window = Window_Base.new(0, wy, Graphics.width, wh)    @dummy_window.viewport = @viewport  end  #--------------------------------------------------------------------------  # * Create Quantity Input Window  #--------------------------------------------------------------------------  def create_number_window    @number_window = Window_StorageNumber.new    @number_window.viewport = @viewport    @number_window.x = ((Graphics.width / 2) - (@number_window.width / 2))     @number_window.y = ((Graphics.height / 2) - (@number_window.height / 2))     @number_window.hide    @number_window.set_handler(:ok,     method(:on_number_ok))    @number_window.set_handler(:cancel, method(:on_number_cancel))  end  #--------------------------------------------------------------------------  # * Create Category Window  #--------------------------------------------------------------------------  def create_category_window    @category_window = Window_StorageCategory.new(@storage_gold)    @category_window.viewport = @viewport    @category_window.help_window = @help_window    @category_window.y = @dummy_window.y    @category_window.hide.deactivate    @category_window.set_handler(:ok,     method(:on_category_ok))    @category_window.set_handler(:cancel, method(:on_category_cancel))  end  #--------------------------------------------------------------------------  # * Create Item Window  #--------------------------------------------------------------------------  def create_item_window    if @storage_category == false      wy = @command_window.y + @command_window.height    else      wy = @category_window.y + @category_window.height    end    wh = Graphics.height - wy    @item_window = Window_StorageItemList.new(0, wy, Graphics.width, wh)    @item_window.viewport = @viewport    @item_window.help_window = @help_window    @item_window.hide    @item_window.set_handler(:ok,     method(:on_item_ok))    @item_window.set_handler(:cancel, method(:on_item_cancel))    if @storage_category == false      @item_window.category = :all    else      @category_window.item_window = @item_window    end  end  #--------------------------------------------------------------------------  # * Create Item Window  #--------------------------------------------------------------------------  def create_gold_window    @gold_window = Window_GoldTransfer.new    @gold_window.viewport = @viewport    @gold_window.x = ((Graphics.width / 2) - (@gold_window.width / 2))     @gold_window.y = ((Graphics.height / 2) - (@gold_window.height / 2))     @gold_window.hide    @gold_window.set_handler(:ok,     method(:on_gold_ok))    @gold_window.set_handler(:cancel, method(:on_gold_cancel))  end  #--------------------------------------------------------------------------  # * Start Category Selection  #--------------------------------------------------------------------------  def start_category_selection    @dummy_window.hide    @item_window.show    @item_window.unselect    @item_window.refresh    @item_window.storage = @command_window.current_symbol    @category_window.show.activate  end  #--------------------------------------------------------------------------  # * [Withdraw] Command  #--------------------------------------------------------------------------  def command_withdraw    if @storage_category == false and @storage_gold == true      case @command_window.current_symbol      when :withdraw        @gold_window.set(max_withdraw, 24)      when :store        @gold_window.set(max_store, 0)      end      @gold_window.show.activate    elsif @storage_category == false      @dummy_window.hide      @item_window.show.activate      @item_window.storage = @command_window.current_symbol      @item_window.select_last    else      start_category_selection    end  end  #--------------------------------------------------------------------------  # * [Store] Command  #--------------------------------------------------------------------------  def command_store    if @storage_category == false and @storage_gold == true      case @command_window.current_symbol      when :withdraw        @gold_window.set(max_withdraw, 24)      when :store        @gold_window.set(max_store, 0)      end      @gold_window.show.activate    elsif @storage_category == false      @dummy_window.hide      @item_window.show.activate      @item_window.storage = @command_window.current_symbol      @item_window.select_last    else      start_category_selection    end  end  #--------------------------------------------------------------------------  # * Category [OK]  #--------------------------------------------------------------------------  def on_category_ok    case @category_window.current_symbol    when :item, :weapon, :armor      @item_window.activate      @item_window.select_last    when :gold      case @command_window.current_symbol      when :withdraw        @gold_window.set(max_withdraw, 24)      when :store        @gold_window.set(max_store, 0)      end      @gold_window.show.activate    end  end  #--------------------------------------------------------------------------  # * Category [Cancel]  #--------------------------------------------------------------------------  def on_category_cancel    @command_window.activate    @dummy_window.show    @item_window.hide    @category_window.hide  end  #--------------------------------------------------------------------------  # * Item [OK]  #--------------------------------------------------------------------------  def on_item_ok    @item = @item_window.item    case @command_window.current_symbol    when :withdraw      @number_window.set(@item, max_withdraw)    when :store      @number_window.set(@item, max_store)    end    @number_window.show.activate  end  #--------------------------------------------------------------------------  # * Item [Cancel]  #--------------------------------------------------------------------------  def on_item_cancel    @item_window.unselect    if @storage_category == false      @item_window.hide      @dummy_window.show      @command_window.activate    else      @category_window.activate    end  end  #--------------------------------------------------------------------------  # * Quantity Input [OK]  #--------------------------------------------------------------------------  def on_number_ok    Sound.play_ok    case @command_window.current_symbol    when :withdraw      do_withdraw(@number_window.number)    when :store      do_store(@number_window.number)    end    @number_window.hide    @item_window.refresh    @item_window.activate    @item_window.select_last  end  #--------------------------------------------------------------------------  # * Quantity Input [Cancel]  #--------------------------------------------------------------------------  def on_number_cancel    Sound.play_cancel    @number_window.hide    @item_window.activate  end  #--------------------------------------------------------------------------  # * Gold Quantity Input [OK]  #--------------------------------------------------------------------------  def on_gold_ok    case @command_window.current_symbol    when :withdraw      gold_withdraw(@gold_window.number)      @gold_window.set(max_withdraw, 24)    when :store      gold_store(@gold_window.number)      @gold_window.set(max_store, 0)    end    @gold_window.show.activate    @gold_window.refresh    Sound.play_ok  end  #--------------------------------------------------------------------------  # * Gold Quantity Input [Cancel]  #--------------------------------------------------------------------------  def on_gold_cancel    Sound.play_cancel    if @storage_category == false && @storage_gold == true      @command_window.activate    else      start_category_selection    end    @gold_window.hide  end  #--------------------------------------------------------------------------  # * Execute Withdraw  #--------------------------------------------------------------------------  def fail_sound_effect      RPG::SE.new("Buzzer2", 100, 100).play  end    def do_withdraw(number)    current_possesion = $game_party.item_number(@item)    if current_possesion == @item.max_limit      fail_sound_effect    else     $game_party.storage_lose_item(@item, number)    $game_party.gain_item(@item, number)    end  end#    $game_party.storage_lose_item(@item, number)#    $game_party.gain_item(@item, number)  #--------------------------------------------------------------------------  # * Execute Store  #--------------------------------------------------------------------------  def do_store(number)    $game_party.storage_gain_item(@item, number)    $game_party.lose_item(@item, number)  end  #--------------------------------------------------------------------------  # * Gold Withdraw  #--------------------------------------------------------------------------  def gold_withdraw(number)    $game_party.storage_lose_gold(number)    $game_party.gain_gold(number)  end  #--------------------------------------------------------------------------  # * Gold Store  #--------------------------------------------------------------------------  def gold_store(number)    $game_party.lose_gold(number)    $game_party.storage_gain_gold(number)  end#--------------------------------------------------------------------------# * Get Maximum Quantity Withdrawable#--------------------------------------------------------------------------  def max_withdraw    case @category_window.current_symbol    when :item, :weapon, :armor      if $game_party.storage_item_number(@item) > @item.max_limit - $game_party.item_number(@item)          return @item.max_limit - $game_party.item_number(@item)       else          $game_party.storage_item_number(@item)      end     when :gold      if $game_party.storage_gold > 999        return 999      else        $game_party.storage_gold      end    end  end  #--------------------------------------------------------------------------  # * Get Maximum Quantity Storable  #--------------------------------------------------------------------------  def max_store    case @category_window.current_symbol    when :item, :weapon, :armor      if $game_party.item_number(@item) > 99        return 99      else        $game_party.item_number(@item)      end    when :gold      if $game_party.gold > 999        return 999      else        $game_party.gold      end    end  endend 
  8. Err.. but I want to remind you something, if you remove Yanfly's script, it will now can cause crash if you withdrawing item, so Yanfly's script is essential for this to work. Have a nice day :) .