Converting Multiple Switches to one big Global Switch?

Hi all, I'm still pretty new to RMMV so this is probably a pretty obvious one.

I have a very small game on the go, where the objective is to complete a small selection of missions before you're allowed out of the main village to beat the main villain. You're not allowed out of the village until all the missions are done. However I predict that there are going to be 6 or 7 "mission completed" switches by the end, and I want to be able to activate some kind of "Well done, now let's go fight the villain" cutscene once they're all active. But I notice that there are only 2 slots available for Switch conditions in a single event.

I guess I could take each pair of Completed Mission switches, and combine them into one larger switch event, and so on, building layers of switches until I finally have enough to force one final Event to allow me to leave the area.

Is there an easier way than this? I've been trying to follow tutorials, but I'm a little lost.

Thanks in advance!
The simplest way is to create a variable that counts how many missions have been completed - whenever you turn one of the switches on, also increase that variable by 1. In the event condition, check if that variable is at least 6.
The simplest way is to create a variable that counts how many missions have been completed - whenever you turn one of the switches on, also increase that variable by 1. In the event condition, check if that variable is at least 6.
Awesome, I'll look into it! Thanks!
Mac's solution will work if you only need to know how many missions were completed. If you ever need to differentiate by *which* missions were completed, do the same thing but with multiples of 2 being assigned to each mission i.e. mission one is 1, two is 2, three is 4, four is 8, five is 16, six is 32, seven is 64, eight is 128. Add that much to your variable when the missions are completed, and then the value will tell you which ones were done. Like if the player's done missions two, three and six, the variable value will be 32 + 4 + 2 = 38.
Like if the player's done missions two, three and six, the variable value will be 32 + 4 + 2 = 38.
Honestly that's pretty genius. Need to add that one to my play book.
Now thats a cool application of binary
Definitely writing that one down
You can do quite a lot of fancy binary tricks like this.

With Trihan's variable, you can do $gameVariables.value(42) & 0b100 to check if specifically the 3rd mission was completed, regardless of if others are completed or not (it's always 1 followed by zeroes, with the total number of digits equal to the number of the mission you want to check).

And you can still check how many missions have been completed with $gameVariables.value(42).toString(2).match(/1/g).length.
Honestly that's pretty genius. Need to add that one to my play book.
Yeah, basically an integer usage of bitwise operators.
Mac's solution will work if you only need to know how many missions were completed. If you ever need to differentiate by *which* missions were completed, do the same thing but with multiples of 2 being assigned to each mission i.e. mission one is 1, two is 2, three is 4, four is 8, five is 16, six is 32, seven is 64, eight is 128. Add that much to your variable when the missions are completed, and then the value will tell you which ones were done. Like if the player's done missions two, three and six, the variable value will be 32 + 4 + 2 = 38.
This is brilliant, that's for posting that @Trihan, it's so clever, love it.
This is brilliant, that's for posting that @Trihan, it's so clever, love it.
I actually wrote a topic about this that nobody read. 😛 https://forums.rpgmakerweb.com/inde...to-store-many-flags-as-a-single-value.165338/
Because it sounds so complicated that I thought I wouldn't understand it, but thanks to you I did.
@Trihan I read it, and I appreciate you 😍

I just didn't have anything to contribute because it's old hat to me...that's how tons of stuff is tracked in MUD engines.

Original thread: https://forums.rpgmakerweb.com/threads/converting-multiple-switches-to-one-big-global-switch.166953/