Check if you talk to the essential NPCs before being able to move from other maps

What I would like to do is make check if a bunch of important NPCs have been talked to before being able to continue to move to other maps. Like let's say you have 5 NPC characters in town that you have to talk to and have your player character asking information (for quest progression). I don't know if a single switch would do the trick if I should do a Event where it's more with Variables. I worked on my game mostly only with Switches and Self-switch, because I don't really know variables.
Sounds like a job for variables, yeah. The "Leave the map" event is going to need a new event page, checked with "Variable: Name" "greater than or equal to 5".

each NPC you talk to will need a "Control variables" command selecting the same "Variable:Name"
Then clock the operation "Add" bubble to add 1.

so each NPC will add 1 to that variable, and the end event will make sure you've gotten 5

You'll have to make sure each NPC can't add infinite amounts of that variable.
Sounds like a job for variables, yeah. The "Leave the map" event is going to need a new event page, checked with "Variable: Name" "greater than or equal to 5".

each NPC you talk to will need a "Control variables" command selecting the same "Variable:Name"
Then clock the operation "Add" bubble to add 1.

so each NPC will add 1 to that variable, and the end event will make sure you've gotten 5

You'll have to make sure each NPC can't add infinite amounts of that variable.

Would putting a self-switch prevent the NPC from adding infinite amount of that variable?
Yes, it would.

So, for each NPC, you would do something like this:

Code:
If Self Switch A is OFF
 Turn Self Switch A ON
  +1 to NPCs Spoken To variable
End

Note, the variable will be 0 by default at the start of the game, so you don't have to set it to 0 anywhere. And if you have multiple areas where you want this to happen (with a different set of NPCs for each area), use a different variable for each area.
because I don't really know variables.
if you follow the link to the starting point in my signature, you'll find a lot of tutorials linked there.
One of those is a game called "variables guide", that should help you with the basics of variables.

Original thread: https://forums.rpgmakerweb.com/threads/check-if-you-talk-to-the-essential-npcs-before-being-able-to-move-from-other-maps.120753/