MZ Bundle Donation Plugin akin to Stardew Valley

Did a bit of searching but was unable to find what I'm looking for. I hope to have a mechanic in my game similar to Stardew Valley's Community Center bundles where the player interacts the bundle places on the map, it brings up a UI where it shows what items are needed to complete the bundles (and how many of that item). The player can then add their items from their inventory to the bundle, leave it there, come back later in the game and add to it until they complete the bundle, then they usually unlock a reward.

I've attached a screenshot below of how Stardew Valley's looks. Bundle items needed are on the right, the player's inventory opens on the left. With how many plugins out there that draw inspiration from Stardew Valley and similar games, I wouldn't be surprised if there's something out there, but I haven't been able to find one yet so figured I'd ask here.

img2_qjzarv.jpg
Hi there!
This is very especific. Don't want to water you down but... things like that you will probably get when comission a plugin.

Although, in theory, you can replicate that with pictures. A lot of work, but can be done.

Or even, putting together some plugins and making a mix to achieve that result or a similar one.
Thank you for the advice!

I thought about giving it a try myself and seeing what I could pull off. I'm decent enough when I get into a flow and I sometimes surprise myself with what I end up figuring out. I've got somewhat of an idea of how I COULD do it, but no idea if I can actually pull it off.

Was just curious if someone knew of a plugin out there that already existed. I may look into commissioning one if I get to a point where I can't make it work myself and feel like I absolutely need it.

Thanks again, and I'm sure you've hear it all the time, but your plugins are fantastic. I use a few of them and they're so well done.
To put it in more general terms, this is a combination of an inventory grid plugin and a container plugin.

I've heard of both types of plugins/scripts being programmed, but I never followed them and can't even tell if what I vaguely remember was for VXA, MV or MZ.
But you might have some luck searching for the general terms instead of a specific description from a game.
Thank you for the advice!

I thought about giving it a try myself and seeing what I could pull off. I'm decent enough when I get into a flow and I sometimes surprise myself with what I end up figuring out. I've got somewhat of an idea of how I COULD do it, but no idea if I can actually pull it off.

Was just curious if someone knew of a plugin out there that already existed. I may look into commissioning one if I get to a point where I can't make it work myself and feel like I absolutely need it.

Thanks again, and I'm sure you've hear it all the time, but your plugins are fantastic. I use a few of them and they're so well done.
Thanks for the cumpliment! Glado you like them ^^

I think even if you didn't manage to pull this off, you for sure will learn a lot. But I also think that things like that, you learn as you go. Some trial and error are also part of the process. But if you master to manage pictures like that, you will be on another level.
Hmmm, copy paste the codes to make a scene with 3 windows. Use like modified window itemlist where you increase maxCols (and window size) and then make the itemRect the size of your icon. And then remove from draw code the item name and just use the icon and add it to draw the item quantity in smaller font. Then change the isEnabled method to depend on whether that item is required in the donation. And copy the stuff from shop windows where you select a number when selecting the item. And then when you choose it make it add to some variable. Then in window 2 draw stuff depending on what should be donated (change draw opacity depending on whether it was already donated). And in window 3 you draw what was donated depending on the earlier variable (maybe use it in the window _data).
I made it just for "fun". You can modify it how you want. I copy pasted quite a lot, so there might be something extra. And there might be errors, even though it seemed to work in my test box. Currently you set the boxes in that object at the start and then you use a game variable to store what you've put in the box. The variable for a certain box is the id you use for the box.

Then at game start make the variables an array and put there the item indexes for the box, like:
$gameVariables.setValue(10, []);
$gameVariables.value(10)[7] = 0;
$gameVariables.value(10)[8] = 0;

And then when you interact with the box:
$gameTemp._donateBoxId = 10;
SceneManager.push(Scene_Donate);

Spoiler
const donateBoxes = {
10:{7:5, 8:2}
}

function Scene_Donate() {
this.initialize(...arguments);
}

Scene_Donate.prototype = Object.create(Scene_MenuBase.prototype);
Scene_Donate.prototype.constructor = Scene_Donate;

Scene_Donate.prototype.initialize = function() {
Scene_MenuBase.prototype.initialize.call(this);
};

Scene_Donate.prototype.helpAreaHeight = function() {
return 0;
};

Scene_Donate.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
this.createBoxWindow();
this.createTargetWindow();
this.createDonateListWindow();
this.createNumberWindow();
};

Scene_Donate.prototype.start = function() {
Scene_MenuBase.prototype.start.call(this);
this._donateListWindow.refresh();
this._donateTargetWindow.refresh();
this._donateBoxWindow.refresh();
this._donateListWindow.select(0);
this._donateListWindow.activate();
};

Scene_Donate.prototype.createDonateListWindow = function() {
const rect = this.donateListWindowRect();
const donateListWindow = new Window_DonateList(rect);
this.addWindow(donateListWindow);
this._donateListWindow = donateListWindow;
this._donateListWindow.setHandler("ok", this.onItemOk.bind(this));
this._donateListWindow.setHandler("cancel", this.onItemCancel.bind(this));
};

Scene_Donate.prototype.createNumberWindow = function() {
const rect = this.numberWindowRect();
this._numberWindow = new Window_DonateListNumber(rect);
this._numberWindow.hide();
this._numberWindow.setHandler("ok", this.onNumberOk.bind(this));
this._numberWindow.setHandler("cancel", this.onNumberCancel.bind(this));
this.addWindow(this._numberWindow);
};

Scene_Donate.prototype.createBoxWindow = function() {
const rect = this.donateBoxWindowRect();
const boxWindow = new Window_DonateBox(rect);
this.addWindow(boxWindow);
this._donateBoxWindow = boxWindow;
};

Scene_Donate.prototype.createTargetWindow = function() {
const rect = this.donateTargetWindowRect();
const donateTargetWindow = new Window_DonateTarget(rect);
this.addWindow(donateTargetWindow);
this._donateTargetWindow = donateTargetWindow;
};

Scene_Donate.prototype.donateListWindowRect = function() {
return new Rectangle(0, 0, 600, Graphics.boxHeight);
};

Scene_Donate.prototype.numberWindowRect = function() {
const wx = 0;
const wy = Graphics.boxHeight/2;
const ww = 600;
const wh = 200;
return new Rectangle(wx, wy, ww, wh);
};

Scene_Donate.prototype.donateBoxWindowRect = function() {
return new Rectangle(600, 400, 300, 300);
};

Scene_Donate.prototype.donateTargetWindowRect = function() {
return new Rectangle(600, 0, 300, 300);
};

Scene_Donate.prototype.onItemOk = function() {
this._item = this._donateListWindow.item();
if(this._item){
if($gameParty.numItems(this._item) === 1) {
SoundManager.playShop();
this.doDonation(1);
this._donateListWindow.refresh();
this._donateTargetWindow.refresh();
this._donateBoxWindow.refresh();
this._donateListWindow.activate();
} else {
this._numberWindow.setup(this._item, this.maxSell(), 0);
this._numberWindow.show();
this._numberWindow.activate();
}
} else {
SoundManager.playBuzzer();
this._donateListWindow.activate();
}
};

Scene_Donate.prototype.onItemCancel = function() {
this.popScene();
};

Scene_Donate.prototype.onNumberOk = function() {
SoundManager.playShop();
this.doDonation(this._numberWindow.number());
this._numberWindow.hide();
this._donateListWindow.refresh();
this._donateTargetWindow.refresh();
this._donateBoxWindow.refresh();
this._donateListWindow.activate();
};

Scene_Donate.prototype.onNumberCancel = function() {
SoundManager.playCancel();
this._numberWindow.hide();
this._donateListWindow.activate();
};

Scene_Donate.prototype.doDonation = function(number) {
const item = this._donateListWindow.item();
$gameParty.loseItem(item, number);
this.donate(item, number);
this.checkAllDonated();
};

Scene_Donate.prototype.checkAllDonated = function() {
const boxContent = donateBoxes[$gameTemp._donateBoxId];
const arrayValues = Object.values(boxContent);
const varValue = $gameVariables.value($gameTemp._donateBoxId);
const varValuesFilter = varValue.filter(value => Number(value));
if (arrayValues.length === varValuesFilter.length &&
arrayValues.every((value, index) => value === varValuesFilter[index])) {
SoundManager.playRecovery();
}
};

Scene_Donate.prototype.maxSell = function() {
const boxContent = donateBoxes[$gameTemp._donateBoxId];
const varValue = $gameVariables.value($gameTemp._donateBoxId);
const target = boxContent[this._item.id];
const donated = varValue[this._item.id];
const number = target - donated;
return number;
};

Scene_Donate.prototype.donate = function(item, number) {
const id = $gameTemp._donateBoxId;
$gameVariables.value(id)[item.id] += number;
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////

function Window_DonateList() {
this.initialize(...arguments);
}

Window_DonateList.prototype = Object.create(Window_ItemList.prototype);
Window_DonateList.prototype.constructor = Window_DonateList;

Window_DonateList.prototype.initialize = function(rect) {
Window_ItemList.prototype.initialize.call(this, rect);
this._category = "none";
this._data = [];
};

Window_DonateList.prototype.setCategory = function(category) {
this.refresh();
this.scrollTo(0, 0);
};

Window_DonateList.prototype.maxCols = function() {
return 8;
};

Window_DonateList.prototype.isCurrentItemEnabled = function() {
const boxContent = donateBoxes[$gameTemp._donateBoxId];
const varValue = $gameVariables.value($gameTemp._donateBoxId);
if (this.item()) {
const target = boxContent[this.item().id];
const donated = varValue[this.item().id];
return donated < target;
} else {
return false
}
};

Window_DonateList.prototype.needsNumber = function() {
return true;
};

Window_DonateList.prototype.makeItemList = function() {
this._data = $gameParty.items();
};

Window_DonateList.prototype.itemRect = function(index) {
const maxCols = this.maxCols();
const itemWidth = this.itemWidth();
const itemHeight = this.itemHeight();
const colSpacing = this.colSpacing();
const rowSpacing = this.rowSpacing();
const col = index % maxCols;
const row = Math.floor(index / maxCols);
const x = col * itemWidth + colSpacing / 2 - this.scrollBaseX();
const y = row * itemHeight + rowSpacing / 2 - this.scrollBaseY();
const width = itemWidth - colSpacing;
const height = itemHeight - rowSpacing;
return new Rectangle(x, y, width, height);
};

Window_DonateList.prototype.drawItemBackground = function(index) {

};

Window_DonateList.prototype.drawItem = function(index) {
const item = this.itemAt(index);
if (item) {
const numberWidth = this.numberWidth();
const rect = this.itemLineRect(index);
this.changePaintOpacity(this.isEnabled(item));
this.drawItemName(item, rect.x, rect.y, rect.width - numberWidth);
this.contents.fontSize = 12;
if ($gameParty.numItems(item) > 1)
this.drawItemNumber(item, rect.x, rect.y + rect.height/3, rect.width);
this.resetFontSettings();
this.changePaintOpacity(1);
}
};

Window_DonateList.prototype.drawItemName = function(item, x, y, width) {
if (item) {
const iconY = y + (this.lineHeight() - ImageManager.iconHeight) / 2;
const textMargin = ImageManager.iconWidth + 4;
const itemWidth = Math.max(0, width - textMargin);
this.resetTextColor();
this.drawIcon(item.iconIndex, x, iconY);
}
};

Window_DonateList.prototype.drawItemNumber = function(item, x, y, width) {
this.drawText($gameParty.numItems(item), x, y, width, "right");
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////

function Window_DonateListNumber() {
this.initialize(...arguments);
}

Window_DonateListNumber.prototype = Object.create(Window_ShopNumber.prototype);
Window_DonateListNumber.prototype.constructor = Window_DonateListNumber;

Window_DonateListNumber.prototype.refresh = function() {
Window_Selectable.prototype.refresh.call(this);
this.drawItemBackground(0);
this.drawCurrentItemName();
this.drawMultiplicationSign();
this.drawNumber();
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////

function Window_DonateTarget() {
this.initialize(...arguments);
}

Window_DonateTarget.prototype = Object.create(Window_DonateList.prototype);
Window_DonateTarget.prototype.constructor = Window_DonateTarget;

Window_DonateTarget.prototype.initialize = function(rect) {
Window_DonateList.prototype.initialize.call(this, rect);
this._category = "none";
this._data = [];
};

Window_DonateTarget.prototype.maxCols = function() {
return 4;
};

Window_DonateTarget.prototype.isCurrentItemEnabled = function() {
return true;
};

Window_DonateTarget.prototype.makeItemList = function() {
const boxContent = donateBoxes[$gameTemp._donateBoxId];
this._data = Object.keys(boxContent).map(id => $dataItems[id]);
};

Window_DonateTarget.prototype.drawItem = function(index) {
const item = this.itemAt(index);
if (item) {
const numberWidth = this.numberWidth();
const rect = this.itemLineRect(index);
this.changePaintOpacity(this.isEnabled(item));
this.drawItemName(item, rect.x, rect.y, rect.width - numberWidth);
this.contents.fontSize = 12;
this.drawItemNumber(item, rect.x, rect.y + rect.height/3, rect.width);
this.resetFontSettings();
this.changePaintOpacity(1);
}
};

Window_DonateTarget.prototype.drawItemNumber = function(item, x, y, width) {
const boxContent = donateBoxes[$gameTemp._donateBoxId];
const number = boxContent[item.id];
this.drawText(number, x, y, width, "right");
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////

function Window_DonateBox() {
this.initialize(...arguments);
}

Window_DonateBox.prototype = Object.create(Window_DonateList.prototype);
Window_DonateBox.prototype.constructor = Window_DonateBox;

Window_DonateBox.prototype.initialize = function(rect) {
Window_DonateList.prototype.initialize.call(this, rect);
this._category = "none";
this._data = [];
};

Window_DonateBox.prototype.maxCols = function() {
return 4;
};

Window_DonateBox.prototype.makeItemList = function() {
const varValue = $gameVariables.value($gameTemp._donateBoxId);
for (let i = 0; i < varValue.length; i++) {
if (varValue[i] != undefined && varValue[i] > 0) {
if (!this._data.includes($dataItems[i]))
this._data.push($dataItems[i]);
}
}
};

Window_DonateBox.prototype.drawItem = function(index) {
const item = this.itemAt(index);
if (item) {
const numberWidth = this.numberWidth();
const rect = this.itemLineRect(index);
this.changePaintOpacity(this.isEnabled(item));
this.drawItemName(item, rect.x, rect.y, rect.width - numberWidth);
this.contents.fontSize = 12;
this.drawItemNumber(item, rect.x, rect.y + rect.height/3, rect.width);
this.resetFontSettings();
this.changePaintOpacity(1);
}
};

Window_DonateBox.prototype.drawItemNumber = function(item, x, y, width) {
const varValue = $gameVariables.value($gameTemp._donateBoxId);
const number = varValue[item.id];
this.drawText(number, x, y, width, "right");
};
You are a lifesaver!! That gives me a fantastic starting point to work from. I appreciate it. Are you okay if I use this in a plugin for a commercial game? I'll credit you of course.
Yeah sure you can use it. If you want to credit me just use my nick 'rpgLord69'

Just to be more clear, in the box object example the 10 is the box/variable id and the inner values are item id and required item number pairs. So you can add more boxes in there, just separate with comma.

And yeah, I just gave many windows fixed values, you need to change those match your game. Also, since I copied from the base code quite a lot some of the functions are named pretty funnily, like maxSell actually means what's the max you can donate in this case (compares what's needed and how much you already donated). Also, even though I added the isEnabled I didn't add icon opacity changes there. And since I realized that making the unit sizes exactly icon size wasn't as simple as just changing the itemRect and didn't have motivation to check everything needed, I just made them decent sized by setting the maxCols to match the window size I set. But yeah, you can edit all that.

Original thread: https://forums.rpgmakerweb.com/threads/bundle-donation-plugin-akin-to-stardew-valley.183504/