MZ Adding many items to the database mid-game.

Hello,

I am trying to figure out how to modify the items in the database during gameplay using an event. I have an event that mixes ingredients to create potions, allowing 4 ingredients to be mixed together many times. Im trying to figure out if there is a way to create the potion with buffs/debuffs given based upon the ingredients, without creating an item for every possible combination of such. Ive tried database inheritance, but there would still be way too many combinations. Ive thought about modifying the items.json midgame, but Im unsure how i would do that and if it would work. I have Visustella if that helps. Any help would be apprecited, thanks.
The way I would probably do it would be to create a new object like Game_Potion, a global $gamePotions property to store them, make that object get stored in save files, and then extend Game_Party's items function to append the items from that onto the end. That way it'll be like you're adding to the data without actually messing with the json. It's generally not a good idea to mess with the data files directly during play.

You'd probably need some functions/plugin commands for adding a created potion to inventory and stuff as well, but I have a picture in my head of the basic structure and it wouldn't take too much work.
The best way to approach this is with a plugin that adds support for "instanced" or independent items. This allows individual items to have unique and editable stats rather than the default system where all items inherit from a database entry

A quick search got me this. I don't know if it works for your purposes but it's here for you to judge on your own:
Im trying to figure out if there is a way to create the potion with buffs/debuffs given based upon the ingredients, without creating an item for every possible combination of such
nnnnnnnngggggghyyyyyyessssss?nnn't?ish?

you can materialize an object in run time, but it won't be added to the database.
it would exist in the player's inventory, but it will disappear when it's used.
if you go with that, you'd only need a base object, and an array of effects.
you can even empty the whole database and create everything on the fly if you really want it.
the database exists only to hold the original objects to make copies off of.
I figured out a way to do this after several days. Problem is it is very, very messy and results in some weird ascetic bugs.

JavaScript:
   if ($gameVariables.value(18) != 0) {
     item.effects[0].value1 = 5;
     item.effects[0].value2 = $gameVariables.value(18);

  } else {
     item.effects[0].value1 = 0;
     item.effects[0].value2 = 0;
};
  if ($gameVariables.value(19) != 0) {
     item.effects[1].value1 = 5;
     item.effects[1].value2 = $gameVariables.value(19);

  } else {
     item.effects[0].value1 = 0;
     item.effects[0].value2 = 0;
};
  if ($gameVariables.value(20) != 0) {
     item.effects[2].value1 = 5;
     item.effects[2].value2 = $gameVariables.value(20);

 
} else {
     item.effects[2].value1 = 0;
     item.effects[2].value2 = 0;
};
   $gameMessage.add(item.effects.dataId)

This works. I used placeholder effects to trick the game into thinking it was modifying existing ones since it doesnt seem like you can just add new ones. except now I cant figure out how to remove the effects all together so I ended up setting them to 0. Setting them to 0 works, except it
1. theyre always green even if something is a debuff.
2. The buff stills shows 0 turns remaining.
Note: These are placeholder icons so they the images dont mean anything.
1704451479929.png


1704451582026.png

Original thread: https://forums.rpgmakerweb.com/threads/adding-many-items-to-the-database-mid-game.164374/