Plugin that changes drops from entire troop encounter based on enemy drops.

I'm using yanfly's victory aftermath plugin, and on the battle spoils screen I need a plugin that changes the loot based on all the loot there, such as for every 2 of item #3, instead give 1 of item #2 (so 7 of item 3 would give 3 of item 2 and only 1 of item 3) I would like this plugin to be able to handle multiple different items too and be able to apply to every troop encounter.
it might be possible with this plugin "YEP_ExtraEnemyDrops".
you just create a var and the drops you want drop.
so you can make a random 1-7 and the amount of items
so you can get 7 the same, or 7 different items.

I dont know lunatic code exacly, but someone can help you with it.
So if I understand it... you want a custom enemy drop. YEP_ExtraEnemyDrops can do that, but it's a paid plugin. And sadly, this only works on a single enemy's drops, not a troop's.
This is made even more complicated by the fact it's implied the enemy can drop an indefinite quantity of items 2 and 3. I actually have no idea if this is even possible to do what you wanted. The best I can think of a functional solution is the following:
  1. Think of the drop rate of item 3. For the sake of simplicity, I'll go for 50%.
  2. The probability of dropping two instances of item 3 is 50% * 50% = 25%. This would be the probability of dropping a single instance of item 2.
You can have Item 3 as a 50% (1/2 chance) drop and Item 2 as a 25% (1/4 chance) drop without plugins, but if you wanted multiple of each, hoo boy.
For what I know, the <Conditional Item x Drop> tag only works on a single instance of an item, so expect a lot of copypasting. Let's say you can have a maximum of 7 instances of item 3.

For item 3, copy the following seven times:
Code:
<Conditional Item 3 Drop>
  // Calculate the chance of getting the item
  var chance = 0.5;
  // Check RNG if it passed
  if (Math.random() < chance) {
    // You got item 3
    $gameVariables.value(3) += 1;
  }
  // Check if Variable 3 is an odd number
  if (($gameVariables.value(3) % 2) !== 0) {
    // Finally, you got an Item 3
    Always: +50%
  }
</Conditional Item 3 Drop>
For item 2, copy the following three times:
Code:
<Conditional Item 2 Drop>
  // Check if Variable 3 is an even number
  if (($gameVariables.value(3) % 2) == 0) {
    // You got an Item 2
    Always: +25%
  }
  // Lower Variable 3 by two
  $gameVariables.value(3) -= 2;
</Conditional Item 3 Drop>
This also requires you to reset Variable 3 at value zero after getting the items somehow.

I have no idea if any of this works. This is perhaps the most challenging thing I tried to do with JS and I won't be surprised if there's a better way to do all of this.
there is an old extension that lets you drop more than one, though. http://stitchgaming.com/2016/03/nemv-quantities-yep-extra-enemy-drops-extension/
and this one by srd, not sure if it works perfectly with the one abovebut it is there.

Original thread: https://forums.rpgmakerweb.com/threads/plugin-that-changes-drops-from-entire-troop-encounter-based-on-enemy-drops.120321/