waynee95's Storage System

Lu_

Villager
Member
Joined
Sep 26, 2019
Messages
25
Reaction score
11
First Language
German
Primarily Uses
RMMV
@waynee95
I want to creat a backpack and that you can only add items at the field and can only remove items when you are home.
I tried to use 2 systems and your scriptcall to move the items but it aint working
 

waynee95

Lunatic Coder
Veteran
Joined
Jul 2, 2016
Messages
645
Reaction score
542
First Language
German
Primarily Uses
RMMV
@Lu_
Then let's try to figure out why it's not working. Do you get an error or does it just not work?

Can you post the code you used and describe what you wanted to happen but what happened instead?
 

Lu_

Villager
Member
Joined
Sep 26, 2019
Messages
25
Reaction score
11
First Language
German
Primarily Uses
RMMV
@waynee95
I used this code you posted to move items:

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);
}
}

I replaced the ID's with my ID's. I wanted to move the items from on storage to another. I set them up the same way only the mode is different. I just want to move the items from the add mode storage to the remove mode storage and the other way around. But just nothing happens.
 

Lu_

Villager
Member
Joined
Sep 26, 2019
Messages
25
Reaction score
11
First Language
German
Primarily Uses
RMMV
@waynee95 we solved the problem. I used two scripts instead of one... ty
 

Selvalanch

Villager
Member
Joined
Jul 13, 2016
Messages
18
Reaction score
0
First Language
Thai , English
Primarily Uses
excuse me.
- is there a limit for how many storage i can create?
- can i track the data from what item i store in each storage. like get a name and icon from the first item stored in storage(0) ( i plan to have only one item for each storage.) if this avalible, how to do?
 

waynee95

Lunatic Coder
Veteran
Joined
Jul 2, 2016
Messages
645
Reaction score
542
First Language
German
Primarily Uses
RMMV
@Selvalanch
1.) You can create as many storage systems as you want.

2.) Yoiu can use this scriptcall
Code:
var item = $gameStorageSystems.storage(0).allItems()[0];
if (item) {
    var name = item.name;
    var iconIndex = item.iconIndex;
}
 

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
434
Reaction score
149
First Language
English
Primarily Uses
RMVXA
Hey,

If you have the chance, could you help me with a mechanic I'm hoping to create utilizing your plugin?

What I'm hoping to create is a Battle Bag, a separate inventory of 8 items that you would have access to in battle, instead of having access to all the items in your inventory.

I can already set up most of this, by having a storage system of 8 items that players can access from their menu, and now just need to figure out how to swap the inventories in battle. I'm guessing the easiest way to do this would be to, prior to battle, store all items in the player's inventory in a separate storage system, and then retrieve the items from the Battle Bag storage. Then after battle, put the remaining items back in the Battle Bag storage, and retrieve the items from the temporary inventory storage.

Is there a command that I can use to add all items to/from a storage?

Edit: Seems I must have deleted a paragraph in my original post, haha. :kaoblush:
 
Last edited:

waynee95

Lunatic Coder
Veteran
Joined
Jul 2, 2016
Messages
645
Reaction score
542
First Language
German
Primarily Uses
RMMV
@Vis_Mage
If you want to know how to move items from one storage to another, you can use this code posted here https://forums.rpgmakerweb.com/index.php?threads/waynee95s-storage-system.80181/page-9#post-1011953

EDIT: Ignore the mention of an issue regarding that code, it works. Just make sure to place all of the code inside ONE script event command.

Moving items from the party inventory to a storage system, use this

JavaScript:
$gameParty.allItems().forEach(function(item) {
    var amount = $gameParty.numItems(item);
    // Change 0 to the storage id of your choice
    $gameStorageSystems.storage(0).addItem(item, amount);
});

$gameParty.allItems().forEach(function(item) {
    var amount = $gameParty.numItems(item);
    $gameParty.loseItem(item, amount);
});
 

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
434
Reaction score
149
First Language
English
Primarily Uses
RMVXA
Thank you, the command you gave seems to be working perfectly!

I do have one more question to go along with this system though, is there a command that can take all items out of a storage, and put them back into the inventory?
 

waynee95

Lunatic Coder
Veteran
Joined
Jul 2, 2016
Messages
645
Reaction score
542
First Language
German
Primarily Uses
RMMV
@Vis_Mage
We can do that using some of the code we have already seen.

JavaScript:
// Change the 0 to the storage id of your choice
var storage = $gameStorageSystems.storage(0);

storage.allItems().forEach(function(item) {
    var amount = storage.numItems(item);
    $gameParty.gainItem(item, amount);
});

storage.allItems().forEach(function(item) {
    var amount = storage.numItems(item);
    storage.removeItem(item, amount);
});
 

Nacura

Veteran
Veteran
Joined
Feb 4, 2018
Messages
114
Reaction score
11
First Language
Español
Primarily Uses
RMMV
Hello friend, you know I want to increase the maximum storage and it gives me error, I have the maximum storage 20, I put 50 and it gives error, and now I put 0 and it gives me the same error.

I don't know if it will be the Script, but when I want to clean everything, or delete storage, I don't care about the error.

And thank you very much for continuing with this plugin. <32849b763b41a824d4d3b2215ffa63a85.png480de50e107ca3e40d0ba62297ce767a.pngbaa18be789f9321ec5d2cbe3eb1fad6a.png

Also the other mistake, is that I want to close the chest and it does not leave me, it is open.
 

Nacura

Veteran
Veteran
Joined
Feb 4, 2018
Messages
114
Reaction score
11
First Language
Español
Primarily Uses
RMMV
There I solve the error of increasing the maximum storage, now I will solve the other problems ajaj

Change Max Capacity:
Code:
$gameStorageSystems.storage(0).changeMaxCapacity(30)
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Well... it’s been a real pain in the IRS today. :/
My kitty still young (3-4 months), I think I could teach her some funny tricks... like: "Play dead-ly good music for my games"
Here's a quality DPS class idea: The Beekeeper, who uses the "Bees!!" skill to attack and poison enemies.
Please don't create long, boring cutscenes in which characters do nothing but stand around talking.
What if I took a lesson from Half Minute Hero? Let the player get dumb powerful each area, but reset them down to just slightly stronger than before for the next map?

Forum statistics

Threads
94,269
Messages
919,519
Members
123,990
Latest member
bartzfact0r
Top