Is there a script command that would set the event to the middle page of the charset?

I am having the problem described here: https://forums.rpgmakerweb.com/inde...characters-stopping-in-the-step-state.130043/
I am using movie route to change actor's image a lot, and it seems to be the case of them ending their walk mid-animation (left or right column instead of mid).
But i could not find the script command mentioned by @Andar that would change event's frame. Does anyone know it? I would ask in that post but it's quite old so probably would be considered as necropositing.
In case it helps: rather than "column", a better search term for this might be "pattern". 👋

The "resting" pattern for an event is their "original pattern", based on the image selected for its active page. If no image is selected, or the image is a tile, then the original pattern is 0, i.e. left step. If that's a problem, you can work around it by giving that page a character image that is completely transparent: that lets you choose the original pattern/column.

Alternatively, you could use a script call in the move route, e.g.

this.setDirection(2); this._originalPattern = 1; this.resetPattern();
I.e. "face down, set the original pattern to 1 (middle), then reset to the original pattern". The setDirection part isn't essential, but move routes only process up to 1 command per frame, so putting direction & pattern changes in 1 command helps to avoid showing the wrong image for 1 frame.

Note that the core engine only uses _originalPattern for events. If you want this to work for other map characters then you'll need a plugin. I posted one for MZ here, but I think it should also work in MV:
In case it helps: rather than "column", a better search term for this might be "pattern". 👋

The "resting" pattern for an event is their "original pattern", based on the image selected for its active page. If no image is selected, or the image is a tile, then the original pattern is 0, i.e. left step. If that's a problem, you can work around it by giving that page a character image that is completely transparent: that lets you choose the original pattern/column.

Alternatively, you could use a script call in the move route, e.g.

this.setDirection(2); this._originalPattern = 1; this.resetPattern();

I.e. "face down, set the original pattern to 1 (middle), then reset to the original pattern". The setDirection part isn't essential, but move routes only process up to 1 command per frame, so putting direction & pattern changes in 1 command helps to avoid showing the wrong image for 1 frame.

Note that the core engine only uses _originalPattern for events. If you want this to work for other map characters then you'll need a plugin. I posted one for MZ here, but I think it should also work in MV:
Thank you, i did not understand the first solution, but second one worked for my problem!

Also it seems like setDirection only works with even numbers, since uneven portray a middle state between charset.
If no image is selected, or the image is a tile, then the original pattern is 0, i.e. left step.
This is exactly what happened, i use a lot of scenes where characters walk from outside or otherwise appear (portal, for example). So they are events with no image by deafult that change it to character later. I wonder why it's the pattern 0 for no image and why rm does not automaticly change it to middle? Just an oversight from the devs or it serves a purpose?
Thank you, i did not understand the first solution, but second one worked for my problem!
Great! 😂

In more detail: the first solution involves making a new, completely transparent character sheet. Then instead of setting the event's image to "(None)", choose that transparent character. It will look the same (invisible) but because it is now a character the engine will initialise the _originalPattern value based on the pattern (column) you have selected.

Also it seems like setDirection only works with even numbers
setDirection uses the numpad directions:
  • 2 = down
  • 4 = left
  • 6 = right
  • 8 = up
These are the same values available from Control Variables -> Game Data -> Character -> Direction. It makes sense if you look at a standard keyboard numpad.

So they are events with no image by deafult that change it to character later.
You may want to consider activating those events with a page condition instead? (Page conditions are set with the checkboxes to the left of the event's command list.) While none of an event's pages have their conditions met, the event will be inactive, as if it is erased.

E.g. if an NPC appears only when a variable "Kitten Quest" is 5 or more, you could give their first event page the condition "Variable: Kitten Quest ≥ 5".

I wonder why it's the pattern 0 for no image and why rm does not automaticly change it to middle?
It is because _originalPattern normally only updates when the event changes page. Change Image only allows selection of a character block, not a resting frame. Compared to how it is now, your suggestion is more limited: it assumes the developer would always want the character to have _originalPattern = 1 after changing image, rather than keeping the same value.
Then instead of setting the event's image to "(None)", choose that transparent character.
Ah, that is a clever solution, didn't thought about it. It is also very easy to implement.
While none of an event's pages have their conditions met, the event will be inactive, as if it is erased.
Didn't knew about that. Still feel like changing image is more simple task that making the launch condition, and it does not take switches and variables. But in certain situations like parallel events that launch on special condition it will work great.

Original thread: https://forums.rpgmakerweb.com/threads/is-there-a-script-command-that-would-set-the-event-to-the-middle-page-of-the-charset.176292/