Set a specific stepping frame in movement route?

I'm trying to make an elaborate overworld animation using spritesheets. My plan was to use the command
Code:
$gameMap.event(this.eventId())._originalPattern = X;
to cycle between the three walking and stepping frames, after which it would move to the next row of three sprites on the sheet (by rotating the event). However, I'm having a lot of trouble. For some reason the aforementioned command to set the event pattern is SUPER glitchy. It doesn't display pattern 2 if I set it to ping-pong between 0 and 2, and if I give it a command to rotate 90 degrees after going through all three frames, it does two full rotations before momentarily spazzing out and resuming its spinning.

Has anyone else had this problem? How can I easily set a specific stepping frame for an event, without it going completely crazy?

EDIT: I was able to get more success using
Code:
$gameMap.event(this.eventId()).setPattern(X);
instead, but now I have a different issue. At the end of the movement command, I have it set keep frame 3 (top right corner of a spritesheet) on screen for 15 frames. Despite that, for some unfathomable reason, RMMV only displays it for but a SINGLE frame, and displays the remaining time as the default sprite of the event page!
Okay, I then try setting the default page sprite to sprite 3. But now SPRITE 2 doesn't show up for but a frame! It's like the system utterly falls apart if you try to set the sheet to the right side.

EDIT 2: I don't know what I managed to do, but it mostly works now. However, every time that the sprite changes rows, it flickers the leftmost sprite on the character sheet for one frame, because RMMV can't change both the direction and pattern in one frame.. It looks almost good, but at high framerates, it goes back to being terrible. I could probably make multiple spritesheets and only use the middle column, but I would really like to use this method if feasible.
Move routes process up to 1 move command per frame. You can work around this by setting the direction and pattern in 1 Script move command, e.g. "make the character being moved face right and show their left-step frame":

this.setDirection(6); this._originalPattern = 0; this.resetPattern();
The engine uses numpad directions: 2 = down, 4 = left, 6 = right, 8 = up.

Note that _originalPattern only works for map events. I posted a small plugin to enable it for other characters (e.g. player) here, in case anyone's interested:

For more tips, you can check out this tutorial by Avery:
I also made a post in that thread explaining why the pattern resets if you don't set _originalPattern.
Move routes process up to 1 move command per frame. You can work around this by setting the direction and pattern in 1 Script move command, e.g. "make the character being moved face right and show their left-step frame":

this.setDirection(6); this._originalPattern = 0; this.resetPattern();

The engine uses numpad directions: 2 = down, 4 = left, 6 = right, 8 = down.

Note that _originalPattern only works for map events. I posted a small plugin to enable it for other characters (e.g. player) here, in case anyone's interested:

For more tips, you can check out this tutorial by Avery:
I also made a post in that thread explaining why the pattern resets if you don't set _originalPattern.
This method almost worked, however a new issue arose. The odd flicker between direction changes is still there, even when you include the script calls in a single block. What's even more odd is that if you increase the wait time between pattern changes, the length of the flicker increases, although it is always a small faction of the wait time itself.

You can see what I mean here. The next frame's rightmost sprite (3, 6, 9, 12) appears for a split second before it changes direction and goes back to the leftmost sprite (1, 4, 7, 10).

Attached is the current event call.
EDIT: Oop, didn't notice the resetPattern function at the end! That did seem to get rid of the flicker, thanks a bunch! Now to just figure out why the timing is slightly off for some of the numbers...
EDIT: Oop, didn't notice the resetPattern function at the end! That did seem to get rid of the flicker, thanks a bunch! Now to just figure out why the timing is slightly off for some of the numbers...
Try waiting for 59 frames instead? Remember that each move command, including the Script ones, takes (at least) 1 frame to complete.

There's also a subtlety here: each frame, a Parallel map event will update its movement first, then its event commands. So your Parallel event gives itself a move route, but that route won't start processing until next frame.

Is there anything else in that event except for the move route command? If not, I recommend that you change the event's Autonomous Movement type from "Fixed" to "Custom". Then put the move route in there instead, and change the event's trigger to Action Button or something. If the event hasn't been told to move differently, it will just follow its autonomous move route. 👋

Original thread: https://forums.rpgmakerweb.com/threads/set-a-specific-stepping-frame-in-movement-route.160507/