If: multiple switch.

Like in the title, I want the event to happen if three switches are ON. I tried to do it by 'conditional branch ---> script
I copy this from other thread.


[991, 992, 993].every(x => $gameSwitches.value(x))

Should I change something in this code?
nope, should work like that.

only the ID's that must be true in the array.
nope, should work like that.

only the ID's that must be true in the array.
Unfortunately it's not working at all. Is there other way to check multiple switches?
Shouldn't it be forEach instead of every?
Shouldn't it be forEach instead of every?
Nope, still nothing
Well, there's still the old school method.
Code:
for (var i = 991;i<994;i++) {if (!$gameSwitches.value(i)) return false;}

return true;
Well, there's still the old school method.
Code:
for (var i = 991;i<994;i++) {if (!$gameSwitches.value(i)) return false;}

return true;
I'ts not working. It thinks the switch are ON even when ther're OFF
Greetings,

Do you need to do it by script? This can be done easily without any scripting, just make a conditional branch > if switch 1 is on, followed immediately by if switch 2 is on, then a if switch 3 is on, then the rest of your event code.

Happy game making,
-Niniann
Greetings,

Do you need to do it by script? This can be done easily without any scripting, just make a conditional branch > if switch 1 is on, followed immediately by if switch 2 is on, then a if switch 3 is on, then the rest of your event code.

Happy game making,
-Niniann
Sounds to easy. Well I edited my event so now it works. I just make 'cascade' of switches, one turning on another and end up with only one switch to check at the end. But I will keep in mind your idea.
$gameSwitches.value(991) && $gameSwitches.value(992) && $gameSwitches.value(993) && $gameSwitches.value(994)

this is the long version, that should work, but I have a function that checks it.
another better is Mac_ShortsHands as I believe it's MZ compatiable 😉

to do something like $gs[991] && $gs[992] etc

Original thread: https://forums.rpgmakerweb.com/threads/if-multiple-switch.171263/