Shared Storage V 2.40

● ARCHIVED · READ-ONLY
Started by Engr. Adiktuzmiko 20 posts View original ↗
  1. ======================================================

    Overview

    ======================================================

    This script allows you to have shared storages

    where you can put/take items. The storage is accessible

    to all save files of your game or even another game as

    long as you set them to use the same storage file.

    You can modify most of the properties of each window

    involved in the scene, and also where to put the

    storage file.

    You could also set a different max item limit for the

    storage than that of the normal limit for the party

    inventory

    All window settings and limitations can now be set

    separately for each storage. Any storage opened

    that doesn't have it's own settings will use

    the default.

    Allows multiple storages in one file

    ======================================================

    Screenshots

    ======================================================

    From my under devevelopment game (isn't final: windowskin is an edit of the one Kuro Neko used, as shown on the next sub section of this post)

    Spoiler
    PN-Gunslinger007.PNG
    ======================================================

    Samples from RMWeb members

    ======================================================

    Kuro Neko (edited it to have icons)

    Spoiler
    storage_zps9ac446f9.jpg
    ======================================================

    Changelog

    ======================================================

    Version 1.10 - Added a custom window where you can show text that you want.

    Version 2.00 - Added capability to set the settings per storage instead of having

    just one global setting for all storages in the file.

    Version 2.10 - Selecting a blank item now sends a buzzer sound

    - Disables items from being selected if limit is already hit

    - Items on storage window is disabled when on deposit mode and vice versa

    Version 2.20 - You can now open multiple storages which can be switched via buttons

    Version 2.30 – You can now deposit/withdraw gold

    Version 2.40 - Fixed an error in which the script shows an error when you select a blank slot

    ======================================================

    Download

    ======================================================

    Get it here: http://lescripts.wordpress.com/rgss3/shared-storage-single-v1-00/

    ======================================================

    Add-Ons Download

    -> Put them below the original script if you use them

    ======================================================

    Total Item Limit v1.00

    http://pastebin.com/raw.php?i=jx5rRszs

    ======================================================

    Compatibility Fixes

    -> Put them below the original script if you use them

    ======================================================

    For those using Vlue's Randomization script, get this so that the items won't re-randomize when you start a new game

    USE AT YOUR OWN RISK. Once you place it and it's active, any database edits to your weapons and armors won't reflect. Only place the script right before you ship out the game.

    Spoiler
    module DataManager class << self; alias save_game_without_rescue_persist_adik save_game_without_rescue ; end def self.save_game_without_rescue(index) File.open("PersistItems.rvdata2", "wb") do |file| Marshal.dump($data_weapons, file) Marshal.dump($data_armors, file) end return save_game_without_rescue_persist_adik(index) end class << self; alias load_normal_database_persist_adik load_normal_database ; end def self.load_normal_database load_normal_database_persist_adik begin File.open("PersistItems.rvdata2", "rb") do |file| $data_weapons = Marshal.load(file) $data_armors = Marshal.load(file) end rescue end end endclass Scene_Load alias rig_on_load_success_adik on_load_success def on_load_success rig_on_load_success_adik begin File.open("PersistItems.rvdata2", "rb") do |file| $data_weapons = Marshal.load(file) $data_armors = Marshal.load(file) end rescue end endend
    For those using Yanfly's Adjust Limits

    Spoiler
    Code:
    class Game_Party < Game_Unit    def max_item_number(item)    item.nil? ?  return 0 : return item.max_limit  end  end # Game_Party
  2. nice i may use this in the future
  3. Nice. I do hope you find it useful. :)
  4. The storage is accessible
    to all save files of your game or even another game as
    long as you set them to use the same storage file. Cool script ^__^

    Congratulations for finishing this =)

    P.S : What potion is that "XD" (just joking)
  5. Hahahaha! It was on a test project, I just cannot think of a nice name since it was an experimental item (an item that I use for experiments) so I just named it XD


    PS: I believe that last time I've set that XD up, it was kind of a full heal or something.
  6. Could i make a limit for the shared item storage? Like, it can only contain a maximum of 999 item. If  the sum of items contain in storage reach 999, the player cannot deposit anymore.

    p/s: in my opinion, i think you could set that if the player tried to deposit/withdraw item, but there's no item to deposit/withdraw, if player press Z, it will make a buzzer instead of a deposit digit show up with 0.
  7. Nice script  :thumbsup-left:   :)
  8. Kuro Neko said:
    Could i make a limit for the shared item storage? Like, it can only contain a maximum of 999 item. If  the sum of items contain in storage reach 999, the player cannot deposit anymore.

    p/s: in my opinion, i think you could set that if the player tried to deposit/withdraw item, but there's no item to deposit/withdraw, if player press Z, it will make a buzzer instead of a deposit digit show up with 0.
    I haven't look at the script yet, but by reading this

    Engr. Adiktuzmiko said:
     You could also set a different max item limit for the

    storage than that of the normal limit for the party

    inventory
    I'm really sure you can set the max limit for the storage, and it should have a script call that let you change the max limit in the middle of the game, that's my guess at least =)
  9. @Kuro Neko and @Bolu


    - you can only set the max at the script set-up, but it takes a formula so you can make a formula that adjusts with your game.


    You can make it take the total number of items in the storage, but you would need to know the right formula for it. :)


    As for the sound, I'll think about it. Not a priority for the moment though, that's for sure. :)
  10. Engr. Adiktuzmiko said:
    @Kuro Neko and @Bolu

    - you can only set the max at the script set-up, but it takes a formula so you can make a formula that adjusts with your game.

    You can make it take the total number of items in the storage, but you would need to know the right formula for it. :)

    As for the sound, I'll think about it. Not a priority for the moment though, that's for sure. :)
    and if i want to make a window between Player Inventory and Storage text, which show a number of: stored/maximum storable. Then which formula should i use?
  11. To show the limit is another thing, you will need to make your own window and add it to the script in order to achieve that.


    I could possibly add a blank window for that which you can enable/disable and takes a formula in order to determine what to show. I'll take a look at that.
  12. so in simple I can do a "New Game + " 

    with that? 

    like I do the turn and I want to rebegin the game I can have extra stuff ?
  13. It's not really for a new game+ kind of stuff. It's simply a storage/s that is linked with your game/games instead of per specific save files.


    If you've played games like Torchlight I/II, you'd know what I mean. :)


    EDIT: Updated to version 1.10, added a custom window which you can use to show a custom text.
  14. If i want to show stored/storable in the custom text part, for example, the item max is 100. Then i will type 100 in MAX_ITEM_NUMBER, right? And in the CUSTOM_TEXT, which formula should i use?
  15. Kuro Neko said:
    If i want to show stored/storable in the custom text part, for example, the item max is 100. Then i will type 100 in MAX_ITEM_NUMBER, right? And in the CUSTOM_TEXT, which formula should i use?
    Putting 100 in there would make it such that it limits EACH Item to 100. not the total.

    To make the 100 as a total limit, you would need to do a bit of a formula. You would need to enumerate all keys, then select which keys belong to the current storage, then retrieve all the item numbers in those keys and sum them up. Then minus them from 100, as that would be the limit of what you can still store.

    I could possibly produce a sample, but that would probably be not until tomorrow.

    EDIT: Actually try this one:

    Spoiler
    module ADIK module SHARED_STORAGE ITEM_TOTAL_LIMIT = 100 endendclass Scene_SharedStorage def get_remaining_slots total = 0 $shared_storage.keys do |key| if key[0] == @storage_number total += $shared_storage[key] end end return ADIK::SHARED_STORAGE::ITEM_TOTAL_LIMIT - total end def get_item_limit item = get_item return $shared_storage[[@storage_number,item.class.to_s,item.id]] + get_remaining_slots end endThen on the MAX_ITEM_NUMBER, put "SceneManager.scene.get_item_limit"and on the custom text, "SceneManager.scene.get_remaining_slots"

    or

    "Available Storage Slots: + SceneManager.scene.get_remaining_slots.to_s"

    Not sure if this works though.

    PS: tell me if it works or not, if it works, I'll post it up on the OP as an add-on

    PS 2: Btw, I just realized that since the limit uses a formula, you could set it up in a way such that different storages have different limits with simple if-then-elses :)
  16. I'm curious, could you add a way to switch pages in that screen? I haven't played with it or anything yet so I don't know if you have that. But changing pages inside of that could be useful. Also the custom text in the middle, could you make it a tiny bit bigger, also is there a way for a user input? Such as naming it Armor, Crafting Mats. Etc Etc. Could be useful if someone has a huge open world crafting game. (Which I plan on doing).

    Just suggestions is all :p
  17. Engr. Adiktuzmiko said:
    Putting 100 in there would make it such that it limits EACH Item to 100. not the total.

    To make the 100 as a total limit, you would need to do a bit of a formula. You would need to enumerate all keys, then select which keys belong to the current storage, then retrieve all the item numbers in those keys and sum them up. Then minus them from 100, as that would be the limit of what you can still store.

    I could possibly produce a sample, but that would probably be not until tomorrow.

    EDIT: Actually try this one:

    Spoiler
    module ADIK module SHARED_STORAGE ITEM_TOTAL_LIMIT = 100 endendclass Scene_SharedStorage def get_remaining_slots total = 0 $shared_storage.keys do |key| if key[0] == @storage_number total += $shared_storage[key] end end return ADIK::SHARED_STORAGE::ITEM_TOTAL_LIMIT - total end def get_item_limit item = get_item return $shared_storage[[@storage_number,item.class.to_s,item.id]] + get_remaining_slots end endThen on the MAX_ITEM_NUMBER, put "SceneManager.scene.get_item_limit"and on the custom text, "SceneManager.scene.get_remaining_slots"

    or

    "Available Storage Slots: + SceneManager.scene.get_remaining_slots.to_s"

    Not sure if this works though.

    PS: tell me if it works or not, if it works, I'll post it up on the OP as an add-on

    PS 2: Btw, I just realized that since the limit uses a formula, you could set it up in a way such that different storages have different limits with simple if-then-elses :)
    I just got home and i've tested it. And i've done what you said. But, the game crash with this bug when i tried to store an item:



    this bug is in the shared storage script, not the add-on.
  18. @Bloodmorphed - The central text box and all other boxes/windows are configurable, so it's up to you to modify that. As for pages, no. And I don't plan on having them.

    @KuroNeko - which line was it when you open your script editor? Because line 935 on me was the if number > 0, so it's weird that it gives that error as there's no + in there.

    Edit: I think the problem was on the eval line, I forgot to add a safety factor to the added script that is possibly causing the + error (it shows the SS script since the line was run via eval)

    try this edited one:

    Spoiler
    Code:
    module ADIK  module SHARED_STORAGE    ITEM_TOTAL_LIMIT = 100  endendclass Scene_SharedStorage    def get_remaining_slots    total = 0    $shared_storage.keys do |key|      if key[0] == @storage_number        total += $shared_storage[key]      end    end    return ADIK::SHARED_STORAGE::ITEM_TOTAL_LIMIT - total  end    def get_item_limit    item = get_item    #because it would error if the item isn't yet on storage    begin      return $shared_storage[[@storage_number,item.class.to_s,item.id]] + get_remaining_slots    rescue      get_remaining_slots    end  end  end
    Or this one if you want the total limit count to be a formula too

    Code:
    module ADIK  module SHARED_STORAGE    #can be a formula too    ITEM_TOTAL_LIMIT = "100"  endendclass Scene_SharedStorage    def get_remaining_slots    total = 0    $shared_storage.keys do |key|      if key[0] == @storage_number        total += $shared_storage[key]      end    end    return eval(ADIK::SHARED_STORAGE::ITEM_TOTAL_LIMIT) - total  end    def get_item_limit    item = get_item    begin      return $shared_storage[[@storage_number,item.class.to_s,item.id]] + get_remaining_slots    rescue      get_remaining_slots    end  end  end
  19. dont you already have pages though using that script call...all thats needed is to go up or down through buttons on the menu
  20. The idea of having multiple storages was that ur gonna use each one in different events. Like a storage in a bank and a storage inside a house, so that they would have different items.


    But having two storages in the bank? I don't see the point of putting items in 2 different storages if you can switch between them as you wish anyways. Why? You want them to have different limits? What's the point if you can access them both in the same place anyway? Better just increase the limit of 1 storage than use 2 of them.


    If I'm a player, I would find that kind of set-up as weird coz you could have just increased the limit of 1 storage than making me need to swap storages via a single button while I'm on the storage menu just because of a certain limit.