Is it possible to reset the self-switches of a common event?

Hi all!

Is there a script call that might allow me to reset (or set) the self-switches of a specific common event?

I realize that even wanting to do this means that self-switches were not the way to go, but before I embark upon a multi-day process of redoing things, I'd love to know if there might be a way to do it this simpler way.

Thanks! :LZSgrin:
Common Events do not have Self Switches.

When a NON Parallel/Autorun Common Event is called by an Event with Eventcommand
Common Event, than all change Self Switch Commands in that Common Event will
actualy change the Self Switches of the Event that called the Common Event.

And yes it is possible to change Self Switches of other Events. I mean, if Event1 is running, it can change the Self Switches of all the other Events.
Common Events do not have Self Switches.

When a NON Parallel/Autorun Common Event is called by an Event with Eventcommand
Common Event, than all change Self Switch Commands in that Common Event will
actualy change the Self Switches of the Event that called the Common Event.

And yes it is possible to change Self Switches of other Events. I mean, if Event1 is running, it can change the Self Switches of all the other Events.

Hmm ... that makes a lot of sense. But what about parallel common events?

In my case, I have several parallel CE's that are triggered by switches. Now I'm curious as to how self-switches work in these sorts of CE's? Are they just sort of ignored?
Hmm ... that makes a lot of sense. But what about parallel common events?

In my case, I have several parallel CE's that are triggered by switches. Now I'm curious as to how self-switches work in these sorts of CE's? Are they just sort of ignored?
You mean if an event calls a parallel common event that sets a self switch? It would keep setting it over and over again as long as the parallel event is running. If the self switch is already in one position it just tells it to set it to that position again which has no visible effect but the command runs again nonetheless.
You mean if an event calls a parallel common event that sets a self switch? It would keep setting it over and over again as long as the parallel event is running. If the self switch is already in one position it just tells it to set it to that position again which has no visible effect but the command runs again nonetheless.

Hmm .. in my case, I have a CE that is parallel, and is triggered by a regular switch. Then, at the end of the CE, it turns that switch off, so it doesn't run again, it just runs once.

In this case, what actually is the function of setting a self-switch within that specific type of CE? Since it isn't called by an event, the self-switches can't apply to the event's self-switches.
Are they just sort of ignored?
Correct. The command will do nothing.

Here is what happens behind the scenes when a "Control Self Switch" event command is processed.
JavaScript:
// Control Self Switch
Game_Interpreter.prototype.command123 = function(params) {
    if (this._eventId > 0) {
        const key = [this._mapId, this._eventId, params[0]];
        $gameSelfSwitches.setValue(key, params[1] === 0);
    }
    return true;
};

The value of ._eventId for a parallel common event is 0, so it will skip over the code that sets the self switch.
Correct. The command will do nothing.

Here is what happens behind the scenes when a "Control Self Switch" event command is processed.
JavaScript:
// Control Self Switch
Game_Interpreter.prototype.command123 = function(params) {
    if (this._eventId > 0) {
        const key = [this._mapId, this._eventId, params[0]];
        $gameSelfSwitches.setValue(key, params[1] === 0);
    }
    return true;
};

The value of ._eventId for a parallel common event is 0, so it will skip over the code that sets the self switch.

Super informative -- really appreciate it. Thank you @Arthran @Bex and @AquaEcho!!!
Thread closed

Original thread: https://forums.rpgmakerweb.com/threads/is-it-possible-to-reset-the-self-switches-of-a-common-event.158765/