MV/MZ SDJB_EventSelfSwitches

PluginName: SDJB_EventSelfSwitches
Author: ShadowDragon

Spoiler: How it works
Code:
 Introduction
 ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞
 This plugin adds unlimited self switches to events and allows
 them to be easily activated via script calls.

 You can name self switches however you want and activate them
 from a different map.

 Keep in mind that triggering a self switch from a different map
 will not work unless that map has been visited at least once.


 How to Use
 ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞
 Use the comment tag: <SelfSwitch: NameHere>

 "NameHere" is your switch name. This can be important if you use
 specific "phases", where only one should be ON at a time.

 You can also reset a group of switches for the current event,
 which is useful for repeatable quest events.

 IMPORTANT:
 Default self switches (A, B, C, D) can still be used normally.
 However, if a page uses <SelfSwitch: NameHere>, it is best to
 avoid using self switches (A, B, C, D) on that page and instead
 leave the Self Switch condition blank.

 When the Self Switch condition is blank and the comment tag is
 used, the page is treated as a named self switch activation page.


 Examples
 ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞
 setNamedSelfSwitch(name, value, mapId, eventId);

 mapId and eventId can be omitted when used on the current event.
 Valid values: "on", "off", "true", "false", true, false, "toggle"

 setNamedSelfSwitch("DoorOpen", "on");
 setNamedSelfSwitch("Phase2", "toggle");
 setNamedSelfSwitch("BossAwake", true, 12, 3);


 setExclusiveSelfSwitch(name, value);

 name  : the self switch name (treated as a group name)
 value : see valid values above

 setExclusiveSelfSwitch("Phase2", "on");

 The name "Phase2" will turn off "Phase1", "Phase3", etc.
 Other switch names are ignored.


 You can also turn off all self switches, either fully or partially:

 resetEventSelfSwitches(name, mapId, eventId);

 Fully reset all self switches for an event:

 resetEventSelfSwitches();         => Current event
 resetEventSelfSwitches("", 7, 3); => Explicit map and event

 Or partially, for repeatable quests or mini-games:

 resetEventSelfSwitches("Bonus");        => Turns off Bonus1, Bonus2, etc.
 resetEventSelfSwitches("Phase", 12, 3); => Only resets Phase1, Phase2, Phase3


=== TERMS OF USE ===
Free for Non-Commercial and Commercial use when credit is given.
credit one of the following:
ShadowDragon
ShadowDragonJB


=== WARNING ===
YOU ARE NOT ALLOWED TO:
* MODIFY without permission
* EXTEND without permission
* TAKE CODE without permission
* CLAIM AS YOU MADE IT
* REDISTRIBUTE but link back to the forum or itch.io
* SELL this product as standalone.
* DO NOT REMOVE THE HEADER.


(file is below as it require my base plugin (SDJB_Base or SDJB_BaseMZ (minified version))

Download from itch.io

Original thread: https://forums.rpgmakerweb.com/threads/sdjb_eventselfswitches.181827/