Monster drops variables?

So I want to set up a mechanic similar to the Earthbound Series for those familiar. Instead of monsters dropping money, you occasionally get paid based on the amount of monsters you've slain. I set up a variable for this, thinking I'd simply set up monsters to do an event upon dying... But I can't figure out how to do that! I'm using MZ. Really hoping this is just a "Duh" moment and someone can point me in the right direction. I could do what I'm wanting with items instead, but it would require me to rework a few events and it just wouldn't look as nice.
there are several ways to do that, depending on what exactly you want.

the easiest way is with evented battles, just activate the branches on win/on loose/on escape for the battleprocessing and have control variables there.

if you want it inside random battles, it requires a number of tricks and troop events

or you can have all enemies drop hidden items as markers and count them
I want it in random battles. I don't want to do items because I'd have to change my events, which are designed to detect variables. I'm looking at the troop events, but I'm not seeing a condition of winning the battle in order to run it. I suppose I could just run it and make fleeing impossible? That way no matter what they either win and get the credit or it's game over...
the troop events would run differently. you'll need one troop event on turn 0 that gives all enemies an immortal state (resist death state), then one troop event for each enemy to be conditioned on HP=0 that will count up the variable before removing the immortal state. Without the immortal state the battle would end on death of the last enemy before that enemy could be counted.

I don't want to do items because I'd have to change my events, which are designed to detect variables
what do you mean? That sentence makes no sense.

the only difference is a single control variable command that loads the inventory number of the hidden items from game data into the variable of your choice.
Moved to: MZ Support

You can only have an "on win" condition if your battles are evented.

For random battles, as long as you are not allowing the player to escape, just have a troop event that runs once at the start of battle, that increments the variable by the required number of enemies. Then, if you win, your variable will be up by the number of enemies defeated. If you lose, you'll get game over and will have to load a save file prior to the battle (and prior to the variable being incremented). Set the variable to 0 when you get the quest, if you don't want battles already won contributing to the count.

If you allow the player to escape, or you have some plugin that changes the game over on losing battle behaviour, then you're going to need a plugin to do what you want.

Original thread: https://forums.rpgmakerweb.com/threads/monster-drops-variables.137964/