Multiple Storage Containers

Multiple Storage Containers
FEATURES
Allows you to make any event a storage container and able to add or remove items from it with a script call. By default the containers are empty, but you can populate a container any time you choose with script calls.
A bit of a warning, I have no idea the limitations of storing data and would be interested to know if any issues arose from storing hundreds of items across hundreds of event containers.

DOWNLOAD:
Get it here >

Advertisements

32 thoughts on “Multiple Storage Containers

  1. Jake says:

    Is there any chance of this being made to work with Yanfly’s New Game + script? I really like using personal storage in the player’s home but when starting a new round, the items vanish.

  2. Galv says:

    Try adding this below both scripts. It will only let you keep one event’s storage, which you will put the event id and map id of the one you want in the first bit of the script.

    module DataManager
      
      STORE = [15,1]      # event_id, map_id
      
      class << self
        alias galv_storage_ngp_reset_party ngp_reset_party
      end
      def self.ngp_reset_party
        saved_container = $game_party.container[STORE]
        galv_storage_ngp_reset_party
        $game_party.container[STORE] = saved_container
      end
    end # DataManager
    
  3. Galv says:

    A new script section below the other two.

  4. momijisu says:

    Hey Galv, just tried to set up your script (1.4) on my copy of RPG Maker VX Ace and I keep getting this error message, pretty sure I’ve set up the rest of it right (Using the 1.3 version doesn’t give an error, but doesn’t let me use a container either). There are no other custom scripts running.

    Image of the error: https://lh6.googleusercontent.com/-dbcl3EYgidw/UUOrdN5o7rI/AAAAAAAAHCQ/lAAltNPVbYM/s574/MultipleItemsError.jpg

  5. Galv says:

    Make sure you put it below Materials and above Main. Make sure you start a new game after you install it and not load a save. Make sure you copy/pasted the entire code

    I can’t replicate the error – when exactly does it happen? Also if you still cant get it to work with the above, backup your project and start removing other scripts while testing to see if it’s a script conflict.

    • momijisu says:

      I tried re-copy and pasting the script in by manually highlighting it all, instead of ctrl+a’ing all the code, it works now =D Thanks!

  6. Moco says:

    Hi, I have a question about the script.

    In c_add, for example, guards at $game_temp.contents the ID of the event and map.

    Then check out the object type (weapon, item or armor) and save in @item the object. And finally, this:

    if $game_party.container[$game_temp.contents][@item]. nil?
    $game_party.container[$game_temp.contents][@item] = amount
    else
    $game_party.container[$game_temp.contents][@item] += amount
    end

    It saves the amount of that object.

    But I don’t understand this:

    $game_party.container[$game_temp.contents][@item]

    How work that expression?

    • Galv says:

      $game_party.container is list of all containers in your game.
      $game_temp.contents stores which map and event id of the container you are currently working with.
      $game_party.container[$game_temp.contents] is how to reference the currently container.
      $game_party.container[$game_temp.contents][@item] references an item within the current container being worked with.

      This is an old script of mine, I have plans to re-write it one day.

  7. Moco says:

    Thank you very much.

    But container is a hash, right? He saved in “attr_accessor :container” and initiate in the method “def init_containers”, with “@container = {}”

    I have seen many examples of hash and all are of the type:

    {1 => 2, 2 => 4, 3 ​​=> 6}

    And if I read 1, this return 2. If I read 2, this return 4. If I read 3, this return 6. Right?

    But I don’t know how is the hash you created. How can work with objects stored in the hash? For example, get them in an array, remove or introduce new objects. Because methods like “def take_all” in the class “Scene_Container” do wonder why, but I don’t understand what you do.

    And another question, so if when there is nothing in the container, I want to remove it, would I have to delete from $game_party.container?

    Thank you very much again.

    • Galv says:

      Maybe if you tell me what you are trying to do or what the problem is with the script, I can help.
      If you are using this to learn from – don’t… as I wrote this early on in my days of learning ruby and there are better ways to do it.

      • Moco says:

        I’m doing a custom inventory using grids, like in the game Diablo.

        I’m starting with this, but I studied IT and I know programming. The problem is the lack of documentation in the API of RGSS.

        I created the window with the grid and cursor movement. Also captures notetag of the objects. I was using your script to create containers of different grids to open events on the map. I need too each character has his inventory, but that’s another story.

        The idea is to store the items in a list or array, with their RPG::BaseItem notetag, because in those notetag are the height and width of the image, calculated to fit in the grid, and those coordinates I used to create a table.new with the same size as the grid container, and in that table.new be adding all objects in the list o array.

        I don’t know if I have explained well, english isn’t my first language.

  8. Galv says:

    Okay, well – I recommend asking for help in an rpgmaker forum or somewhere as this blog is just to post my scripts and if anyone has trouble with my script, I will try to help. But I won’t teach scripting here, sorry :)

  9. Moco says:

    Ok, but I want to ask you questions about the script, I used to understand and learn RGSS3.

    For example, at the end of method c_add write:

    p ($game_party.container[$game_temp.contents][@item.name])

    and console shows me nil. If I put:

    p ($game_party.container[$game_temp.contents][@item.price])

    The console shows me nil too.

    I’m testing adding an axe at the event:

    c_add (“weapon”, 1,1,0,0)

    It should show “axe” and price “100”.

    I do not want to bother you, if you think that the right is ask elsewhere I will.

    Thank you for your time.

    • Galv says:

      $game_party.container[$game_temp.contents][@item] actually returns the value of the hash. (the number of that item), not the item itself.
      @item is the key in the hash.

      $game_party.container[$game_temp.contents] will return a hash of all items in the container referenced.

      But as I said (and I don’t mean to be rude) – this was written a while ago when I was still learning ruby. Its not the best way to do it and therefore I do not recommend you learning from it.

      I think you should ask somewhere else for better implementation ideas as… like I said last post… I don’t want to teach you ruby in my blog comments… :(

      • Moco says:

        Okay, thank you very much for the help and sorry for the inconvenience.

        Your response raises new questions me, but I ask in the forum rpgmakervxace.net. :)

  10. Noir says:

    I can store the items but they wont show up when I go to remove them???

    • Galv says:

      There’s not much I can do to help with that info…
      Please read the instructions carefully and compare with the demo to make sure you set it up correctly.
      Also duplicate your project and then try removing other scripts you have that may conflict with it.

  11. Silencher says:

    This script is /awesome/. I just want to say that straight away. My only complaint, which is mainly because I saw your Item/Bank script is that there can’t be gold storage with this script.

    I think I have an eventing work around (basically have the player convert gold in units of 100, 1000, 10000, etc. into items (small bag of gold, medium bag, large bag, etc.). So they can store it that way, but is there anyway you could make it so it would allow for gold storage that are disconnected? Basically like morrowind chests/stumps, except the person can store gold. If not, no big deal. This is great, so are most of your others.

    • Galv says:

      If you have an eventing way, that’s awesome. I’m not currently doing requests or changes to my scripts as I am too busy, though, sorry

  12. Mike says:

    Hey Galv, this is amazing piece of work, but can I suggest something? Maybe note tags for items, like for example and then in storage you can decide which note tags can be stored? Would be cool for storages for foods only, etc.

  13. corora says:

    I’m having some problems and I have no idea how to fix it.
    My error message: http://gyazo.com/efcfbe71eb9d3689a3117fd100d43361
    My Event setup: http://gyazo.com/3792cf29440bfe73a82d28c05e23033f

  14. DG says:

    Hi Galv, there is a way to add a random item in the container? example: items between 1 and 10 ou armors between 3 and 27

  15. Kev says:

    Hi Galv, this script is fantastic! I love it so much and absolutely don’t want to remove it from my game, but I also really want to add a different item capacity to the game. Yanfly’s Adjust does exactly that, but the two scripts don’t work together, this problem also occurs with your Item/Bank Storage script.

    Script ‘$YanFly. Capacity’ line 521: NoMethodError occured.
    undefined method ‘max_limit’ for nil:NilClass

    Is there any way this can be fixed?

    • Galv says:

      Unfortunately I do not have time to look into make those two plugins compatible

      • Kev says:

        Alright then, thanks anyways, I’ll try to look around for a solution and post it here if I find anything useful for those who have the same issue.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s