Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: G_G on May 01, 2009, 08:50:28 pm

Title: [XP] Item Storage
Post by: G_G on May 01, 2009, 08:50:28 pm
Item Storage
Authors: game_guy
Version: 1.42
Type: Item Storage
Key Term: Misc System



Introduction

If you've ever played any of the Elder Scrolls series or Fallout series than of
course then you would have noticed the awesome item storage. This script does that


Features




Screenshots

Spoiler: ShowHide
Chest 1
(http://i307.photobucket.com/albums/nn318/bahumat27/chest1.png)
Chest 1 Storage
(http://i307.photobucket.com/albums/nn318/bahumat27/chest1storage.png)
Chest 2
(http://i307.photobucket.com/albums/nn318/bahumat27/chest2.png)
Chest 2 Storage
(http://i307.photobucket.com/albums/nn318/bahumat27/chest2storage.png)



Demo

(Outdated!)
MediaFire (http://www.mediafire.com/download.php?ywdwwhogoga)


Script

Spoiler: ShowHide

#===============================================================================
# Item Storage
# Author game_guy
# Version 1.42
#-------------------------------------------------------------------------------
# Intro:
# Okay. Well if you've played the Elder Scrolls Series or Fallout then you'd
# know that it has an item storage system. What it does is lets you open up
# closets, chests, ect and store and take items out of it.
#
# Features:
# Store and Take Items Out of Chests, Closets, ect
# Have Seperate Chests, Closets, ect
# Easy to Use
# Stores Chests into Game System Instead of Variables
# Have Max Amount of Items In Chest
# Set Default Items in Chest
# Mark Items as "Key Items" to prevent removal from inventory (e.g. "Quest Items")
# Take All/Store All Items in Chest (Not built into scene)
#
# Instructions:
# First lets go over the syntaxes.
#
# Calling the Item Storage:
# $scene = Scene_Chest.new(chest_id, max_items)
# chest_id is the number chest you want open
# max_items is the max amount of any item the chest can hold
# you can just use this to
# $scene = Scene_Chest.new(chest_id)
# because in the config this ChestMaxItems is the default so if you dont use
# the long one, it'll use the default.
#
# New Syntaxes:
# You can now take all items from a chest and empty your entire inventory
# into a chest. While this isn't built into the scene, you'll have to do this
# through a script call.
# -Take All
#   chest = $game_system.chests(chest_id)
#   chest.take_all
# -Empty Inventory
#   chest = $game_system.chests(chest_id)
#   chest.empty_all
#
# You can now add/remove items to and from chests.
#   chest = $game_system.chests(chest_id)
#   chest.aaa_bbb(ccc, ddd)
#   aaa = add/take
#   bbb = item/weapon/armor
#   ccc = item/weapon/armor id
#   ddd = amount
#
# Okay so thats done with the syntaxes. Now onto the configuration.
# Go down to Begin Config and do all your configuration there.
#
# Credits:
# game_guy ~ for making it
# MightyLink ~ requesting the system
#===============================================================================
module GameGuy
  #============================================================================
  # KeyItemId       = Element ID for non removable items.
  #                   Items/weapons/armors with marked with this element
  #                   cannot be removed.
  #============================================================================
  KeyItemId         = 17
  #============================================================================
  # ChestMaxItems   = The max amount of any item a chest can hold. So example
  #                   Its 9999 so it can have 9999 of any item.
  #============================================================================
  ChestMaxItems     = 9999
  def self.chest_items(id)
    case id
    #==========================================================================
    # Config Chest Items
    # Use this
    # when chest_id then return [[id, amount, type], [id, amount, type]]
    # id = item, weapon, or armor id
    # amount = the amount
    # type = 0, 1, or 2 0 = item, 1 = weapon, 2 = armor
    # Example:
    # when 1 then return [[1, 3, 0], [1, 1, 1]]
    # This has 3 potions, and 1 bronze sword. So when this is called
    # $scene = Scene_Chest.new(1)
    # it will have those items in the chest already.
    #==========================================================================
    when 1 then return [[1, 999, 0], [1, 1, 1]]
    when 2 then return [[1, 10, 0], [1, 1, 2], [1, 2, 1]]
    when 3 then return [[1, 10, 2], [3, 1, 1], [9, 1, 1]]
    end
    return []
  end
end

#==============================================================================
# Game_System
#------------------------------------------------------------------------------
# Modded it so it makes it store every chest.
#==============================================================================
class Game_System
  alias gg_add_item_storage initialize
  def initialize
    @chests = []
    return gg_add_item_storage
  end
  def chests(n)
    if @chests[n] == nil
      @chests[n] = Game_Chest.new(GameGuy::ChestMaxItems)
      items = GameGuy.chest_items(n)
      for i in 0...items.size
        item = items[i][2]
        case item
        when 0
          @chests[n].add_item(items[i][0], items[i][1])
        when 1
          @chests[n].add_weapon(items[i][0], items[i][1])
        when 2
          @chests[n].add_armor(items[i][0], items[i][1])
        else
          @chests[n].add_item(items[i][0], items[i][1])
        end
      end
    end
    return @chests[n]
  end
end

#==============================================================================
# Game_Chest
#------------------------------------------------------------------------------
# Holds all the data for a single chest.
#==============================================================================
class Game_Chest
  attr_accessor :max
  def initialize(max = GameGuy::ChestMaxItems)
    @max = max
    @items = {}
    @weapons = {}
    @armors = {}
  end
  def item_amount(item_id)
    return @items.include?(item_id) ? @items[item_id] : 0
  end
  def weapon_amount(weapon_id)
    return @weapons.include?(weapon_id) ? @weapons[weapon_id] : 0
  end
  def armor_amount(armor_id)
    return @armors.include?(armor_id) ? @armors[armor_id] : 0
  end
  def add_item(item_id, n)
    if item_id > 0
      @items[item_id] = [[item_amount(item_id) + n, 0].max, @max].min
    end
  end
  def add_weapon(weapon_id, n)
    if weapon_id > 0
      @weapons[weapon_id] = [[weapon_amount(weapon_id) + n, 0].max, @max].min
    end
  end
  def add_armor(armor_id, n)
    if armor_id > 0
      @armors[armor_id] = [[armor_amount(armor_id) + n, 0].max, @max].min
    end
  end
  def take_item(item_id, n)
    add_item(item_id, -n)
  end
  def take_weapon(weapon_id, n)
    add_weapon(weapon_id, -n)
  end
  def take_armor(armor_id, n)
    add_armor(armor_id, -n)
  end
  def empty_all
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0
        add_item(i, $game_party.item_number(i))
        $game_party.lose_item(i, $game_party.item_number(i))
      end
    end
    for i in 1...$data_weapons.size
      if $game_party.weapon_number(i) > 0
        add_weapon(i, $game_party.weapon_number(i))
        $game_party.lose_weapon(i, $game_party.weapon_number(i))
      end
    end
    for i in 1...$data_armors.size
      if $game_party.armor_number(i) > 0
       add_armor(i, $game_party.armor_number(i))
       $game_party.lose_armor(i, $game_party.armor_number(i))
      end
    end
  end
  def take_all
    for i in 1...$data_items.size
      if item_amount(i) > 0
        n = [99, ($game_party.item_number(i) - item_amount(i)).abs].min
        $game_party.gain_item(i, n)
        take_item(i, n)
      end
    end
    for i in 1...$data_weapons.size
      if weapon_amount(i) > 0
        n = [99, ($game_party.weapon_number(i) - weapon_amount(i)).abs].min
        $game_party.gain_weapon(i, n)
        take_weapon(i, n)
      end
    end
    for i in 1...$data_armors.size
      if armor_amount(i) > 0
         n = [99, ($game_party.armor_number(i) - armor_amount(i)).abs].min
        $game_party.gain_armor(i, n)
        take_armor(i, n)
      end
    end
  end
end

#==============================================================================
# Window_Chest_Choices
#------------------------------------------------------------------------------
# The choices for the chest when the scene is opened.
#==============================================================================
class Window_Chest_Choices < Window_Selectable
  def initialize
    super(0, 0, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    @item_max = 3
    @column_max = 3
    @commands = ["Store Items", "Take Items", "Exit"]
    self.z = 200
    refresh
    self.index = 0
  end
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i)
    end
  end
  def draw_item(index)
    x = 4 + index * 215
    self.contents.draw_text(x, 0, 128, 32, @commands[index], 1)
  end
end

#==============================================================================
# Window_Chest_Item
#------------------------------------------------------------------------------
# Displays all items in the chest.
#==============================================================================
class Window_Chest_Item < Window_Selectable
  def initialize(chest)
    super(320, 64, 320, 416)
    @chest = chest
    @column_max = 1
    refresh
    self.index = 0
    if $game_temp.in_battle
      self.y = 64
      self.height = 256
      self.back_opacity = 160
    end
  end
  def item
    return @data[self.index]
  end
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 1...$data_items.size
      if @chest.item_amount(i) > 0
        @data.push($data_items[i])
      end
    end
    unless $game_temp.in_battle
      for i in 1...$data_weapons.size
        if @chest.weapon_amount(i) > 0
          @data.push($data_weapons[i])
        end
      end
      for i in 1...$data_armors.size
        if @chest.armor_amount(i) > 0
          @data.push($data_armors[i])
        end
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  def draw_item(index)
    item = @data[index]
    self.contents.font.color = normal_color
    if item.is_a?(RPG::Weapon) || item.is_a?(RPG::Item)
      if item.element_set.include?(GameGuy::KeyItemId)
        self.contents.font.color = disabled_color
      end
    else
      if item.guard_element_set.include?(GameGuy::KeyItemId)
        self.contents.font.color = disabled_color
      end
    end
    case item
    when RPG::Item
      number = @chest.item_amount(item.id)
    when RPG::Weapon
      number = @chest.weapon_amount(item.id)
    when RPG::Armor
      number = @chest.armor_amount(item.id)
    end
    x = 4 + index % @column_max * (288 + 32)
    y = index / @column_max * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 216, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 224, y, 48, 32, number.to_s, 2)
  end
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
end

#==============================================================================
# Window_Party_Item
#------------------------------------------------------------------------------
# Displays all items the party has.
#==============================================================================
class Window_Party_Item < Window_Selectable
  def initialize
    super(0, 64, 320, 416)
    @column_max = 1
    refresh
    self.index = 0
    if $game_temp.in_battle
      self.y = 64
      self.height = 256
      self.back_opacity = 160
    end
  end
  def item
    return @data[self.index]
  end
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0
        @data.push($data_items[i])
      end
    end
    unless $game_temp.in_battle
      for i in 1...$data_weapons.size
        if $game_party.weapon_number(i) > 0
          @data.push($data_weapons[i])
        end
      end
      for i in 1...$data_armors.size
        if $game_party.armor_number(i) > 0
          @data.push($data_armors[i])
        end
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  def draw_item(index)
    item = @data[index]
    self.contents.font.color = normal_color
    if item.is_a?(RPG::Weapon) || item.is_a?(RPG::Item)
      if item.element_set.include?(GameGuy::KeyItemId)
        self.contents.font.color = disabled_color
      end
    else
      if item.guard_element_set.include?(GameGuy::KeyItemId)
        self.contents.font.color = disabled_color
      end
    end
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    x = 4 + index % @column_max * (288 + 32)
    y = index / @column_max * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 216, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 224, y, 48, 32, number.to_s, 2)
  end
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
end

#==============================================================================
# Scene_Chest
#------------------------------------------------------------------------------
# The scene that controls storing and taking items.
#==============================================================================
class Scene_Chest
  def initialize(chest=1, max=GameGuy::ChestMaxItems)
    @chestid = chest
    @chest = $game_system.chests(@chestid)
  end
  def main
    @help_window = Window_Help.new
    @help_window.visible = false
    @command_window = Window_Chest_Choices.new
    @party_window = Window_Party_Item.new
    @party_window.active = false
    @chest_window = Window_Chest_Item.new(@chest)
    @chest_window.active = false
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    @help_window.dispose
    @command_window.dispose
    @party_window.dispose
    @chest_window.dispose
  end
  def update
    @help_window.update
    @command_window.update
    @party_window.update
    @chest_window.update
    if @command_window.active
      update_command
      return
    end
    if @party_window.active
      update_party
      return
    end
    if @chest_window.active
      update_chest
      return
    end
  end
  def update_command
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
    if Input.trigger?(Input::C)
      case @command_window.index
      when 0
        $game_system.se_play($data_system.decision_se)
        @party_window.active = true
        @party_window.help_window = @help_window
        @command_window.active = false
        @help_window.z = 500
        @help_window.visible = true
      when 1
        $game_system.se_play($data_system.decision_se)
        @chest_window.active = true
        @chest_window.help_window = @help_window
        @command_window.active = false
        @help_window.z = 500
        @help_window.visible = true
      when 2
        $game_system.se_play($data_system.cancel_se)
        $scene = Scene_Map.new
      end
      return
    end
  end
  def update_party
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @command_window.active = true
      @help_window.visible = false
      @party_window.help_window = nil
      @party_window.active = false
      return
    end
    if Input.repeat?(Input::C)
      @item = @party_window.item
      unless @item.is_a?(RPG::Item) or @item.is_a?(RPG::Weapon) or
             @item.is_a?(RPG::Armor)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
  if @item.element_set.include?(GameGuy::KeyItemId)
$game_system.se_play($data_system.buzzer_se)
return
  end
      case @item
      when RPG::Item
        amount = @chest.item_amount(@item.id)
        if amount < @chest.max
          $game_system.se_play($data_system.decision_se)
          @chest.add_item(@item.id, 1)
          $game_party.lose_item(@item.id, 1)
        else
          $game_system.se_play($data_system.buzzer_se)
          return
        end
      when RPG::Weapon
        amount = @chest.weapon_amount(@item.id)
        if amount < @chest.max
          $game_system.se_play($data_system.decision_se)
          @chest.add_weapon(@item.id, 1)
          $game_party.lose_weapon(@item.id, 1)
        else
          $game_system.se_play($data_system.buzzer_se)
          return
        end
      when RPG::Armor
        amount = @chest.armor_amount(@item.id)
        if amount < @chest.max
          $game_system.se_play($data_system.decision_se)
          @chest.add_armor(@item.id, 1)
          $game_party.lose_armor(@item.id, 1)
        else
          $game_system.se_play($data_system.buzzer_se)
          return
        end
      end
      @party_window.refresh
      @chest_window.refresh
      return
    end
  end
  def update_chest
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @command_window.active = true
      @help_window.visible = false
      @chest_window.help_window = nil
      @chest_window.active = false
      return
    end
    if Input.repeat?(Input::C)
      @item = @chest_window.item
      unless @item.is_a?(RPG::Item) or @item.is_a?(RPG::Weapon) or
             @item.is_a?(RPG::Armor)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      case @item
      when RPG::Item
        amount = $game_party.item_number(@item.id)
        if amount < 99
          $game_system.se_play($data_system.decision_se)
          @chest.take_item(@item.id, 1)
          $game_party.gain_item(@item.id, 1)
        else
          $game_system.se_play($data_system.buzzer_se)
          return
        end
      when RPG::Weapon
        amount = $game_party.weapon_number(@item.id)
        if amount < 99
          $game_system.se_play($data_system.decision_se)
          @chest.take_weapon(@item.id, 1)
          $game_party.gain_weapon(@item.id, 1)
        else
          $game_system.se_play($data_system.buzzer_se)
          return
        end
      when RPG::Armor
        amount = $game_party.armor_number(@item.id)
        if amount < 99
          $game_system.se_play($data_system.decision_se)
          @chest.take_armor(@item.id, 1)
          $game_party.gain_armor(@item.id, 1)
        else
          $game_system.se_play($data_system.buzzer_se)
          return
        end
      end
      @party_window.refresh
      @chest_window.refresh
      return
    end
  end
end

Note:
If you use RMX-OS, include the script above but also place this script below RMX-OS for it to save properly.
module RMXOS
 module Options
   SAVE_DATA[Game_System].push('@chests')
   SAVE_DATA[Game_Chest] = ['@max', '@weapons', '@armors', '@items']
   CREATION_DATA[Game_Chest] = GameGuy::ChestMaxItems.to_s
 end
end



Instructions

New and improved instructions in the script.


Compatibility

Not tested with SDK.
Compatible with RMX-OS (Must use small plugin)


Credits and Thanks




Author's Notes

Enjoy and give credits!ll have to do this
# through a script call.
# -Take All
#
Title: Re: [XP] Item Storage
Post by: Starrodkirby86 on May 01, 2009, 09:30:22 pm
I have a request on this sort of script, if you can achieve this.

There was an Indie game I played a long time ago known as the Exile series (Now remade into Avernum), and they had a similar item system to this. However, their item system has its few differences.

For one:


I think of your screenshot as another mechanism of "Item Pick-up" within this system.

With the case of those item drops and whatever, it can be a serious way of abuse, huh? The developers of Exile moderated it through this way...Even though you can drop items anywhere you want, when leaving the town for a while, the items dropped will be gone. The only exception is at certain special areas, such as the Storage Room or the House on the Hill (In one game).

Can you perhaps make something like this? Of course, I'm not forcing you.

Great script though.
Title: Re: [XP] Item Storage
Post by: G_G on May 01, 2009, 09:34:33 pm
I'll try I guess.
The items you pickup are easily evented. Have a player touch event, through is checked, respective graphic, add item, eh you get the point.
Title: Re: [XP] Item Storage
Post by: Aqua on May 01, 2009, 09:39:35 pm
Star meant that the items that are picked up can be the ones you dropped.
Title: Re: [XP] Item Storage
Post by: Mightylink on May 01, 2009, 09:41:51 pm
One of my favorite scripts, great job on this one :)
Title: Re: [XP] Item Storage
Post by: G_G on May 01, 2009, 09:43:50 pm
Quote from: Elite Four Aqua on May 01, 2009, 09:39:35 pm
Star meant that the items that are picked up can be the ones you dropped.


Either way it'll still require quite of bit of scripting I will see and try to see what I can do but no promises.
Title: Re: [XP] Item Storage
Post by: Reno-s--Joker on May 02, 2009, 05:15:53 am
Wow, this is reeeaalllly neat. *instant power up for G_G* Great idea Mightylink too. :)

... Is it kinda like Fat Chocobo?
Wait, I'll DL the demo actually. Might use this in my game.
Title: Re: [XP] Item Storage
Post by: cstb on May 07, 2009, 09:17:57 am
I may use this too IF he adds the ability to have items already in a chest.
Title: Re: [XP] Item Storage
Post by: legacyblade on May 07, 2009, 03:11:12 pm
I'm pretty sure he's adding that ability.
Title: Re: [XP] Item Storage
Post by: Mightylink on May 08, 2009, 12:27:32 am
Isnt it already added?
Title: Re: [XP] Item Storage
Post by: G_G on May 08, 2009, 12:31:24 am
sorta but the way I showed you has to be used before any chest is opened. I'm trying to do what legacy said but I'm still trying to get it.
Title: Re: [XP] Item Storage
Post by: legacyblade on May 08, 2009, 09:53:03 am
If you are having trouble, PM me what you're having trouble with, and I'll help you. I always love to help people when I can.
Title: Re: [XP] Item Storage
Post by: Mightylink on May 08, 2009, 09:57:30 am
I think its perfect already :P You just need to have a one time condition before opening the chest.
Title: Re: [XP] Item Storage
Post by: G_G on May 08, 2009, 08:37:03 pm
Thnx mighty, lb I think I almost got it, oh and Link I did update my achievements script in case you never noticed. It needs to be below this scrip thtough.
Title: Re: [XP] Item Storage
Post by: Mightylink on May 08, 2009, 08:58:05 pm
Yes I got it, for those wondering about chests with items already in it, this is the event code to use, at least for now till gi gi updates the script:

(http://i123.photobucket.com/albums/o296/MightyLink/chest.png)

All you need to do is pick an unused switch and have your give items run once with that condition, that way the items dont come back when you loot the chest again.

I actually like it this way, you can do all sorts of neat stuff like have respawning chests, chest that add items when certain events happen, or you can even make the same herb chest from oblivion, put an item in and get 10 of that item a week later, its all possible through this event.
Title: Re: [XP] Item Storage
Post by: Skillzalot on May 12, 2009, 11:24:50 am
Can you please add to it so you can limit how many items you can store in each bag
Title: Re: [XP] Item Storage
Post by: Mightylink on May 12, 2009, 12:14:25 pm
Youngster Gi Gi, I dont know why but im getting new problems, it started happening after I updated all of blizzards scripts but I dont know how it could be related.

When I put items in chests (with player) they no longer stay in the chest and I lose those items, errrr i dont know what happend, I never changed anything it was working so perfectly till now.
Title: Re: [XP] Item Storage
Post by: G_G on May 12, 2009, 05:24:14 pm
Maybe try placing this below all of blizz's scripts and see if it works.
Title: Re: [XP] Item Storage
Post by: Mightylink on May 13, 2009, 02:51:22 am
place what :P
Title: Re: [XP] Item Storage
Post by: G_G on May 13, 2009, 05:16:28 pm
Place my achievements script and the item storage script below blizz's scripts.
Title: Re: [XP] Item Storage
Post by: Xuroth on June 09, 2009, 06:13:57 pm
I would like to ask you to add a couple of features:
1. When storing or dropping items, make a pop-up window that asks how many (if you have x number of an item or more) to store/drop
2. Why store items? you should make a item limit or equipment weight system( I know there already are some, but yours would be compatible with this script) to limit the inventory, forcing the player to have to store/drop items. Maybe base it off the party's combined STR to simulate the whole party sharing in carrying loot etc. It's like having a bank/atm system in a game but no reason to use it, the player will just keep their gold with them.

I dont know if you like my suggestions, but I offered them... I think it would make your system very powerful compared to other item storage scripts Ive seen...
Title: Re: [XP] Item Storage
Post by: G_G on June 09, 2009, 06:43:05 pm
when I get time I'll add the pop up window. But I'm not sure how I would go forcing the player to have to drop items. But theres an item limit of 99 already for each item. So that makes players have to store items already.
Title: Re: [XP] Item Storage
Post by: Xuroth on June 09, 2009, 07:00:26 pm
I was just thinking that the 99 of any item would seem kinda ridiculus.  Arshes: I can carry 99 of any item, but not 100, yet i can carry 99 of another item at the same time!
Hilda: I can carry 250 pounds of items
you already have an awesome feature, but I think you could do even better. of course if you dont like the idea, thats fine. I know how it would work, and how to assign (through many ways ) weight to items using multiplexed dummy elements or by using a comment in the items description (simpler) any way thanks for the awesome script
Title: Re: [XP] Item Storage
Post by: lilbrudder917 on June 17, 2009, 07:06:40 pm
I seem to get an error when I open it, select "Store Items," then exit the script.
Strange thing is, I was trying to see if it was an incompatibility issue with my other scripts, so I added each of my scripts (in the same order) to a new project, and did the same thing on the new project. I also tried moving the script up (one spot at a time, to see if it'd make a difference) but nothing different happened, nothing failed on the new project any of the times, but it messed up every time on the first one. I don't get why. Anyway, this is the error message (it was the same message each time):

(http://img401.imageshack.us/img401/3051/errorarh.png)


(If you want the script order, PM me.)
Title: Re: [XP] Item Storage
Post by: Calintz on June 17, 2009, 07:10:39 pm
Another one of those "simple" scripts that adds a very nice feature to your game.
Good job Game_Guy.
Title: Re: [XP] Item Storage
Post by: vacancydenied on July 27, 2009, 10:04:55 am
Thanks for this great script =). Works perfectly in the demo you provide but I cant seem to get it to work just right with mine yet. This error keeps coming up.

Script 'Storage System' line 53: NoMethodError Occured
undefined method 'item_number' for 1:Fixnum

Is it possible that I placed the script in the wrong place. I have under all Blizzard's scripts. It does the same thing whether its above or below his scripts. Any advice?
Title: Re: [XP] Item Storage
Post by: G_G on July 27, 2009, 10:08:21 am
what scripts are you using?

Upload your project with all of your scripts I'll take a look at it.
Title: Re: [XP] Item Storage
Post by: vacancydenied on July 27, 2009, 10:53:19 am
I also tried adding your Modify Max Amount script but I got an error with that also I believe. Thank you for helping me with this =).
Spoiler: ShowHide
http://www.geocities.com/gokuncloud/Test.zip (http://www.geocities.com/gokuncloud/Test.zip)


Also I am just testing scripts out so that's why there isn't much done just yet.
Title: Re: [XP] Item Storage
Post by: G_G on September 26, 2009, 05:30:24 pm
Okay I guys I've gotten alot better in scripting. So I'm doing a complete redo on this system. I'm starting from scratch and I'm going to make it do more things.

Here's some planned ideas
* Dont use the game variables
* Easily have items already in chest
* Add or remove items in chest via script call

So yea this script is getting revamped and does anyone have any other suggestions I could put in it?
Title: Re: [XP] Item Storage
Post by: Hellfire Dragon on September 26, 2009, 06:22:10 pm
Maybe a limit on how much you can put in a chest, I don't think you'd fit 99 swords and shields into a jewlery box for example :P
Title: Re: [XP] Item Storage
Post by: G_G on September 26, 2009, 06:34:44 pm
Good suggestion adding it right now

almost done with the new revamped version :)
What it does is actually store the chests into $game_system.chests which is an array. That way it doesnt use up variables but it still keeps track of what it holds.

Trying to figure out how to set it up making it where chests already have default items.

EDIT:
Okay added new features and new instructions. Everything is working great and its got more compatibility because the chests are saved in Game System.
So you can now do this
Have default max amount of any item in any chest but can easily be changed when calling the scene
Have items already in any chest
Saves in game system to make it more compatible enjoy! :)
Title: Re: [XP] Item Storage
Post by: 03shalan on September 29, 2009, 03:13:20 pm
Thanks for such a great script!!

Sorry if this has already been mentioned, but I've been a little confused by people's suggestions along the way. I'm peeved I missed the chance to suggest some good features!

I don't see why people are complaining about ''why would people store things''...just put item limit scripts in if you can o_o anyway...

Is there some way to say, reset the container's contents? By this I mean, I love the idea of storage and putting things in and out of chests, wardrobes etc: but say you got an item from a chest in an NPC's house somewhere, and left a pickle behind, It doesn't make much sense if the pickle stays there ages after you come back. So like I think someone said before, can it be so that certain containers/events (such as YOUR chests, or a bank, etc) allow you to store items in and out, but leaving items in other places (such as an NPC's house) will cause them to dissapear after a while?

Have you already implemented this, or is there a way of doing so, or is it stupidly obvious already? x.x
Thanks x
Title: Re: [XP] Item Storage
Post by: G_G on September 29, 2009, 03:15:07 pm
I can add this for a script call
Chest.clear_chest(chest_id)


It wont take long to add
Title: Re: [XP] Item Storage
Post by: G_G on December 07, 2009, 03:31:56 am
added compatibility for RMX-OS
Title: Re: [XP] Item Storage
Post by: droneseven on December 07, 2009, 05:09:32 am
can we open the item storage on Chest A and deposit items on it, and then open the same item storage in Chest B?
(imagine an Item Bank system)
Title: Re: [XP] Item Storage
Post by: G_G on December 07, 2009, 09:35:47 am
well if you really wanted to, all you'd do is have two different events and use this in a script call in both events
$scene = Scene_Chest.new(1)
Title: Re: [XP] Item Storage
Post by: SP27 on January 01, 2010, 07:57:26 pm
 :haha: Amazing script game guy! I love it!
Typical Fallout 3 / Oblivion awesomeness, great job!

The only thing that I really feel is missing is that you can put all of your items in it.
What I mean with that is that some items you don't want the player to be able to remove from the holding bag.

I've fiddled around with the script and I can't seem to figure out how you cannot put certain items in.
I just kept getting syntax errors.

Would you be kind enough to consider this feature in a future update?
Title: Re: [XP] Item Storage
Post by: G_G on January 02, 2010, 03:23:52 am
Yea I'll add that. So pretty much you want to be able to not put some items in there. That'll be simple. The hard thing is when I'll be able to do it.
Title: Re: [XP] Item Storage
Post by: SP27 on January 02, 2010, 04:11:48 am
I see, well take your time. And thanks.

...If I only knew the syntex for individual item ID's, then I could have done it myself, instead of bothering you.
I've already managed to make it work with another script called item limits. (i.e you can only carry 20 potions)
Title: Re: [XP] Item Storage
Post by: Xero on January 15, 2011, 08:46:01 am
Hey man nice script! Could you make it so that if there is a certain number of items (say 10) in the box, a window would pop up saying how many you would like to take? Cuz like in fallout, money can be picked up in my treasure chests and it would take really long without such a menu O_O

Thanks in advance!


Title: Re: [XP] Item Storage
Post by: monkeydash on January 16, 2011, 10:33:51 am
Love this script, its gonna make it so much better than having an event for every chest.

I was wondering though, if its possible to put Gold in the chests.
Title: Re: [XP] Item Storage
Post by: G_G on January 16, 2011, 10:44:43 am
Possibly in a later version. I'm remaking the system completely for a friend who plans on making an Oblivion esque game.
Title: Re: [XP] Item Storage
Post by: Xero on January 16, 2011, 03:44:30 pm
Quote from: monkeydash on January 16, 2011, 10:33:51 am
Love this script, its gonna make it so much better than having an event for every chest.

I was wondering though, if its possible to put Gold in the chests.



If you want to have gold in your chests simply make an item that represents your gold then make a common event with a conditional branch that says
"If you have 1 gold (the item you made), remove it from your inventory then add one gold (the actual money)" Give it kinda a fallout feel :3






Title: Re: [XP] Item Storage
Post by: monkeydash on January 16, 2011, 03:51:32 pm
Thanks Xero. Im sure that will do in the meantime.
Title: Re: [XP] Item Storage
Post by: rezpect on April 20, 2011, 01:48:57 pm
whether this necropost?
if so, sorry!

I just wanted to ask, if this script could store only one kind of thing only?
as in the first chest can only store a weapon!
and the second chest can only store as armor!

if you can like it, please let me know how?  :bow: :nod:

OOT : sorry my english is very bad  :facepalmx: :facepalmx: :whistle:
Title: Re: [XP] Item Storage
Post by: diagostimo on June 10, 2011, 10:11:23 am
hi there, i was wondering if you could help me with a problem im having trying to run this scrip with the os script, i have got the most recent update.

i have included the os add-on right below the item storage script, and these are below the two os scripts, i create a new user on the server it loads fine, i quit the game then reboot it loging in as same user, loads fine, i go to anpc that executed the item deposit and put some random items in there, quit then log back in and i get this error:

Script'(RM-OS) Script' line 2458: Argument Error occurred.

any idea what im doing wrong or is this script no longer compatible with the recent version?
Title: Re: [XP] Item Storage
Post by: G_G on June 10, 2011, 04:55:27 pm
Should still be compatible. However, I'm gonna do a rewrite of this script, make it a little more prettier and better all around. If I have time I'll look into the RMX-OS problem.
Title: Re: [XP] Item Storage
Post by: diagostimo on June 10, 2011, 05:01:48 pm
that would be great if you could, i am also using alot of the other os addons so maybe there could be conflict? ignore the pm i saw you were online and thought you might have not seen my post:)
Title: Re: [XP] Item Storage
Post by: diagostimo on June 11, 2011, 10:03:19 am
i tryed messing with it but no luck, the error occures on this section of the os script-

#----------------------------------------------------------------------------
  # Deserializes data retrieved from the server into this object.
  #  prefix - semantical prefix for loaded data access
  #  classe - class that needs to be instantiated
  # Returns: New instance of a class after loading.
  #----------------------------------------------------------------------------
  def rmxos_deserialize_object(prefix, classe)
    # if classe requires additional creation arguments
    if RMXOS::Options::CREATION_DATA.has_key?(classe)
      # get the arguments
      args = RMXOS::Options::CREATION_DATA[classe]
      # create an instance with those arguments
      new = eval("#{classe.name}.new(#{args})")
    else
      # simply instantiate the class
      new = classe.new
    end
    # load data for this class
    new.rmxos_deserialize("#{prefix}/#{classe.name}")
    return new
  end
 
end

the error to be specific is on this line-

# simply instantiate the class
      new = classe.new

so the problem i guess is not saving the class with the data but initiating it with the new data
Title: Re: [XP] Item Storage
Post by: Helskyth on March 26, 2012, 09:33:48 pm
Necropost in a way, but, there's something I was hoping you could help me out with that uses your Item Storage.

I know that it's designed so the player physically interacts with a chest in order to place items in there, but is there a way of forcing items to be removed from a players inventory and being placed into a chest without physically interacting? :huh:

For example: I have a scene where the characters are captured and taken to a prison. Naturally, they'd lose all their items because what idiot would let their prisoners carry swords still? Unfortunately, the engine only has ways to store the players equipped items in variables (and I suppose with more sleuthing, I could get the item ID of every item they "may" have on them and store that amount in variables too to be called upon and re-allocated later), so you can see where this isn't all that practical.

So is there by chance a way of scripting it to take items from an inventory, maybe by referring to item ID's to know what to remove (or something, I really haven't got a clue how such would work.  :^_^':)

Thanks in advance for any help.
Title: Re: [XP] Item Storage
Post by: G_G on March 26, 2012, 10:39:33 pm
I'll do a quick script revamp. Its possible but it'd be a pain in the ass. I'll rewrite a few parts of the script and it should be easier to add items to chests in game.
Title: Re: [XP] Item Storage
Post by: Helskyth on March 31, 2012, 12:49:02 am
Don't press yourself if it's a massive pain. Finding an alternate way to solve the problem I described is a good challenge still, that I'd give it a shot with events and variables still. Or just cut-scene the bitch hardcore. :D
Title: Re: [XP] Item Storage
Post by: G_G on March 31, 2012, 02:08:21 am
Updated to 1.3.

Changelog:
-You can now add/remove items to chests while in game.
-You can take all items from a chest (Limits you to 99 items)
-You can now empty your inventory into a chest

Note: These new features can only be accessed via script call. They are not part of the scene itself.

Script Calls: (Also in instructions)
 New Syntaxes:
You can now take all items from a chest and empty your entire inventory
into a chest. While this isn't built into the scene, you'll have to do this
through a script call.
-Take All
   chest = $game_system.chests(chest_id)
   chest.take_all
-Empty Inventory
   chest = $game_system.chests(chest_id)
   chest.empty_all

You can now add/remove items to and from chests.
   chest = $game_system.chests(chest_id)
   chest.aaa_bbb(ccc, ddd)
   aaa = add/take
   bbb = item/weapon/armor
   ccc = item/weapon/armor id
   ddd = amount
Title: Re: [XP] Item Storage
Post by: Helskyth on March 31, 2012, 08:14:07 pm
Just put the new script calls on a run for their money then, and they worked seamlessly!

Thanks a shot-load G_G. This script's going to make things a hundred times easier!
Title: Re: [XP] Item Storage
Post by: zottel89 on June 02, 2012, 11:04:10 am
Hey there, game_guy  :)

Your script is reaaally awesome, I love it !
I have just one question (which has actually already been asked):

Quote from: SP27 on January 01, 2010, 07:57:26 pm
The only thing that I really feel is missing is that you can put all of your items in it.
What I mean with that is that some items you don't want the player to be able to remove from the holding bag.

Would you be kind enough to consider this feature in a future update?


Quote from: game_guy on January 02, 2010, 03:23:52 am
Yea I'll add that. So pretty much you want to be able to not put some items in there. That'll be simple. The hard thing is when I'll be able to do it.



Is this still in the making ?! 'Cause if it is, then I'm gonna be a really happy guy someday :P

Right now, I'm having a pretty simple "Diary" system in my game.
It's basically an item, which starts a common event that tells the player his
current main quest (based on variable values).

The thing is...  I don't want the player to be able to put the diary into the "Item Storage" (Chest).
That's kind of my problem right now ^^


Sry for the bad english btw,
I'm no native speaker.
Title: Re: [XP] Item Storage
Post by: G_G on June 02, 2012, 11:37:06 am
I'll try to get to it sometime soon. Finally out of school so I've got a lot of time on my hands.
Title: Re: [XP] Item Storage
Post by: zottel89 on June 02, 2012, 11:40:11 am
Quote from: game_guy on June 02, 2012, 11:37:06 am
I'll try to get to it sometime soon. Finally out of school so I've got a lot of time on my hands.


Yey, really glad to hear that :)
Thank you so much ^^
Title: Re: [XP] Item Storage
Post by: G_G on June 02, 2012, 11:33:13 pm
I found a bit of time to do it tonight, updated to 1.4. I look through this code and I just wanna revamp it so much. It's so messy. >.< Anyways, you can now mark Items, Weapons, and Armors with a "Key Item" element to prevent specific items from being stored.
Title: Re: [XP] Item Storage
Post by: diagostimo on June 03, 2012, 06:40:33 am
hey game guy, i was just wondering if you had the time to look into the RMX-OS issue? i have resurected the old project i had the issue in but would really like to have this script apart of the online system as lets face it every mmo needs a banking system, so i have stripped the project down to just this and rmx-os, and the issue is still there, heres a screeny of the error that occurs:
Spoiler: ShowHide
(http://img507.imageshack.us/img507/6567/rmxoscontainerserror.png)


since i have little knowledge in scripting now i checked the rmx-os options, your script and the rmx-os add-on to save the data, and you where right it should work its all there in black and white, ill detail what happens abit more, so in the script i have 99 potions set-up in a container, when i log in and take lets say 10 of these, I quit out of the game the re-log in, when i re log in this is when the error pops up, then i log in again this time no error, if i check my bag and i obtained the potions, when i check the container they where never taken :/ any help is appreciated :)
Title: Re: [XP] Item Storage
Post by: G_G on June 03, 2012, 10:20:04 am
Have you tried using an updated version of the script? I did recently add a new feature, and about 2 months ago I did refactor it a bit. If the problem still persists, I'll look into it when I get back home. (Few more days)
Title: Re: [XP] Item Storage
Post by: Blizzard on June 03, 2012, 01:11:53 pm
I think this has something to do with not having a constructor that takes no arguments or the class not being properly defined for construction in the RMX-OS configuration.
Title: Re: [XP] Item Storage
Post by: G_G on June 03, 2012, 01:45:43 pm
Ah okay, that makes sense then. I added a default parameter in my Game_Chest class, hopefully that'll fix the issue, if not I'll peak at the configuration in RMX-OS again and see if I can solve it.
EDIT: Peaked at RMX_OS fixed it.
Title: Re: [XP] Item Storage
Post by: zottel89 on June 03, 2012, 01:49:29 pm
Thanks sooo much for adding this feature, game_guy :)

Unfortunately, I don't really get how this "Key Item" system works
yet...   but don't worry, it's either my stupidity or I'm overlooking something...

So the description says (line 60-65):

  #============================================================================
 # KeyItemId       = Element ID for non removable items.
 #                   Items/weapons/armors with marked with this element
 #                   cannot be removed.
 #============================================================================
 KeyItemId         = 17



Sooo... does that mean I have to insert the IDs (of the items I don't
want the player to be able to storage) at line 65 ?!
As in:

KeyItemId           =  17, 24, 39  (for example)

And if so, how do I know the difference between Item/Armor/Weapon ?!

As you can see, I'm being a total idiot, I guess ^^'
Please be forgiving :(

The item ID of my "diary" ingame is 37...  or "Item37", whatever ^^
How do I block it from being stored, now ?!

And also I'm getting line 498 and line 476 errors since I'm using the new version...
I don't really get why, I'm still just using "$scene = Scene_Chest.new(1)" and when I
try to store something in the chest, I get one of these errors (and I did not use a savegame) :(

Again, I feel like a jerk for asking so many questions >_<
Title: Re: [XP] Item Storage
Post by: Blizzard on June 03, 2012, 01:58:46 pm
@G_G: I have learned a few things about Ruby's meta model and internal structure while working on ARC. There is a "universal" fix for the problem by calling simply Class#allocate instead of Class#new, but Class#allocate doesn't call Object#initialize so that might cause other problems then. I'll probably use a begin-catch block, try to use Class#new and if it doesn't work, I'll use Class#allocate.
Title: Re: [XP] Item Storage
Post by: G_G on June 03, 2012, 04:26:03 pm
Quote from: zottel89 on June 03, 2012, 01:49:29 pm
Thanks sooo much for adding this feature, game_guy :)

Unfortunately, I don't really get how this "Key Item" system works
yet...   but don't worry, it's either my stupidity or I'm overlooking something...

So the description says (line 60-65):

  #============================================================================
  # KeyItemId       = Element ID for non removable items.
  #                   Items/weapons/armors with marked with this element
  #                   cannot be removed.
  #============================================================================
  KeyItemId         = 17



Sooo... does that mean I have to insert the IDs (of the items I don't
want the player to be able to storage) at line 65 ?!
As in:

KeyItemId           =  17, 24, 39  (for example)

And if so, how do I know the difference between Item/Armor/Weapon ?!

As you can see, I'm being a total idiot, I guess ^^'
Please be forgiving :(

The item ID of my "diary" ingame is 37...  or "Item37", whatever ^^
How do I block it from being stored, now ?!

And also I'm getting line 498 and line 476 errors since I'm using the new version...
I don't really get why, I'm still just using "$scene = Scene_Chest.new(1)" and when I
try to store something in the chest, I get one of these errors (and I did not use a savegame) :(

Again, I feel like a jerk for asking so many questions >_<


Under the "Systems" tab, you can control which elements are in your game. Create one, call it "Key Item", put that ID in the script configuration. Then for each item, weapon, armor, make sure the "Element Set" has the "Key Item" element checked.
Title: Re: [XP] Item Storage
Post by: zottel89 on June 03, 2012, 04:38:14 pm
Ah okay, I get it now :)
The only problem is ... I did that, but I'm still getting this error as soon as I want to store
something into the chest:

(http://www10.pic-upload.de/03.06.12/scp86sx8xfu.jpg)
Title: Re: [XP] Item Storage
Post by: Blizzard on June 03, 2012, 04:43:49 pm
Should be "include?".
Title: Re: [XP] Item Storage
Post by: zottel89 on June 03, 2012, 05:05:54 pm
Thanks, that seems to be fixed :)
Unfortunately, I get this one now (only when trying to store items, not when taking them out of the chest):

(http://www10.pic-upload.de/03.06.12/trhx756nr4h.jpg)

Tried to do the "?" thing again, but that didn't work.

I feel really bad because of asking one thing after another,
but I can't seem to figure these errors out...
Title: Re: [XP] Item Storage
Post by: Blizzard on June 03, 2012, 05:27:11 pm
This one might be happening because the save data got corrupted in the meantime. Try deleting the save files and using the script then.
Title: Re: [XP] Item Storage
Post by: zottel89 on June 03, 2012, 05:40:56 pm
Thanks, but seems like that didn't change anything.

I should say that I always started a New Game when editing
something in the script (I built in a simple choice option to skip the intro and the chest is on the first "real" map,
so that's no problem).

I just noticed that I also can't exit the chest without the game crashing....

It then gives me this one:

(http://www10.pic-upload.de/03.06.12/8tezeqnoifu9.jpg)


.... so....
basically the last 2 errors keep repeating themselves
and it doesn't matter which chest ID is being used in the script call
[$scene = Scene_Chest.new(1)], I tried 1 to 4 and it's always the same result:
The last 2 errors I posted :(

Hm, I'll keep trying to figure something out, but I'm pretty sure I'm still gonna
need help here >_<'


Also strange:   With version 1.3, it all worked perfectly fine oÔ
Title: Re: [XP] Item Storage
Post by: diagostimo on June 03, 2012, 06:46:31 pm
just tried the rmx-os fix and it worked a charm, thanks guys :)
Title: Re: [XP] Item Storage
Post by: G_G on June 03, 2012, 08:22:30 pm
Quote from: zottel89 on June 03, 2012, 05:40:56 pm
Thanks, but seems like that didn't change anything.

I should say that I always started a New Game when editing
something in the script (I built in a simple choice option to skip the intro and the chest is on the first "real" map,
so that's no problem).

I just noticed that I also can't exit the chest without the game crashing....

It then gives me this one:

(http://www10.pic-upload.de/03.06.12/8tezeqnoifu9.jpg)


.... so....
basically the last 2 errors keep repeating themselves
and it doesn't matter which chest ID is being used in the script call
[$scene = Scene_Chest.new(1)], I tried 1 to 4 and it's always the same result:
The last 2 errors I posted :(

Hm, I'll keep trying to figure something out, but I'm pretty sure I'm still gonna
need help here >_<'


Also strange:   With version 1.3, it all worked perfectly fine oÔ


I'll look into it tomorrow.

EDIT: Should be fine now, it was trying to call a method from an older version.
Title: Re: [XP] Item Storage
Post by: zottel89 on June 03, 2012, 08:37:17 pm
Okay, closing the Chest Window ("Exit") works just fine now,
but I still get the line 503 error:

Script 'ItemStorage' line 503: NoMethodError occured.

undefined method `item_amount´ for nil:NilClass


when I try to store something inside the chest.


Nonetheless I'm still very happy that you're working on this
and that you've made such a great script in the first place :)

No need to hurry, I guess =)
Title: Re: [XP] Item Storage
Post by: G_G on June 03, 2012, 09:11:57 pm
Ugh! I'm an idiot! >.< I left some more old code in there, it should be fixed now. Sorry about that.
Title: Re: [XP] Item Storage
Post by: zottel89 on June 04, 2012, 08:32:46 am
*yey*

Everything works perfectly now !!
Thank you so much, game_guy  :up:

Edit:
Just a little question/advice:

I don't know if it is possible, but it would be cool if the "Key items" would be grayed out in the "Storage-Window",
of course it's not necessary at all, just a little idea that came into my head. ^^
Title: Re: [XP] Item Storage
Post by: G_G on June 04, 2012, 03:32:01 pm
Alrighty, done. :3 Easy addition.
Title: Re: [XP] Item Storage
Post by: zottel89 on June 09, 2012, 12:33:16 pm
...have you ever considered changing your nickname to "awesome_guy" ?  :P
Title: Re: [XP] Item Storage
Post by: G_G on June 09, 2012, 04:06:48 pm
Actually, I've considered changing my name plenty of times. "game_guy" is too common. But the community doesn't know me as anything else so anything else wouldn't really work. I mean when you google "game_guy" the top three results are Chaos Project, but most everything after that isn't related to me at all.
Title: Re: [XP] Item Storage
Post by: zottel89 on June 18, 2012, 08:37:16 am
hey game_guy,

I didn't try out your new "updated" script the last time (when you added the "grayed out" ability for key items),
but it seems like there are some 'new' errors in the script, again.

When I try to store something, it gives me this
error:

(http://www7.pic-upload.de/18.06.12/i5eqauwuoh4r.jpg)

I didn't do further research, but I guess there could be some more
'new' errors inside.

Would you try it out and maybe fix those ?!

If you get this to work again, with the new "grayed out" key items, it would be the perfect Item Storage script :)
Title: Re: [XP] Item Storage
Post by: Landith on June 18, 2012, 08:49:36 am
Simple fix, change that line to
self.contents.font.color = normal_color


and change the line that says (should be 301)

self.font.color = disabled_color


to

self.contents.font.color = disabled_color
Title: Re: [XP] Item Storage
Post by: zottel89 on June 18, 2012, 09:26:54 am
Okay, thanks :)

Doesn't crash anymore, but ... the key items aren't grayed out :/
Title: Re: [XP] Item Storage
Post by: Landith on June 18, 2012, 11:00:27 am
It works for me.

The key items are only suppose to be greyed out when they are in the chest.

Are you sure you set up the elements correctly?
Title: Re: [XP] Item Storage
Post by: zottel89 on June 18, 2012, 10:14:47 pm
oh... hm .... that wasn't really what I thought of  :shy:

And yes, everything is setup correctly and I can't store the
key items in the chest, but they are not grayed out (in the "store" window).

My original suggestion was to gray out items that you want to store in the chest,
but which are "key items".

So that, for example in my game ( yeah, I'm a selfish bastard, sry :D ), you can't
store the "diary" in the chest, because you need to always have it in your inventory
and so it's grayed out in the "store" window.

Would be cool if it also worked this way...
but thanks for the explanation :)
Title: Re: [XP] Item Storage
Post by: KK20 on June 19, 2012, 01:11:43 am
For graying out the key items in your inventory. This bit of code actually exists already within the script itself (with a few edits)...however, it was only in class Window_Chest_Item and not class Window_Party_Item. (Did you mean to do that G_G?)
Spoiler: ShowHide
class Window_Party_Item < Window_Selectable
  def draw_item(index)
    item = @data[index]
if item.element_set.include?(GameGuy::KeyItemId)
  self.contents.font.color = disabled_color
else
  self.contents.font.color = normal_color
end
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    x = 4 + index % @column_max * (288 + 32)
    y = index / @column_max * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 216, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 224, y, 48, 32, number.to_s, 2)
  end
end

Quote from: Landith on June 18, 2012, 08:49:36 am
Spoiler: ShowHide
Simple fix, change that line to
self.contents.font.color = normal_color


and change the line that says (should be 301)

self.font.color = disabled_color


to

self.contents.font.color = disabled_color

Fix'd. Thanks for notifying it. lol my new mod powers!
Title: Re: [XP] Item Storage
Post by: G_G on June 19, 2012, 08:09:26 am
No, I meant to edit Party_Item class. I guess I wasn't paying too much attention. Like always, thanks for fixing it you guys.
Title: Re: [XP] Item Storage
Post by: zottel89 on June 19, 2012, 08:50:38 am
Okay, just to clarify, my suggestion wasn't to gray out the items in the actual player's INVENTORY (...  if you press "x" ingame and go to "Inventory")  :D
More like....     in the "Store" Window of the Storage-Script ("in the Chest").

I'm not sure if you guys mean the same thing I do, I'm just a little... confused right now  :shy:
Title: Re: [XP] Item Storage
Post by: Landith on June 19, 2012, 12:15:56 pm
That's why Game_guy created a new window called Party_Item because he didn't want to overwrite the original Item_Window. It won't grey it out in the menus, just when you go to store an item.
Title: Re: [XP] Item Storage
Post by: G_G on June 19, 2012, 12:43:38 pm
Quote from: zottel89 on June 19, 2012, 08:50:38 am
Okay, just to clarify, my suggestion wasn't to gray out the items in the actual player's INVENTORY (...  if you press "x" ingame and go to "Inventory")  :D
More like....     in the "Store" Window of the Storage-Script ("in the Chest").

I'm not sure if you guys mean the same thing I do, I'm just a little... confused right now  :shy:


By default, the game does that. And it's completely fixed now.
Title: Re: [XP] Item Storage
Post by: zottel89 on June 20, 2012, 04:05:40 am
Well, it didn't do it by default for me, that's for sure,
but it does it now, so...  thanks alot  :^_^':
Title: Re: [XP] Item Storage
Post by: QuentinWhite on July 15, 2012, 05:45:32 pm
Newest version crashes, when i try to open chest with armor in my inventory. This hapens even if there is piece of armor already inside the chest.

Spoiler: ShowHide

(https://dl.dropbox.com/u/55023255/Images/Error01.jpg)
Title: Re: [XP] Item Storage
Post by: G_G on July 15, 2012, 06:24:52 pm
Updated to 1.42. Fixed armor crash.
Title: Re: [XP] Item Storage
Post by: QuentinWhite on July 16, 2012, 11:45:12 am
Now i get error at line 301:
Spoiler: ShowHide

(https://dl.dropbox.com/u/55023255/Images/Error02.jpg)
Title: Re: [XP] Item Storage
Post by: G_G on July 16, 2012, 03:50:48 pm
Sorry, simple typo. Fixed. xD
Title: Re: [XP] Item Storage
Post by: QuentinWhite on July 17, 2012, 06:00:25 pm
You are pretty quick  :nod:

But i have another error. Now i can open chest if there is armor inside, but i get an error if i try to open chest with piece of armor in my inventory. This happens too, if i take any piece of armor from chest.


Spoiler: ShowHide

(https://dl.dropbox.com/u/55023255/Images/Error03.jpg)
Title: Re: [XP] Item Storage
Post by: G_G on July 17, 2012, 10:00:39 pm
UGH! I feel like an idiot. xP It should be fixed now. Hopefully no more errors.
Title: Re: [XP] Item Storage
Post by: zottel89 on September 16, 2012, 10:10:30 am
Quote from: QuentinWhite on July 17, 2012, 06:00:25 pm
You are pretty quick  :nod:

But i have another error. Now i can open chest if there is armor inside, but i get an error if i try to open chest with piece of armor in my inventory. This happens too, if i take any piece of armor from chest.


Spoiler: ShowHide

(https://dl.dropbox.com/u/55023255/Images/Error03.jpg)




I just read this and tried it out...

I'm getting this error, too.   Any idea on how to fix this? :(
Title: Re: [XP] Item Storage
Post by: KK20 on September 16, 2012, 01:40:48 pm
God RMXP does the stupidest stuff sometimes...why use element_set for items, weapons, and skills but not for armors (which use guard_element_set)?

Anyways, to be rebellious to RMXP's standards, throw this in anywhere.
class RPG::Armor
  def element_set
    return @guard_element_set
  end
end
Title: Re: [XP] Item Storage
Post by: zottel89 on September 16, 2012, 05:26:23 pm
Yeah that does sound pretty random  :haha:

Thank you so much (again), it all works fine now !
Title: Re: [XP] Item Storage
Post by: Xolitude on September 04, 2013, 04:09:51 am
I know this post is old, but I just found it..

and..

(http://gyazo.com/19e43139e3cfe049146a91314ec8fc0f.png)
Error.

#==============================================================================
# Game_System
#------------------------------------------------------------------------------
# Modded it so it makes it store every chest.
#==============================================================================
class Game_System
  alias gg_add_item_storage initialize
  def initialize
    @chests = []
    return gg_add_item_storage
  end
  def chests(n)
    if @chests[n] == nil < LINE 106
      @chests[n] = Game_Chest.new(GameGuy::ChestMaxItems)
      items = GameGuy.chest_items(n)
      for i in 0...items.size
        item = items[i][2]
        case item
        when 0
          @chests[n].add_item(items[i][0], items[i][1])
        when 1
          @chests[n].add_weapon(items[i][0], items[i][1])
        when 2
          @chests[n].add_armor(items[i][0], items[i][1])
        else
          @chests[n].add_item(items[i][0], items[i][1])
        end
      end
    end
    return @chests[n]
  end
end


Any help?
Title: Re: [XP] Item Storage
Post by: G_G on September 04, 2013, 06:36:12 am
Are you using the RMX-OS addon?
Title: Re: [XP] Item Storage
Post by: Xolitude on September 04, 2013, 08:03:51 am
Quote from: gameus on September 04, 2013, 06:36:12 am
Are you using the RMX-OS addon?


Yes I am
Title: Re: [XP] Item Storage
Post by: G_G on September 04, 2013, 10:30:35 am
I'll have to take a look at it sometime. I know at one point of time it worked, but since the update to RMX-OS 2.0, I haven't tested it out. I'll get back to you when I can.
Title: Re: [XP] Item Storage
Post by: Xolitude on September 04, 2013, 03:26:16 pm
Quote from: gameus on September 04, 2013, 10:30:35 am
I'll have to take a look at it sometime. I know at one point of time it worked, but since the update to RMX-OS 2.0, I haven't tested it out. I'll get back to you when I can.


Yea it might've been the new update.

When ya get a chance, thanks :)
Title: Re: [XP] Item Storage
Post by: firevenge007 on September 24, 2013, 12:11:23 pm
Why is that when I'm using a new character, there is nothing wrong, but as soon as I use an already-loaded character, it crashes with this message "undefined method for '[]' for nilClass"
Title: Re: [XP] Item Storage
Post by: KK20 on September 24, 2013, 01:29:59 pm
For the exact same reason that I have clearly explained here (http://forum.chaos-project.com/index.php/topic,105.msg179024.html#msg179024).
Title: Re: [XP] Item Storage
Post by: LiTTleDRAgo on September 24, 2013, 01:38:08 pm
Spoiler: ShowHide
Quote
#==============================================================================
# Game_System
#------------------------------------------------------------------------------
# Modded it so it makes it store every chest.
#==============================================================================
class Game_System
 alias gg_add_item_storage initialize
 def initialize
   @chests = []
   return gg_add_item_storage
 end
 def chests(n)
   @chests ||= []   # <<< Add this line
   if @chests[n] == nil
     @chests[n] = Game_Chest.new(GameGuy::ChestMaxItems)
     items = GameGuy.chest_items(n)
     for i in 0...items.size
       item = items[i][2]
       case item
       when 0
         @chests[n].add_item(items[i][0], items[i][1])
       when 1
         @chests[n].add_weapon(items[i][0], items[i][1])
       when 2
         @chests[n].add_armor(items[i][0], items[i][1])
       else
         @chests[n].add_item(items[i][0], items[i][1])
       end
     end
   end
   return @chests[n]
 end
end
Title: Re: [XP] Item Storage
Post by: firevenge007 on September 24, 2013, 02:01:19 pm
Thanks so much for this fix.

Also, I was wondering if there was a way to speed up the rate of storing items into the chest when holding down a button.

Edit: Also, I found an error when I was trying to deposit armour.

It said, "Script ' ' line 517: NoMethodError occurred. Undefined method 'element_set' for # <RPG::Armor:0x28c3f60>"
Title: Re: [XP] Item Storage
Post by: LiTTleDRAgo on September 24, 2013, 02:47:11 pm
if that line is


      if @item.element_set.include?(GameGuy::KeyItemId)
        $game_system.se_play($data_system.buzzer_se)
        return
      end


change it into


      if @item.is_a?(RPG::Item) || @item.is_a?(RPG::Weapon)
        if @item.element_set.include?(GameGuy::KeyItemId)
          $game_system.se_play($data_system.buzzer_se)
          return
        end
      else
        if @item.guard_element_set.include?(GameGuy::KeyItemId)
          $game_system.se_play($data_system.buzzer_se)
          return
        end
      end
Title: Re: [XP] Item Storage
Post by: firevenge007 on September 24, 2013, 02:56:14 pm
It works perfectly now, thank you so much.

On top of that though, I was wondering if there was an area in the script that managed the rate of which you withdraw and deposit items?
Title: Re: [XP] Item Storage
Post by: Seltzer Cole on March 03, 2014, 12:52:55 am
The only issue I have with this script is that if you have 99 of an item and use the "store all"
chest = $game_system.chests(4)
chest.empty_all
then any of that same item you have in the chest gets deleted.

Example: You have 99 potions on you and 50 in the storage box. You choose to "Store All" and it works...except 50 of your potions got deleted.

When you manually store things it stops you from going over, but not storing everything in one go. It also deletes things when you "Take All" as well.

Other than that, awesome script.
Title: Re: [XP] Item Storage
Post by: G_G on March 03, 2014, 11:20:45 am
When I get back to my computer I'll try to fix it.

EDIT: I know I should still fix it, but editing this option in the config would at least solve the first half of your problem.

ChestMaxItems     = 9999
Title: Re: [XP] Item Storage
Post by: Orochimaru on August 15, 2014, 06:02:01 pm
Not sure if you still update this script or not, but I am having a problem with trying to adjust how many items a certain box can hold. I have tried the script command and it's not working, it worked fine in the outdated demo.
I would prefer to be able to use the newer one if possible as you added a lot of nice features to it.