@waynee95 Thank you so much, will check it.
Edit: It works! Again, thank you very much for a script and for your kind help.
Edit: It works! Again, thank you very much for a script and for your kind help.
// 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);
// 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);
// 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);
});
}
Thank you so much!!! This mechanic is really important for my game, so this helps a ton! 😂
Scene_Menu.prototype.commandStorageSystem = function() {
SceneManager.push(Scene_Storage);
};
Scene_Menu.prototype.commandStorageSystem = function(storageId) {
$gameStorageSystems.open(storageId);
};
Original thread: https://forums.rpgmakerweb.com/threads/waynee95s-storage-system.80181/