You should post your event page/script call so we can see what you're doing.
I checked my code in MV, and when no self switches for an event are turned on, countTrue is 0. If 2 self-switches are turned on, countTrue is 2, etc.
So if you want to see if at least one self-switch is on, use if (countTrue > 0), or you can use if (countTrue !== 0) to see if countTrue is NOT zero.
If this is not what you want, you may have to clarify further.
◆If:Script:var eventId = $gameMap.eventIdXy($gameVariables.value(X),$gameVariables.value(Y)); var mapId = $gameMap.mapId(); var switchIds = ['A']; var countTrue = 0; for (var i = 0, n = switchIds.length; i < n; i++) { var key = [mapId, eventId, switchIds]; var value = $gameSelfSwitches.value(key); countTrue += value ? 1 : 0;}
◆Text:None, Window, Bottom
: :switch A
◆
:End
◆If:Script:var eventId = $gameMap.eventIdXy($gameVariables.value(X),$gameVariables.value(Y)); var mapId = $gameMap.mapId(); var switchIds = ['B']; var countTrue = 0; for (var i = 0, n = switchIds.length; i < n; i++) { var key = [mapId, eventId, switchIds]; var value = $gameSelfSwitches.value(key); countTrue += value ? 1 : 0;}
◆Text:None, Window, Bottom
: :switch B
◆
:End
◆If:Script:var eventId = $gameMap.eventIdXy($gameVariables.value(X),$gameVariables.value(Y)); var mapId = $gameMap.mapId(); var switchIds = ['C']; var countTrue = 0; for (var i = 0, n = switchIds.length; i < n; i++) { var key = [mapId, eventId, switchIds]; var value = $gameSelfSwitches.value(key); countTrue += value ? 1 : 0;}
◆Text:None, Window, Bottom
: :switch C
◆
:End
◆If:Script:var eventId = $gameMap.eventIdXy($gameVariables.value(X),$gameVariables.value(Y)); var mapId = $gameMap.mapId(); var switchIds = ['D']; var countTrue = 0; for (var i = 0, n = switchIds.length; i < n; i++) { var key = [mapId, eventId, switchIds]; var value = $gameSelfSwitches.value(key); countTrue += value ? 1 : 0;}
◆Text:None, Window, Bottom
: :switch D
◆
:End
◆If:Script:var eventId = $gameMap.eventIdXy($gameVariables.value(X),$gameVariables.value(Y)); var mapId = $gameMap.mapId(); var switchIds = ['A', 'B', 'C', 'D']; var countTrue = 0; for (var i = 0, n = switchIds.length; i < n; i++) { var key = [mapId, eventId, switchIds]; var value = $gameSelfSwitches.value(key); countTrue === 0;}
◆Text:None, Window, Bottom
: :switch clear
◆
:End
I precise but all my events can only be have 1 self-switch (A,B,C or D) activate at once