fizzly

Veteran
Veteran
Joined
Mar 23, 2012
Messages
877
Reaction score
574
First Language
Polish
Primarily Uses
RMMV
@waynee95 Thank you so much, will check it.

Edit: It works! Again, thank you very much for a script and for your kind help.
 
Last edited:

Marianna

Queen of wolves
Member
Joined
Sep 2, 2018
Messages
12
Reaction score
5
First Language
Spanish
Primarily Uses
RMMV
Hi @ waynee95. Merry Christmas! I was reading that you are very busy, but let me ask you a question, please. I would like to be able to calculate the total value (the price) of all the objects that I have stored. My idea is similar to the Harvest Moon boxes, where you can put a lot of resources, and the next day it will be calculated and you will receive the money. There is some script to calculate the value of all the stored objects, store them in a variable and another script that allows me to remove all the stored objects then. I can do the money thing with commands and the variable. Is that possible with this plugin? Think you can help me? I would greatly appreciate it. It's something I've wanted to do for a long time. Thanks a lot!
 

waynee95

Inactive
Veteran
Joined
Jul 2, 2016
Messages
696
Reaction score
622
First Language
German
Primarily Uses
RMMV
@Marianna
JavaScript:
// Get all items from storage with ID 0
var storage = $gameStorageSystems.storage(0);
var items = storage.allItems();
var totalPrice = 0;
// Sum up all the prices of all items
items.forEach(function(item) {
    var itemCount = storage.numItems(item);
    totalPrice += item.price * itemCount;
    storage.removeItem(item, itemCount); // Remove items from storage
});
// Storage total price in variable with ID 1
$gameVariables.setValue(1, totalPrice);

After you run that scriptcall, you will have the sum of all prices of all items in a variable and all those items are removed. Change the specific IDs to your liking.
 

Marianna

Queen of wolves
Member
Joined
Sep 2, 2018
Messages
12
Reaction score
5
First Language
Spanish
Primarily Uses
RMMV
@Marianna
JavaScript:
// Get all items from storage with ID 0
var storage = $gameStorageSystems.storage(0);
var items = storage.allItems();
var totalPrice = 0;
// Sum up all the prices of all items
items.forEach(function(item) {
    var itemCount = storage.numItems(item);
    totalPrice += item.price * itemCount;
    storage.removeItem(item, itemCount); // Remove items from storage
});
// Storage total price in variable with ID 1
$gameVariables.setValue(1, totalPrice);

After you run that scriptcall, you will have the sum of all prices of all items in a variable and all those items are removed. Change the specific IDs to your liking.

Wow! Thank you very much, @waynee95! :D
 

zeroace074

(´∀`)
Member
Joined
Jun 4, 2020
Messages
13
Reaction score
12
First Language
English
Primarily Uses
RMMV
@waynee95 Loving the plugin so far! I'm having trouble trying to save all the contents of a storage system to a variable which I can use later on to restore the contents of the storage box. Basically, I'm using a plugin that syncs variables across all save files, so that you can save the items in storage system 1 on one file and then reload them on another file. How would I do this??
 

waynee95

Inactive
Veteran
Joined
Jul 2, 2016
Messages
696
Reaction score
622
First Language
German
Primarily Uses
RMMV
@zeroace074
Use this to store all item to a variable and remove the item from that storgae (if you don't want that, you can remove the line that removes the items.
JavaScript:
// Move all items form storage 0 to game variable 1
var storage = $gameStorageSystems.storage(0);
var items = [];
storage.allItems().forEach(function(item) {
    var amount = storage.numItems(item);
    storage.removeItem(item, amount);
    items.push({ item: item, amount: amount});
});
$gameVariables.setValue(1, items);

You can use this code to extract all items from such variable to a storage system.
JavaScript:
// Add all items stored in game variable 1 to storage 1
var items = $gameVariables.value(1);
if (items) {
    items.forEach(function(data) {
        $gameStorageSystems
          .storage(1)
          .addItem(data.item, data.amount);
    });
}

Change all IDs accordingly.
 

zeroace074

(´∀`)
Member
Joined
Jun 4, 2020
Messages
13
Reaction score
12
First Language
English
Primarily Uses
RMMV
@zeroace074
Use this to store all item to a variable and remove the item from that storgae (if you don't want that, you can remove the line that removes the items.
JavaScript:
// Move all items form storage 0 to game variable 1
var storage = $gameStorageSystems.storage(0);
var items = [];
storage.allItems().forEach(function(item) {
    var amount = storage.numItems(item);
    storage.removeItem(item, amount);
    items.push({ item: item, amount: amount});
});
$gameVariables.setValue(1, items);

You can use this code to extract all items from such variable to a storage system.
JavaScript:
// Add all items stored in game variable 1 to storage 1
var items = $gameVariables.value(1);
if (items) {
    items.forEach(function(data) {
        $gameStorageSystems
          .storage(1)
          .addItem(data.item, data.amount);
    });
}

Change all IDs accordingly.
Thank you so much!!! This mechanic is really important for my game, so this helps a ton! :kaojoy:
 

RK DracoRoy

Fire Emblem RPG Gamer
Veteran
Joined
Jun 29, 2017
Messages
318
Reaction score
104
First Language
English
Primarily Uses
RMMV
This is still a really great and useful plugin for things you want to manage here. I've managed to get the Storage System working with main menu commands with YEP_MainMenuManager. However, it'll only load the 1st Storage System from the plugin or the most recently used Storage in-game. But it's no problem.

This will work in a .js file by itself.
Code:
  Scene_Menu.prototype.commandStorageSystem = function() {
  SceneManager.push(Scene_Storage);
};

Inside YEP_MainMenuManager, you want to put in:

Name: "Storage" (or anything you want, it has to be in quotes)
Symbol: storageSystem
Show / Enable: Imported.WAY_StorageSystem
Main Bind: this.commandStorageSystem.bind(this)

@waynee95 I hope this is alright.
 

waynee95

Inactive
Veteran
Joined
Jul 2, 2016
Messages
696
Reaction score
622
First Language
German
Primarily Uses
RMMV
@RK DracoRoy

JavaScript:
Scene_Menu.prototype.commandStorageSystem = function(storageId) {
  $gameStorageSystems.open(storageId);
};

Name: "Storage" (or anything you want, it has to be in quotes)
Symbol: storageSystem
Show / Enable: Imported.WAY_StorageSystem
Main Bind: this.commandStorageSystem.bind(this, 42)

This should do the trick. Just replace "42" with any storageId you want.
 

Guardinthena

Artist
Veteran
Joined
Nov 30, 2013
Messages
471
Reaction score
1,183
First Language
English
Primarily Uses
RMMV
I think I'm going crazy, and I'm hoping for some clarification on this-- didn't this plugin use to have a function that allowed for the player to just loot everything in the storage chest with a button press rather than looting each item individually? I could have sworn that was available in an earlier feature, am I mistaken? If I am, and it never was a feature, could such a feature be added for player convenience?

Also, in regards to that, is it possible to add some text to the storage chest Help Window when it is first opened? For example, what I wanted was when the storage unit is opened, I was hoping that there could be a basic explanation in the Help window that explains to the player how to use the chest. I thought this would be a nice, friendly feature for those playing the game and unfamiliar with how to use the storage system. i.e. - Esc to exit/backtrack, arrow keys to select, Add to add items FROM player inventory to chest, Remove to remove from chest, use arrow keys to increase amount to be taken, rather than individually, etc.

And one last thing, sorry to pester, but I found an incompatibility with this plugin and Procraftynation's Weight Limit plugin. The issue is simply that Procraftynation's plugin does not appropriately calculate the weight of items removed from the storage chests in this plugin and add it to the total weight that will be displayed on the menu screen. It shows up as NIL, meaning there was an issue. (I'm honestly shocked I never realized the issue before!) Would it be possible to make a patch for his plugin? I tried contacting Procraftynation first, but have not received a response.

EDIT TO ADD:
I feel silly. I had an epiphany just now. I used VX ACE back in the day, and had used Galv's Multiple Storage Container script, which had the 'Loot All' function I was thinking of. So, I was confusing Galv's old VX Ace script with yours. Sorry about that! Still, it was a very nice feature and is that something that can be added to this plugin?
 

waynee95

Inactive
Veteran
Joined
Jul 2, 2016
Messages
696
Reaction score
622
First Language
German
Primarily Uses
RMMV
@Guardinthena
That compatibility could be added to the plugin but I have never used that plugin, so I have no idea how involved such addition might be.

Please provide me a small demo with both plugins and an example that shows the incompatibility and sent it to me via PM. Please use this stripped down project to build the demo https://www.dropbox.com/s/axz67ajrzxt605x/SuperSmallDemo_MV.zip?dl=0

But I cannot guarantee anything. I am currently only in "maintenance mode" for all my plugins, which means I only fix critical bugs since I am not actively doing RM things anymore. I will take a look on how fast I can add compatibility with this plugin.

As for the "loot all" button. Where would you like that button to be in the UI? (This should not take too long so I can add that for you)
 

Guardinthena

Artist
Veteran
Joined
Nov 30, 2013
Messages
471
Reaction score
1,183
First Language
English
Primarily Uses
RMMV
Thank you so much for such a speedy response, @waynee95. I'll get to work on making that demo and send it to you as soon as I can. I understand that nothing is guaranteed, I'm no coder myself but I understand that sometimes compatibility patches may not be possible. I do appreciate it that you are willing to take a look at it. Again, thank you so much.

As for the 'loot all' button, I had not even thought of it as a visible function on the UI. Just as a key on the keyboard that I'd hit absently to pick up everything and go. However, if I had to add it to the UI visually, I could not think of any other location other than next to the ADD/REMOVE window. So, LOOT ALL/ADD/REMOVE or ADD/REMOVE/LOOT ALL.
 

Guardinthena

Artist
Veteran
Joined
Nov 30, 2013
Messages
471
Reaction score
1,183
First Language
English
Primarily Uses
RMMV
Thank you so much for the Loot All update, Waynee95! It is working like a charm and makes looting all those items in the storage chests so much smoother!

In regards to the incompatibility to Dex Weight Limit plugin by Procraftynation --forget it. I feel so silly. I set up the plugins in the super small project you provided....and everything worked flawlessly. I was stunned, doublechecked my project and realized I had screwed up on the notetags on a few items for the weight plugin, which were in your chests, and it threw me off. Again, sorry for the mix up on that and I'm glad I found that out before I wasted more of your time with it.
 

waynee95

Inactive
Veteran
Joined
Jul 2, 2016
Messages
696
Reaction score
622
First Language
German
Primarily Uses
RMMV
@Guardinthena
No worries, I haven't started looking in the demo you provided anyways. Glad everything is working for you fine now! :D
 

RK DracoRoy

Fire Emblem RPG Gamer
Veteran
Joined
Jun 29, 2017
Messages
318
Reaction score
104
First Language
English
Primarily Uses
RMMV
This is a useful feature. The thing about the Loot All command is that the command is still greyed when you go to the "Add / Remove / Loot All" part after putting items in the Storage.

I was thinking as soon as I add a number of items in the storage, I could just stay in the menu and loot all, but I have to exit the Storage menu and go back to it and then it'll refresh by not greying out.
 

RK DracoRoy

Fire Emblem RPG Gamer
Veteran
Joined
Jun 29, 2017
Messages
318
Reaction score
104
First Language
English
Primarily Uses
RMMV
Yep! This definitely made the Loot All feature more convenient now.
 

RK DracoRoy

Fire Emblem RPG Gamer
Veteran
Joined
Jun 29, 2017
Messages
318
Reaction score
104
First Language
English
Primarily Uses
RMMV
I'm thinking the Loot All command should have a confirmation window as an option whether you want to toggle it on / off in the parameter option and customize the text for it. That's the only thing I got for it which would be of help. There might be a few instances where it'd be pressed by accident.
 

MikaTeapot

Veteran
Veteran
Joined
Mar 25, 2019
Messages
36
Reaction score
12
First Language
English
Primarily Uses
RMMV
Hello! Love the plugin, but one quick issue I'm having. If I use

<Max Item: 20> (Note tag for curative items, my plugin setting max for other items is 99)

From yanflys core, then in game I can have items from storage "disappear"

If I have say, 19 in my inventory, and 20 in storage, if I withdraw 20, I then have 0 in storage, and 20 in my inventory.

Did I miss something? Using 2.5.1 I saw this was supposed to be fixed, maybe just because the limit is set by note tag instead of solely the plugin settings?
 
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts

Thanks, google for putting together a random pixel art Olympics game in your logo that puts everything I've ever done to shame in pretty much every aspect. ;)
Chizuru
chizuru.png


anyway, i just recovered from Covid.
Work's been delayed for a month but now i'm back drawing again.
Ah yes i learned how to make name boxes Im now profeshonal
The snowy mountains in my game are finally done... what a crazy journey.
I participated in the official video event collection!

Forum statistics

Threads
113,610
Messages
1,076,204
Members
147,618
Latest member
Ohzaru
Top