The script works flawlessly for me, even with nearly all add-ons for it. Are you sure you're writing the name tag correctly in the script? For example:
or for a whole box setup:
or for a whole box setup:
$game_boxes.setup(7, Shelf, 5)
$game_boxes.setup(7, "Shelf", 5)
:party as the box id for the remove_all and transfer_all methods. Which means you can move all the player's items into a box (or vice versa).#==============================================================================
# Storage Boxes Addon: Item Sizes v1.4
# by IMP1
#------------------------------------------------------------------------------
# THIS SCRIPT REQUIRES THE 'STORAGE BOXES' SCRIPT BY IMP1
#------------------------------------------------------------------------------
# Compatability:
#
# Aliased Methods:
# IMP1_Game_Boxes.fullness
# IMP1_Game_Boxes.space_for
# IMP1_Game_Boxes.capacity
# Scene_ItemStorage.can_move_item_to_inventory?
# Window_BoxTitle.refresh
#
# New Methods/Fields:
# Window_BoxTitle.draw_inventory_amount
#
# Overwritten Methods:
# none.
#
#------------------------------------------------------------------------------
# Version History:
# v1.4 [2018/04/04] : Added capacity method as well.
# Added compatibility for gold withdrawal addon. (by vFoggy)
# v1.3 [2015/06/27] : Use updates to base script.
# v1.2 [2014/11/16] : Fixed bug where inventory limit would not update.
# v1.1 [2014/11/15] : Added and displays the player inventory limit.
# v1.0 [2014/11/14] : Initial release.
#==============================================================================
#==============================================================================
# Game_Boxes
#==============================================================================
class IMP1_Game_Boxes
#--------------------------------------------------------------------------
# Returns the space in a box.
#--------------------------------------------------------------------------
# Changes:
# * Added condition, if item is :gold only 1 is added to the total size.
#--------------------------------------------------------------------------
alias :default_size_fullness :fullness unless $@
def fullness(box_id)
if $imported[:Theo_LimInventory]
i = 0
box(box_id).each do |item, amount|
if item == :gold
i += 1
else
i += item.inv_size * amount
end
end
return i
else
return default_size_fullness(box_id)
end
end
#--------------------------------------------------------------------------
# Returns true if there is enough room for multiple items.
#--------------------------------------------------------------------------
# Changes:
# * Added condition, if the item is :gold the amount is set to 1 (gold
# counted as 1 in boxes).
#--------------------------------------------------------------------------
alias :default_size_space :space_for unless $@
def space_for(item, amount, box)
if $imported[:Theo_LimInventory]
if item == :gold
amount = 1
else
amount *= item.inv_size
end
end
return default_size_space(item, amount, box)
end
#--------------------------------------------------------------------------
# Returns how many of said item can fit into the box.
#--------------------------------------------------------------------------
alias :default_size_fit :how_many_fit unless $@
def how_many_fit(item, box_id)
if $imported[:Theo_LimInventory]
return (capacity(box_id) / item.inv_size).to_i
else
return default_size_fit(item, box_id)
end
end
#--------------------------------------------------------------------------
# Returns the remaining space in a box.
#--------------------------------------------------------------------------
alias :default_size_capacity :capacity unless $@
def capacity(box_id)
if $imported[:Theo_LimInventory]
$game_party.free_slot
else
return BOXES[box_id][:size] - fullness(box_id)
end
end
end # IMP1_Game_Boxes
#==============================================================================
# Scene_ItemStorage
#==============================================================================
class Scene_ItemStorage
#--------------------------------------------------------------------------
# Returns true if there is enough room in the player's inventory.
#--------------------------------------------------------------------------
# Changes (For gold withdrawal addon):
# * Added variable item_size that stores the size of the item. If it is
# :gold its size is set 0.
#--------------------------------------------------------------------------
alias :default_can_move? :can_move_item_to_inventory? unless $@
def can_move_item_to_inventory?(item)
return false if !default_can_move?(item)
space_in_inventory = true
if $imported[:Theo_LimInventory]
item_size = item == :gold ? 0 : item.inv_size
space_in_inventory =
$game_party.total_inv_size + item.inv_size < $game_party.inv_max
end
return space_in_inventory
end
end # Scene_ItemStorage
#==============================================================================
# Window_BoxTitle
#==============================================================================
class Window_BoxTitle
#--------------------------------------------------------------------------
# Draws the contents.
#--------------------------------------------------------------------------
alias :non_limited_inventory_refresh :refresh unless $@
def refresh(*args)
non_limited_inventory_refresh(*args)
if is_inventory_title?
draw_inventory_amount
end
end
#--------------------------------------------------------------------------
# Displays how full the inventory is.
#--------------------------------------------------------------------------
def draw_inventory_amount
if $imported[:Theo_LimInventory]
text = "#{$game_party.total_inv_size}/#{$game_party.inv_max}"
draw_text(0, 0, (Graphics.width/2)-32, line_height, text, 2)
end
end
end # Window_BoxTitle
Nice Script by the way, how do i change the width of the window, Im thinking of fallout 4 like loot size window
How do I make the selected items to be stored in random?
def initialize
y_pos = fitting_height(IMP1_Storage_Boxes::HELP_WINDOW_LINES)
super(x, y_pos, Graphics.width/2, fitting_height(1))
items = [1, 5, 2, 4, 7, 9] # these are the available options
chosen_item = $data_items[items[rand(items.size)]]
$game_boxes.add_item(chosen_item, 5, 1)
thanks a lot for the reply, ill try to understans it now
hello again sir, I cant quite understand it. how will I randomize the items stored in for example box 3? and the quantity of the items?
$game_boxes.add_item($data_items[4], 12, 3)
$game_boxes.add_item($data_weapons[2], 15 + rand(11), 8)
$game_boxes.add_item($data_items[1 + rand(6)], 2, 11)
$game_boxes.add_item($data_items[$game_variables[15]], $game_variables[21], 3)
I finally did it, but there is another problem the contents of 1 box are being passed to one another heres my event
okay thanks I hope you are not irritated to me because I have another question...
$game_boxes.add_item($data_items[1 + rand(6)], 10 + rand(25), 4)
Original thread: https://forums.rpgmakerweb.com/threads/storage-boxes.27727/