How do you count npc's doing something?

So I know i've been asking a lot of questions recently, but I really want to know how to make my rpg maker mv game more than just an rpg maker game.


So pretty much my question is... I want to have a minigame in my game where you have to take out all the npcs in the building and once you take them all out, you win. Is there any way to do that?
When you take out a npc from the house, sum +1 to a variable. Make a second event page for the guy you have to talk with the condition that the variable x = the people you have to take out. Sorry for my english, and might this help you.
@Focusbit


I also suggest you follow the link "starting point" in my signature and work through the tutorials linked there - that will get you the basics as fast as possible.

Original thread: https://forums.rpgmakerweb.com/threads/how-do-you-count-npcs-doing-something.72971/