Trouble with character frames

I'm having trouble getting an event to show the correct frame. It's odd because this is a minor modification of the default "treasure" event, which works perfectly.

For reference, here is a sample default "treasure" event:

Spoiler: Default Treasure Event
temp1.png

temp2.png

That event uses a custom character sheet by Avery; I can't post it here due to her terms, but I'm pretty sure you can find it somewhere in her MV thread.

And here's my event:

Spoiler: My Event
temp3.png

temp4.png

What you can't see in the above screenshots is that there are three character sheets involved. The character sheet used on page 1 is this one that I cobbled together from some RTP terrain graphics:

!$Container.png


The character sheet on page 2 is this one, except that I added Avery's open barrel to the top row (I've removed it here to honour her terms of not posting edits):

!$Container2.png


And the character sheet referenced from the move route (!$Barrel)) is the previously-linked barrel opening sheet from Avery.

When I run the default event, everything works – even though the move route never explicitly sets the event's direction to up, switching to page 2 still uses the "up" facing image.

But when I run my modified version of the event, that doesn't work. Instead of the open barrel ("down" facing), it shows the open crate ("right" facing). I can mostly fix it up adding "Turn Down" to the move route, but then it flickers closed before fully opening.

I'm not sure what's so different about my event that causes it to not work. I did try disabling the Stepping animation but that didn't change anything. Is there anything else I can do to get this working without the flicker?
About the flicker issue: It can occur when playtesting an event right away (sometimes). Alternatively, you could use an "in between" frame to use as neutral/transition frame. For example:

I have my main characters sprite sheet with a bunch of characters on it (bear with me for a sec). For the highest priority character, I made additional "special" extra sprite sheets (my reason why is not important). Well... Sometimes you start an event at a certain direction... But then it can cause a flicker effect because you try to reorient so it makes sense.. Depending... Well if you use a common neutral state as a frame present in both sheet, you could technically "mask" the odd flicker effect (caused by switching sheet).



I know my reply is a bit vague and muddy, but I hope it might inspire you a fix or stir some thoughts about how you handle your issue. [Off-Topic]: Is there a reason for the misalignment? Like the characters attack or bash at the barrel/chests making them "jump"?
[Off-Topic]: Is there a reason for the misalignment? Like the characters attack or bash at the barrel/chests making them "jump"? [/I]
You mean how the sheets I cobbled together has them at 3 different heights? That's because they're floating in the water. (There should probably be some ripples too, but I haven't looked into that yet.)
The key detail that happens with the default treasure event but does not happen with my event is that the event's direction is updated when the page changes, based on the graphic that was explicitly selected in the editor. I don't know why it works for one event and not another.
I debugged it a little and discovered this little nugget in Game_Event.prototype.setupPageSettings that seems to be the culprit:

Code:
    if (this._originalDirection !== image.direction) {
        this._originalDirection = image.direction;
        this._prelockDirection = 0;
        this.setDirectionFix(false);
        this.setDirection(image.direction);
    }
    if (this._originalPattern !== image.pattern) {
        this._originalPattern = image.pattern;
        this.setPattern(image.pattern);
    }

To sum up, what this seems to mean is that the direction of an event is changed when the page switches if and only if the direction that was originally set for the old page is different from the direction that was set for the new page. The current direction of the event is not relevant, only the direction configured in the event settings. And similarly for the pattern, which may also be relevant since my event has step animation enabled.

It seems to be intentional. I'm not sure if just wholesale disabling that behaviour (essentially, replacing the if blocks with just their contents) would cause other issues or not…
Closed as Solved.

Original thread: https://forums.rpgmakerweb.com/threads/trouble-with-character-frames.179904/