How to trigger an event after set number of random encounters?

So I want to have a part in my game that after the player gets 10 specific drops from random encounters the screen will immediately tint to sunset and a different bgm will play. Is there any easy way for me to set this up?

I know how to set up a screen tint event and get the background music to change (though I still need to look into how to keep the new bgm when going to other maps) but for now I just really want to solve my first question.

Thanks!
1.
Are the Monsters all on 1 Map or split up over several Maps?
2.
10 of 1 Item or up to 10 different Items?

I would guess using a parallel Event on that Map.
Eventcode:
Control VariableX set to Amount of Item in Inventory.
Conditional Branch: Is VariableX equal or more than 10?
if yes:
tint screen and turn off the event (turning on second empty eventpage does the job)
if no: Wait 60 Frames for example (1second = 60Frames)
I don't know enough about the battle components (my games haven't used them yet) so it's entirely possible this can be done as part of the troop event or with a plugin just after, but since I don't know that, I'll give you my hacky way:

I'd add a check on the load of a map (auto-run event, deletes itself right after) that checks the player's count of the particular whatever.

Conditional branch: If $gameParty.numItems($dataItems[XYZ]) >= 10....
* Where XYZ is the ID of the item in question.

Then if the answer is true, do the stuff to alter the player's world!
But than he needs to reenter the map before this effect takes place. it read like he wants it to happen after the battle when all 10 items are in inventory.
But your Scriptline to directly use in Eventcommand Conditional Branch, is very useful.
I did not knew it myself. Thanks for sharing.
Code:
$gameParty.numItems($dataItems[XYZ]) >= 10
1.
Are the Monsters all on 1 Map or split up over several Maps?
2.
10 of 1 Item or up to 10 different Items?

I would guess using a parallel Event on that Map.
Eventcode:
Control VariableX set to Amount of Item in Inventory.
Conditional Branch: Is VariableX equal or more than 10?
if yes:
tint screen and turn off the event (turning on second empty eventpage does the job)
if no: Wait 60 Frames for example (1second = 60Frames)

1. The area is a forest so it's spread over 2 maps
2. It's 10 of 1 item

I tested this contained to one map and it worked perfectly! If I just copy paste the event to the other map I assume it'll work in both? Or do I need to do something else/more

Thank you for the quick response!
If Bugs or Errors appear, let us know. Than we can further help adjusting it.
You are welcome.
Ok! Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-trigger-an-event-after-set-number-of-random-encounters.105719/