For those still searching in the future. I figured a solution. Not sure about why it's still a problem biut found a workaround that works. This allows items to add conditional branch just off of being in the inventory. It isn't complete but it works for what I needed it for.
casper-gaming.itch.io
This is also a valid option as well.
forums.rpgmakerweb.com
Thank you @AquaEcho
Thank you @Trihan
Little Backstory,
I was wondering if someone would be able to assist me in debugging why this function is not working? I'm not a master programmer and alot of this is written with ChatGPT's help on some things. My goal of this is that it will display the names of the seeds that are currently in your inventory and when selected perform the common event that the constant assigned to them.
Current Problem,
- Does not display any of the choices ingame. Just a blank menu I can exit out of.
How I call this is with a script in an event by just calling the function
[CGMZ] Conditional Choices for RPG Maker MZ by Casper Gaming
Add conditions to choices in the choice window
casper-gaming.itch.io
This is also a valid option as well.
Caethyril's MZ Plugins
@Seedspreaderent - Cae_SelectItemFilter filters which items are displayed in the Select Item event command. The plugin command just configures the filter: use it, then use Select Item. Also, the plugin only supports reducing the number of items normally available for selection: you can't use it...
forums.rpgmakerweb.com
Thank you @Trihan
Little Backstory,
I was wondering if someone would be able to assist me in debugging why this function is not working? I'm not a master programmer and alot of this is written with ChatGPT's help on some things. My goal of this is that it will display the names of the seeds that are currently in your inventory and when selected perform the common event that the constant assigned to them.
Current Problem,
- Does not display any of the choices ingame. Just a blank menu I can exit out of.
How I call this is with a script in an event by just calling the function
Code:
function checkSeedAvailability() {
const seedCommonEvents = [
{ name: "Carrot Seeds", eventId: 125 },
{ name: "Corn Kernals", eventId: 123 },
{ name: "Potato Sprouts", eventId: 122 },
{ name: "Cabbage Seeds", eventId: 124 },
{ name: "Radish Seeds", eventId: 126 },
{ name: "Onion Seeds", eventId: 127 },
{ name: "Strawberry Seed", eventId: 128 },
{ name: "Pumpkin Seeds", eventId: 129 },
{ name: "Bean Seeds", eventId: 130 },
{ name: "Cashew Seeds", eventId: 131 },
{ name: "Tomato Seeds", eventId: 132 },
{ name: "Wheat Seeds", eventId: 133 },
{ name: "Zuchinni Seeds", eventId: 134 },
{ name: "Lettuce Seeds", eventId: 135 },
{ name: "Blueberry Seeds", eventId: 136 },
{ name: "Broccoli Seeds", eventId: 137 },
];
const isEquippedWithSeedBag = $gameParty.leader().equips().some(function (equip) {
return equip && equip.meta.SeedBag === 'true';
});
if (isEquippedWithSeedBag) {
const availableSeeds = $dataItems.filter(function (item) {
return item && $gameParty.numItems(item) > 0;
});
const seedChoices = availableSeeds.map(function (seed) {
return seed.name;
});
if (seedChoices.length > 0) {
$gameMessage.setChoices(seedChoices, 0, -2, 0);
$gameMessage.setChoiceCallback(function (choiceIndex) {
if (choiceIndex === -2) {
$gameTemp.reserveCommonEvent(20);
return;
}
const selectedSeed = availableSeeds[choiceIndex];
const selectedSeedName = selectedSeed.name;
const selectedEventId = seedCommonEvents.find(seed => seed.name === selectedSeedName)?.eventId;
if (selectedEventId) {
$gameTemp.reserveCommonEvent(selectedEventId);
} else {
$gameMessage.add(`You planted ${selectedSeedName}!`);
}
const selectedSeedId = selectedSeed.id;
$gameParty.gainItem($dataItems[selectedSeedId], -1);
});
} else {
$gameMessage.add("You don't have any seeds.");
}
} else {
$gameMessage.add("You need to equip a Seed Bag weapon to plant seeds.");
}
}