How to make a script call reference itself?

I referenced a post about setting an event’s autonomous movement via a script call. I want an event to change from Approach to Fixed, and then back. This script does the job;

$gameMap.event(3)._moveType = 0

but I want the script to reference itself as if it were set to “This Event.” There’s a lot of events that need this script call, so setting all their IDs manually is not feasible. Any advice?

Inside a Script command, this is that event’s interpreter, so you can swap the 3 for this.eventId():

$gameMap.event(this.eventId())._moveType = 0;

There’s also this.character(0), which is the same thing as picking “This Event” in the editor:

this.character(0)._moveType = 0;

Approach is 2 when you want to set it back. It also works from a common event as long as the event itself calls it, since the common event keeps the caller’s event ID. A common event that runs on its own from a switch won’t have one though.

The this.character(0) version is especially handy for your case, since you can copy the same script into many events without changing an ID in each one. Just keep in mind Baz’s note about common events: it works when the event itself calls the common event, but not when the common event runs on its own from a switch.

Thank you very much!