waynee95's Storage System

abix123

Warper
Member
Joined
Jul 7, 2020
Messages
1
Reaction score
0
First Language
Español
Primarily Uses
RMMV
First of all, thanks for such a good plugin and forgive me for my English, I wanted to ask you if there is another possibility to change that related to "categories" by means of compatibility with any plugin other than the one provided by YEP, since the price of that plugin It is high for me and I consider it excessive, because I would only want that plugin and not the whole pack, thanks.
 

Galaxyglow

Villager
Member
Joined
Nov 26, 2015
Messages
16
Reaction score
6
First Language
English
Hey there,

This plugin is exactly what I was looking for! I've been using it for a while and love it, but I was wondering something.

I know you're really busy, but is there a way I could edit the plugin on my end to simply skip the final window where it asks how many of an item you would like to withdraw/deposit? In my game I'm using it as a closet and the player will only have one of each item so it's just an extra step.

If not that's totally OK!
Thanks. :D
 

Myers & Sparks

Veteran
Veteran
Joined
Jan 2, 2017
Messages
152
Reaction score
18
First Language
English
Primarily Uses
RMMV
@voooldo
This requires some JavaScript. To add all item from one storage to another, you can use this code inside a script call inside an event:
Code:
var srcId = 0; // source storage Id
var destId = 1; // target storage Id
var storage0 = $gameStorageSystems.storage(srcId);
var storage1 = $gameStorageSystems.storage(destId);
var allItems = storage0.allItems();

for (var i = 0; i < allItems.length; i++) {
  var currentItem = allItems[i];
  if (storage1.capacity() < storage1.maxCapacity()) {
    var restCapacity = Math.min(
      storage1.maxCapacity() - storage1.capacity(),
      storage0.numItems(currentItem)
    );
    storage1.addItem(currentItem, restCapacity);
    storage0.removeItem(currentItem, restCapacity);
  }
}
This will as many items from the storage with Id 0 to the target storage with Id 1.

The code for transfering all items from a storage to the player will look similar.

Code:
var srcId = 0; // sourcer storage Id
var storage = $gameStorageSystems.storage(0);
var allItems = storage.allItems();

for (var i = 0; i < allItems.length; i++) {
  var currentItem = allItems[i];
  var amount = storage.numItems(currentItem);

  $gameParty.gainItem(currentItem, amount);
  storage.removeItem(currentItem, amount);
}
This will move all items from storage with Id 0 to the player inventory. Although you have to incorporate a check from the plugin that you are using to limit the transfer of items. But you might wanna ask this in the thread of that plugin instead.
I tried to put this all in one script call but its too much to fit into one script call
 

Myers & Sparks

Veteran
Veteran
Joined
Jan 2, 2017
Messages
152
Reaction score
18
First Language
English
Primarily Uses
RMMV
@waynee95

Tried to squeeze it in there like this by placing al the variables on one line to fit everything else, still no luck. IDK how this is supposed to fit into one script call. Help please?


var srcId = 0; // source storage Id var destId = 1; // target storage Id var storage0 = $gameStorageSystems.storage(srcId); var storage1 = $gameStorageSystems.storage(destId); var allItems = storage0.allItems();

for (var i = 0; i < allItems.length; i++) {

var currentItem = allItems;

if (storage1.capacity() < storage1.maxCapacity()) {

var restCapacity = Math.min(

storage1.maxCapacity() - storage1.capacity(),

storage0.numItems(currentItem)

);

storage1.addItem(currentItem, restCapacity);

storage0.removeItem(currentItem, restCapacity);

}

}
 

Myers & Sparks

Veteran
Veteran
Joined
Jan 2, 2017
Messages
152
Reaction score
18
First Language
English
Primarily Uses
RMMV
Awesome plug in. More or less exactly what I needed! I do have a few requests if you are taking those @waynee96?
  1. Can we flip the Add / Remove? So the default is Remove instead? I have a loot manager NPC that gives out items, basically an alternative inventory. When the party enters a dungeon I clear their inventory and move it all to the "storage" NPC. So the default action in my case would be to Remove. Only adding if the player feels like it.
    1. Alternatively, and maybe more useful to everyone. If only Remove (or Add) is selected, skip the select Remove and just have it as a header? So the user opens the menu and is already selecting the first item? Like when you remove categories?
  2. Completely remove the max capacity? Like set it to 0 or 9999 in the plugin and then hide the window at the bottom in game? In my case it would not make sense for the storage to have a max.
Hopefully those are not major asks. I can dive into the JS and do it myself (I see its licensed MIT) if it is too much trouble.
from what ive seen that shouldnt be to hard given what is already available. I'd say set up a storage that is remove only. Have an event call a common event that you call "box" or whatever.

Right before it opens it (the storage) have it set a variable at random from 1-x however many you feel like making loot for. and from there have it add random loot with the built in method to add to the storage.

If you want to get extra fancy create multiple variables for more randomness.

Javascript isnt my strong suit but you may be able to throw an i++ in there somewhere to sort an array of the items to add at random based on the variables.
 

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
567
Reaction score
196
First Language
English
Primarily Uses
RMMV
Hey, bit of an odd question. A while back, I had asked for help setting up a couple commands for swapping the main inventory used in the overworld, for a "Battle Bag" inventory, using a script call right before battle. That's all still working, but I somehow just now noticed one little issue, the battle drops get added to the Battle Bag inventory before I can run the script call to swap inventories.

Is there a small edit I can make to the plugin to force all battle drops to end up in a pre-determined inventory (In my case, I'd send them to the currently unused inventory ID 2, and just merge that back into the main inventory after battle.)
 

waynee95

Inactive
Veteran
Joined
Jul 2, 2016
Messages
680
Reaction score
594
First Language
German
Primarily Uses
RMMV
@Myers & Sparks
Sorry for the late reply been really busy lately.

1.) I always hated that the script call box is way too small. So I cannot really change that fact. But it's only really limited in the number rows. So if something does not fit, move multiple lines of code into one line (so code flows to the right instead of to the bottom). It's not pretty but it works.

2.) As for you issue with the code not working. That's because the code is not correct. There's something missing in the line
Code:
var currentItem = allItems;
because it has to be like this
Code:
var currentItem = allItems[i];
So the script call should look like this and I also tested it. It works as expected on my end and it also fits inside the scriptcall box.

Code:
var srcId = 0; var destId = 1;
var storage0 = $gameStorageSystems.storage(srcId);
var storage1 = $gameStorageSystems.storage(destId);
var allItems = storage0.allItems();
for (var i = 0; i < allItems.length; i++) { var currentItem = allItems[i];
if (storage1.capacity() < storage1.maxCapacity()) {
var restCapacity = Math.min(storage1.maxCapacity() - storage1.capacity(),storage0.numItems(currentItem));
storage1.addItem(currentItem, restCapacity);
storage0.removeItem(currentItem, restCapacity);
}}
@Vis_Mage
Hmm... I would probably need a bit more information to help you. But one thing you could do is overriding the function that adds the battle drops to the party.

Take a look at the rpg_managers file, there you can find a function called gainDropItems. You could copy-paste that function into a new .js file in your /js/plugins directory and import it as a plugin and change it accordingly.

Code:
BattleManager.gainDropItems = function() {
    var items = this._rewards.items;
    items.forEach(function(item) {
        // Put battle drops into storage
        $gameStorageSystems.storage(0).addItem(item, 1);
    });
};
 

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
567
Reaction score
196
First Language
English
Primarily Uses
RMMV
Thank you for the advice, however after about 3 hours of trying to get it to work, I cannot for the life of me get it to work.

What I'm trying to set up is to have a "Battle Bag" storage, an 8 slot storage that you can put items into from the menu. Before battle, I put the main inventory into a TEMP storage, and add the Battle Bag storage to the now empty main inventory. Then, after battle, I move the current inventory back into the Battle Bag storage, and add everything from the TEMP storage back into the inventory.

Swapping the inventories actually works just fine. The issue I'm having is, no matter what I seem to try, I cannot for the life of me get battle drops to go to a specific storage. Changing the $gameStorageSystems.storage(0).addItem(item, 1); line to a different storage ID does indeed put the dropped items in that storage, but ALSO still puts them in the main inventory.

I'm guessing that I'm just overlooking something simple, but if you get the chance, I'd really appreciate if you could take a crack at it.
 
Last edited:

waynee95

Inactive
Veteran
Joined
Jul 2, 2016
Messages
680
Reaction score
594
First Language
German
Primarily Uses
RMMV
@Vis_Mage
I will sent you a PM with a link to a project that you can use to setup a demo project for me. Then I can help you out.
 

Myers & Sparks

Veteran
Veteran
Joined
Jan 2, 2017
Messages
152
Reaction score
18
First Language
English
Primarily Uses
RMMV
@Myers & Sparks
Sorry for the late reply been really busy lately.

1.) I always hated that the script call box is way too small. So I cannot really change that fact. But it's only really limited in the number rows. So if something does not fit, move multiple lines of code into one line (so code flows to the right instead of to the bottom). It's not pretty but it works.

2.) As for you issue with the code not working. That's because the code is not correct. There's something missing in the line
Code:
var currentItem = allItems;
because it has to be like this
Code:
var currentItem = allItems[i];
So the script call should look like this and I also tested it. It works as expected on my end and it also fits inside the scriptcall box.

Code:
var srcId = 0; var destId = 1;
var storage0 = $gameStorageSystems.storage(srcId);
var storage1 = $gameStorageSystems.storage(destId);
var allItems = storage0.allItems();
for (var i = 0; i < allItems.length; i++) { var currentItem = allItems[i];
if (storage1.capacity() < storage1.maxCapacity()) {
var restCapacity = Math.min(storage1.maxCapacity() - storage1.capacity(),storage0.numItems(currentItem));
storage1.addItem(currentItem, restCapacity);
storage0.removeItem(currentItem, restCapacity);
}}


worked like a charm. Thank you soo much
 

Guardinthena

Artist
Veteran
Joined
Nov 30, 2013
Messages
413
Reaction score
1,001
First Language
English
Primarily Uses
RMVXA
I just wanted to drop a little message saying that I found this plugin all the way back when it was version 1.6 (or so), and that I have loved it ever since. I just came back to see if there was an updated version and lo and behold, there is! Hahah! Well, updated, and I still love it. Two immediate things I noticed in the recent version is the background image that is allowed and that the items in the containers are now visible on the main inventory window when they weren't before. Immediate bonuses to this most current version that I love right away.

Thank you so much for supplying this plugin for the community. It is a jewel and works amazingly.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

People1.png & SF_People1.png added!!!!

Adventurer:
"Why your body looks like a bird?"

Stranger:
"Because I'm harpy"

Adventurer:
"Clap along if you feel like a room without a roof"

*Both dancing to Pharrell Williams song*
Stream will be live shortly with a make-up session of the Interactive Text Adventure! Feel free to drop by!
Pootscooter wrote on Pharonix's profile.
Hey @Pharonix, just wondering what you're up to lately and if you've had an opportunity to check out the LTBS thread in the past few days...(a couple of us could really use your expertise). Hope you are well and Happy Thanksgiving!
Anyone know the best size image to put in signature?

Forum statistics

Threads
105,501
Messages
1,014,243
Members
137,165
Latest member
keochauau
Top