how to make an event only occur after collecting multiple different items?

i'm trying to make a game and one of the first quests just involves the main character collecting 5 seperate items before they leave their house. i have scripted the mechanic itself to work somewhat properly, but there's also a function to where you can't leave unless you collect said 5 items, but it still shows up even after i collect all the items. is it a problem with the variables or something : (
When you pick up an item, increment a variable by 1, then check if that variable is at least 5. If it is, turn on a switch. The event would have that switch as a trigger.
You can have each item also increment a variable and have the event happen after the variable is at 5.
either by variable or a selfswitch if the items are different.
temporarily variable is most ideal like AquaEcho said and most efficient way.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-an-event-only-occur-after-collecting-multiple-different-items.171191/