self switch in move route

hi
I want to change self switch by move route
to do an enemy AI//action battle
I search and find this
https://forums.rpgmakerweb.com/index.php?threads/self-switch-check-via-script-call.86176/
but it's too complicate
I just want to change the same event self switch in move route
is there a script like
this.event(A,true)
.
in move route there are game switch controll
but my game is action it had many mob of enemy
and that not the good direction I think

thank you
I wanted to know exactly the same.
Luckily the answer was allready found, so i can share it with you now.
Code:
$gameSelfSwitches.setValue([$gameMap.mapId(), this._eventId, 'A'], true)
Dont forget that Events far outside the Visible Screen will not start or continue there Moveroutes (Accept for that one workaround,which doesnt matter now).
Unfortunately, in the context of a move route, it looks like "this" is the instance of Game_Player, so "this._eventId" returns undefined. I think you have to pass in the specific event ID you want to change the self-switch for:

Code:
// Change x to be whatever the ID of the Event is and 'A' to be whatever
// self-switch you want to set
$gameSelfSwitches.setValue([$gameMap._mapId, x, 'A'], true);
Unfortunately, in the context of a move route, it looks like "this" is the instance of Game_Player, so "this._eventId" returns undefined. I think you have to pass in the specific event ID you want to change the self-switch for:

Code:
// Change x to be whatever the ID of the Event is and 'A' to be whatever
// self-switch you want to set
$gameSelfSwitches.setValue([$gameMap._mapId, x, 'A'], true);

Only if the move route is being applied to a player. "this" refers to whatever object the move route is, well, moving, rather than the source that assigned the move route.
The example is tested and works, i use it in my project and if i remember correctly , than @caethyril helped me with it. Iam using it in Autonomous Moveroute and also used it in Eventcommand "Set Moveroute".

Edit: I forgot the Link to the RMMV Script Call List. Its not as complete with Syntax examples as the VX-Ace Version, but its still very plenty and helpful.
https://forums.rpgmakerweb.com/index.php?threads/rpg-maker-mv-script-call-list.46456/
thank you all
it work very well
I had do some parallel instead
but this is the great resolve!
Hmm. I tried this._eventId on an event that just had a script in a move route and it returned undefined. I logged this and it was Game_Player. Maybe you have to give some kind of move instruction first and the underlying code changes the context?
You got a Type Error in your code above:

$gameMap._mapId

but it needs to be:

$gameMap.mapId()

Not tested to make sure but this could be it.
Unfortunately, in the context of a move route, it looks like "this" is the instance of Game_Player,

If your move route targets the player (in the drop down box where you select who/what to apply the move route to), then this is $gamePlayer.

But if your move route targets an event, this is the event.

I'm guessing you just took the default when you tested, which is the player.
That's it - I forgot you pick a target via the dropdown. Been working so much with Plugins and script help. I just made a move route and put in a script call.

You got a Type Error in your code above:

$gameMap._mapId

but it needs to be:

$gameMap.mapId()

$gameMap._mapId is valid. I'm on my phone, so I can't check, but I'd be willing to bet mapId() just returns the value of _mapId.
You seem right and iam also sure @Shaz pointed out the actual error. That should solve it.

Original thread: https://forums.rpgmakerweb.com/threads/self-switch-in-move-route.105720/