Dragon Quest Mini Medals

I'm basically trying to set up a variable that +1 every time I get a certain item. When said variable is x≥, it will open up more options in a shop.

Basically I have 5 mini medals, so the shop will sell me a potion. I get 10 mini medals so the shop will sell me a potion and an antidote. ad inifinitum

I have to link this variable to a battle event, however; basically every time I beat a certain enemy, which is what is making it complicated. Sure if I just get the item outside of battle I can easily +1 the variable as I get it, but battle events are a bit more complicated. How can I +1 the variable each time I beat an enemy that also holds the item?
Is the enemy in question encounterable via random encounter or event. If the enemy is fought via an event you could just add a +1 in the event page after a successful defeat. But I'm sure there's a script call for what you need if its a random encounter although it might be simpler than that.
My problem is the random encounter, yes. I want to increase it through a random encounter
There's SRD_BattleEndEvents plugin by SumRndmDde that will play a common event at the end of a battle. You can place the Plugin Commands in the the troops window of random battles.

If you wanted to do it without plugins, there may be workarounds that fit your specific needs. For example, instead of modifying the variable after battle, do it at the shop.
Is it 100% necessary to be tracking the variable in real time per battle? As you can quite easily check how many medals you have each new time you interacted with the shop by way of the event 'Control Variable -> Game Data -> Item Possession Count

And then you could just set that variable every time you interacted with the shop so it updated it and then went through the relevant conditional branches. Otherwise if it is necessary to track it like that, I apologise!
Is it 100% necessary to be tracking the variable in real time per battle? As you can quite easily check how many medals you have each new time you interacted with the shop by way of the event 'Control Variable -> Game Data -> Item Possession Count

And then you could just set that variable every time you interacted with the shop so it updated it and then went through the relevant conditional branches. Otherwise if it is necessary to track it like that, I apologise!
no, your work around is actually much easier than what i was thinking. i didn't know there was that option in the control variables tab. thank you!
no, your work around is actually much easier than what i was thinking. i didn't know there was that option in the control variables tab. thank you!
Ahh, I'm glad to hear it then!

And I've been there, haha--overlooking some handy option that would make my life a whole lot easier.

Original thread: https://forums.rpgmakerweb.com/threads/dragon-quest-mini-medals.149731/