Error "Uncaught TypeError: Cannot read property 'resolution' of null"

So I have this parallel event running on a parallax map which animates the map via looping parallax changes:

1677722553197.png


It seems pretty straightforward, but whenever the map loads with this event running, it crashes the game and throws the error, "Uncaught TypeError: Cannot read property 'resolution' of null":

1677722483299.png


The map loads and everything else works without issues when this event is not present. File names are correct and none of the images are corrupt. Anyone know what the problem might be?
So I have this parallel event running on a parallax map which animates the map via looping parallax changes:
View attachment 254706
best to not use a loop inside of a parallel event, very bad idea...
your looping inside of a loop... hope that makes sense to ya 🙂

...sooo ...instead do something like this:
Spoiler
1677724637090.png

JavaScript:
let varId = 1, maxCount = 4, file = '!Grotto';
$gameVariables.setValue(varId, $gameVariables.value(varId) || 1);
if ($gameVariables.value(varId) > maxCount) {$gameVariables.setValue(varId,1);}
$gameMap.changeParallax(file+$gameVariables.value(varId), false, false, 0, 0);
$gameVariables.setValue(varId, $gameVariables.value(varId)+1);
*Wait Command*

& if ya wanna get real sneaky with it and avoid a parallel event, you can even place that code into the moveroute, set speed/frequency to the highest, & have the moveroute set on repeat like this:
Spoiler
1677725080804.png

JavaScript:
let varId = 1, maxCount = 4, file = '!Grotto'; $gameVariables.setValue(varId, $gameVariables.value(varId) || 1); if ($gameVariables.value(varId) > maxCount) {$gameVariables.setValue(varId,1);} $gameMap.changeParallax(file+$gameVariables.value(varId), false, false, 0, 0); $gameVariables.setValue(varId, $gameVariables.value(varId)+1);

See if that works.

My best guess is that the error was caused from it trying to load to a baseTexture before it could fully process the new image.
Edit: Wait no it's still broken without the loop.

It's like the first frame of the parallax shows, then the second frame shows gray, then the third frame shows, then the fourth is gray again and it crashes.
what happens if you give it a considerable longer wait time between changes?
forget about 'adequate' for the moment, just make the thing work.
what happens if you give it a considerable longer wait time between changes?
forget about 'adequate' for the moment, just make the thing work.
Oh yeah I forgot to mention that part too. Agreed. I was also thinking that too short of a wait could definitely be a factor, especially if it's a large image.
what happens if you give it a considerable longer wait time between changes?
forget about 'adequate' for the moment, just make the thing work.
I changed it to 60 frames and it worked. Changed it back to 12 and it was broken again. Seems anything below 16 breaks
Anyone know what the problem might be?
This is my guess. Because of how the MZ engine works, it loads the picture in parallel. It does not stop from going forward until the image is fully loaded unlike in previous engines.

When you change to Grotto_2, it is still loads the image, but because the wait in between change parallax is too short before it finishes loading, it already changed into something else and the computer confused.

A solution would be to preload the image. Unfortunately, I'm unable to give the answer.
I guess it could be engineered to use a smaller image, maybe with some event wizardry... but the way to go for sure would be a plugin.
Load speed is mainly filesize caused - so you can experiment with using higher compression to reduce filesize on your pictures.
If the critical difference is between 12 and 16 frames, you should be able to make it work if you reduce the filesize by one third. But I don't know if the quality loss due to higher compression is still acceptable to you on that change.
The images are only 303 KB each, so it seems odd that they would cause any kind of performance issue. Also FPS stays at a constant 60 and doesn't drop prior to the error.
Then we are back to guessing.
It has to be something timing-based if the error only happens with less than 16 frames delay.

60 fps doesn't matter here - not everything timing based causes lag.

can you give us the full folderpath of the project, from drive letter to index.html?
The playtest redirect to the virtual folder should prevent any of the redirection errors, but perhaps those still cause problems...
try this:
load the images with another process outside of that event, and then quickly shift them in that process with your original speed or less.
make sure that the images are loaded, one by one, maybe with a stop in between... or go at it manually, with different player-activated events, and then go for the full speed.
if it still stutters, it's not a file access problem, more like a memory access problem.

Original thread: https://forums.rpgmakerweb.com/threads/error-uncaught-typeerror-cannot-read-property-resolution-of-null.155436/