Tsukihime 1,489 Posted November 25, 2012 (edited) Inventory Size -Tsukihime This script allows you to limit the size of an inventory by item count. When you have exceeded the limit: -items will not be added to your inventory. -equips cannot be removed, only exchanged -cannot buy anymore items from the shop until you free up some space This script does not define how extra items should be handled, nor does it handle what happens when your inventory size decreases and you have extra items. Download Script: http://db.tt/K2nXwfvl Usage Set the initial inventory size in the configuration. You can change the size of the inventory using script calls $game_party.change_inventory_size(n) # for some integer n Other useful script calls: $game_party.inventory_size # returns the size of the inventory $game_party.inventory_full? # returns true or false, whether it's full or not $game_party.inventory_space # returns how much space is available Edited November 25, 2012 by Tsukihime Share this post Link to post Share on other sites
Wendell 81 Posted December 7, 2012 There is a way to make the stack number of each item doesn't count as a space in the inventory? For example, my inventory limit is 10. I can have 50 potions and still count as only one space used, and 9 spaces will be free in the inventory. Share this post Link to post Share on other sites
Tsukihime 1,489 Posted December 7, 2012 Counting by stack is difficult because then when you want to check whether your inventory is full, you would need to first consider whether the item you are trying to add is already in your inventory or not, and then consider whether THAT stack is already full or not. Share this post Link to post Share on other sites
Wendell 81 Posted December 7, 2012 So, to make each item in each space, not stacking them is possible? 5 potions = 5 spaces occupied? Share this post Link to post Share on other sites
Tsukihime 1,489 Posted December 7, 2012 Yes, that is what the current count is like. Share this post Link to post Share on other sites
Wendell 81 Posted December 8, 2012 Yeah, but I mean, the way it is the items count as a space in the inventory, but they are stacked up. I was talking about something like this (consider the max inventory size as 10): This is the way it actually is: Potionx5 (same line/stacked) = 5 items of 10 max What I'm talking about is something like this, spliting up each item in a line, even if it is the same item: Potion Potion Potion Potion Potion What is exactly the same thing, 5 of 10, but each item in it's own line. Not stacked. Share this post Link to post Share on other sites
Tsukihime 1,489 Posted December 8, 2012 (edited) That is not related to inventory counts and requires a re-write to the inventory. I have written an inventory system for that but I've gotten several PM's saying it's too buggy and incomplete to be used in a real project so fair warning there. Edited December 8, 2012 by Tsukihime Share this post Link to post Share on other sites
spywaretof 5 Posted December 11, 2012 Hello, Is it possible to make so that key_item are not counted in the inventory Share this post Link to post Share on other sites
Hytporsche 10 Posted July 27, 2013 (edited) Trying not to necro post, but.. is there anyway you can make this work with "Mr. Bubble - Dismantle Items"? So, if my inventory was full, I would not be able dismantle that item/armor/weapon etc. (In my case, I am only using the :armor as my dismantle category.) Also, if i was 2 items away from filling up my inventory to being full, would it be possible to have the distmantle item script notice if i dismantled the item and it become 3 pieces, that it would not allow the item to be dismantled. Just as if I were in the "Shop" scene. Here is the link to the script: https://dl.dropboxusercontent.com/u/89346660/Bubs%20-%20Dismantle%20Items.txt Edited July 27, 2013 by Hytporsche Share this post Link to post Share on other sites
roninator2 257 Posted January 18, 2021 Spoiler =begin #============================================================================== ** Inventory Size Author: Hime Date: Nov 25, 2012 ------------------------------------------------------------------------------ ** Change log Nov 25, 2012 - initial release ------------------------------------------------------------------------------ ** Terms of Use * Free to use in non-commercial projects * Contact me for commercial use * No real support. The script is provided as-is * Will do bug fixes, but no compatibility patches * Features may be requested but no guarantees, especially if it is non-trivial * Preserve this header ------------------------------------------------------------------------------ ** Compatibility This script replaces one method Scene_Shop#max_buy ------------------------------------------------------------------------------ ** Description This script allows you to limit the size of an inventory by item count. When you have exceeded the limit: -items will not be added to your inventory. -equips cannot be removed, only exchanged -cannot purchase additional items from the shop This script does not define how extra items should be handled, nor does it handle what happens when your inventory size decreases and you have extra items. ------------------------------------------------------------------------------ ** Usage Set the initial inventory size in the configuration. Increase/decrease inventory size during the game using script calls $game_party.change_inventory_size(n) Where n is a positive or negative integer Check if the inventory is full using script calls $game_party.inventory_full? #============================================================================== =end $imported = {} if $imported.nil? $imported["Tsuki_InventorySize"] = true #============================================================================== # ** Configuration #============================================================================== module Tsuki module Inventory_Size # Starting limit Start_Size = 100 end end #============================================================================== # ** Rest of the script #============================================================================== class Game_Actor < Game_Battler # Can't remove equips if inventory is full alias :th_inventory_size_trade_with_party :trade_item_with_party def trade_item_with_party(new_item, old_item) return false if new_item.nil? && $game_party.inventory_full? # hack because the default method adds before removing, which is silly $game_party.change_inventory_size(1) res = th_inventory_size_trade_with_party(new_item, old_item) $game_party.change_inventory_size(-1) return res end end class Game_Party < Game_Unit alias :th_inventory_size_init :initialize def initialize th_inventory_size_init @inventory_size = Tsuki::Inventory_Size::Start_Size end # Replaced. Change the stack limit based on the item's individual limits. def inventory_size return @inventory_size end def inventory_full? return inventory_count >= inventory_size end # Get the total count for the bag def item_count(bag) return bag.values.inject(:+) || 0 end def inventory_count item_count(@items) + item_count(@weapons) + item_count(@armors) end def inventory_space inventory_size - inventory_count end # Calculate how many we can add alias :th_inventory_size_gain_item :gain_item def gain_item(item, amount, include_equip = false) return if amount > 0 && inventory_full? can_add_amount = amount > 0 ? [inventory_size - inventory_count, amount].min : amount th_inventory_size_gain_item(item, can_add_amount, include_equip) end def change_inventory_size(amount) @inventory_size += amount end end class Window_ShopBuy < Window_Selectable alias :th_inventory_size_enable? :enable? def enable?(item) return false if $game_party.inventory_full? return th_inventory_size_enable?(item) end end class Scene_Shop < Scene_MenuBase # take into consideration inventory space alias :th_inventory_size_max_buy :max_buy def max_buy max = $game_party.max_item_number(@item) - $game_party.item_number(@item) # whichever is smaller max = [$game_party.inventory_space, max].min buying_price == 0 ? max : [max, money / buying_price].min end end Tsukihime Inventory Size script 1 Share this post Link to post Share on other sites
PhoenixSoul 1,404 Posted January 18, 2021 Will be adding to the list of dead script links. I don't even know if this one is in the master list. Share this post Link to post Share on other sites