Conditional Local Switch

Is it possible to use a local switch to do a conditional event? Example: "If the Switch of X event is B, something happens.
Yes.
Is it possible to use a local switch to do a conditional event? Example: "If the Switch of X event is B, something happens.
Something like

Code:
if ($gameSelfSwitches.value([mapId, eventId, switchId])) {
do stuff
}

So for event 1 on map 1 and self switch "B" it would be $gameSelfSwitches.value([1, 1, "B"]);
THANK YOU DUDE
I will send a key when i finish my game
Something like

Code:
if ($gameSelfSwitches.value([mapId, eventId, switchId])) {
do stuff
}

So for event 1 on map 1 and self switch "B" it would be $gameSelfSwitches.value([1, 1, "B"]);
Thank you bro
i love you too
Tip: When the Event is on your current Map, you can shortcut:

Code:
$gameSelfSwitches.value([$gameMap.mapId(), eventId, 'B'])
Tip: When the Event is on your current Map, you can shortcut:

Code:
$gameSelfSwitches.value([$gameMap.mapId(), eventId, 'B'])
So, if I am thinking about this correctly, the shortcut is nice if you want to do something like this in a Common Event that might be called from multiple maps and you wouldn’t have to account for each map possibility in the CE as a long as on each map, you kept the Event number and Self Switch being used the same?

If that is true, I will definitely have to remember this as an option.

Thanks!
So, if I am thinking about this correctly, the shortcut is nice if you want to do something like this in a Common Event that might be called from multiple maps and you wouldn’t have to account for each map possibility in the CE as a long as on each map, you kept the Event number and Self Switch being used the same?

If that is true, I will definitely have to remember this as an option.

Thanks!
That is correct. Internally, self switches are just an array where the key is an array instead of a single ID number; it's not that they're intrinscally tied to the event, they just happen to reference the event and map in the key. As long as you keep the event ID and letter consistent, you can use the same code for multiple maps.

Original thread: https://forums.rpgmakerweb.com/threads/conditional-local-switch.154342/