MV Uncaught TypeError: Cannot read property 'naturalWidth' of null

Hello.

I've had a problem for a while now;

Zrzut ekranu 2025-05-06 012028.png


I created a common event, which consists of playing a short animation (video) of an attack or parry using the PDK_VPlayer plugin by Pheonix KageDesu. It plays videos in WEBM format. I noticed that every time the video ends, there is a chance that the error will appear. I think that this is because the game is trying to read some data from the video that has already been removed from the cache. Maybe the whole thing is not 100% optimized, so sometimes it will load everything on time and sometimes not. After the animation ends, an image of a "static sword" appears, which is held in such a way that it does not disappear immediately after the attack animation. Below I am sending more data from the console.

Please help me fix this error. I haven't found any solution. Thanks in advance for your help!

Zrzut ekranu 2025-05-06 011745.png

Zrzut ekranu 2025-05-06 011811.png

Zrzut ekranu 2025-05-06 011902.png

Zrzut ekranu 2025-05-06 011933.png

Zrzut ekranu 2025-05-06 011942.png

Zrzut ekranu 2025-05-06 011950.png
This thread was moved from JS Plugin Releases (RMMV) to JavaScript/Plugin Support.
what does the attack and parry look like?

why not use animation on them?

Vplayer is to use to interact with, not exactly used for animation alike.

if you want to use attacking animations, parrying as playable, I would look
into PDK_AnimaX plugin instead for attacking.

else look into animation to be played instead.

Galv_Projectiles does this really good if you aiming for an lightweight abs system.
what does the attack and parry look like?

why not use animation on them?

Vplayer is to use to interact with, not exactly used for animation alike.

if you want to use attacking animations, parrying as playable, I would look
into PDK_AnimaX plugin instead for attacking.

else look into animation to be played instead.

Galv_Projectiles does this really good if you aiming for an lightweight abs system.
Damn, such a quick response, thanks for that. I didn't get a notification.

It's just a short video that runs full screen, showing only the sword slash. I forgot to mention that I also use rpg maker mv 3d. I turned on first person mode there, so it looks like a sword attack, like in something like Skyrim.

Thanks for the suggestion, I'll try the other plugins and let you know how it goes!

Thanks for the reply.
if its using MV3D plugin to make it more realistic on animation on slashing,
than it can be a bit more complicated as it might not be compatible in
a way you look for.

you didn't told you where using MV3D as well, as that plugins probably
changes a lot of the default way to render it, and if other try to change or extend
it differently, than it might collide as MV3D might alter the width in its own,
to make the screen much better.

so in that regards, I cannot really help and I doubt my suggestion might
even work in those what you try to achieve.
if its using MV3D plugin to make it more realistic on animation on slashing,
than it can be a bit more complicated as it might not be compatible in
a way you look for.

you didn't told you where using MV3D as well, as that plugins probably
changes a lot of the default way to render it, and if other try to change or extend
it differently, than it might collide as MV3D might alter the width in its own,
to make the screen much better.

so in that regards, I cannot really help and I doubt my suggestion might
even work in those what you try to achieve.
You're right.

Well, I don't know how else I could solve it. I only have one more idea; to do it on images that will appear and disappear one after another, to give the impression of animation. I've tried this before, but it didn't look as good as those short animations by playing a movie.

First of all, the whole animation would occasionally flash to start too late, but it would cut off a few frames (images) at the beginning or at the end. In theory, it worked, but in practice, RGP Maker couldn't handle it very well. Is there a plugin that helps with handling images or that even allows you to make such an animation? Actually, it looks like this, I just have more frames of animation:


And if there is no such plugin, maybe there is another way?

Thanks in advance for your help.
best way to make it nice is calling an common event.


Code:
if slash is ON (no interaction possible)
    picture 1 = slash_1 ..... 
    wait 4
    picture 1 = slash_2....
    wait 4
    picture 1 = slash 6
    wait 20 frames
    switch Slash is OFF
else
    slash switch = ON
end

something like this (use it for each weapon if different animation.
but its a matter of testing though what works best.
best way to make it nice is calling an common event.


Code:
if slash is ON (no interaction possible)
    picture 1 = slash_1 .....
    wait 4
    picture 1 = slash_2....
    wait 4
    picture 1 = slash 6
    wait 20 frames
    switch Slash is OFF
else
    slash switch = ON
end

something like this (use it for each weapon if different animation.
but its a matter of testing though what works best.
Thank you, but this is how I did it. The problem is that some frames flicker from time to time, especially when the attack or blocking animation is displayed for the first time, it doesn't load properly. It looks like frames are lost for a split second. Interestingly, I didn't notice this in the recording. Could it be related to the refresh rate? I didn't set the delay between frames of the animation to that high, because I want it to be more fluid, smooth. Is there anything I can do about it?
if it flickers, use this hacky way boot
Code:
show picture 1 opacity 0 // slash1
wait 1
show picture 1 opacity 0 slash2
wait 1
etc
...
erase pictre 1

if it has a bunch, you can use galv or entire folder what I use on boot
from base plugin
JavaScript:
    SDJB_Base.preloadFolders = function() {
        // A list of preloaded images used by my plugins and others
        if (Imported["SDJB_TitleRewardIcons"]) {
            ImageManager.loadTRI = function(filename, hue) {
                return this.loadBitmap("img/shadowdragon/tri/", filename, hue, true);
            }
        }
        // load folder here or list
    }

    SDJB_Base._SB_start = Scene_Boot.prototype.start;
        Scene_Boot.prototype.start = function() {
            SDJB_Base.preloadFolders();
            SDJB_Base._SB_start.apply(this, arguments);
                
        };

so from this, it load all images from boot, so you can set img/pictures
and it load all pictures in the pictures folder, as its simple and effective.

it depends how much images needed to be loaded.

if its only 20, use the evented way, or a smaller plugin to load a common event
on boot (which I have on it too) and turn it off, so its always loaded when the
game starts.

so you don't have to worry to much anyway 🙂

so try some pictures of the slash on evented way and see if that fixed,
than use galv plugin (as it can load the folder) and/or images required.

from there, if it works, your good to go 🙂
if it flickers, use this hacky way boot
Code:
show picture 1 opacity 0 // slash1
wait 1
show picture 1 opacity 0 slash2
wait 1
etc
...
erase pictre 1

if it has a bunch, you can use galv or entire folder what I use on boot
from base plugin
JavaScript:
    SDJB_Base.preloadFolders = function() {
        // A list of preloaded images used by my plugins and others
        if (Imported["SDJB_TitleRewardIcons"]) {
            ImageManager.loadTRI = function(filename, hue) {
                return this.loadBitmap("img/shadowdragon/tri/", filename, hue, true);
            }
        }
        // load folder here or list
    }

    SDJB_Base._SB_start = Scene_Boot.prototype.start;
        Scene_Boot.prototype.start = function() {
            SDJB_Base.preloadFolders();
            SDJB_Base._SB_start.apply(this, arguments);
               
        };

so from this, it load all images from boot, so you can set img/pictures
and it load all pictures in the pictures folder, as its simple and effective.

it depends how much images needed to be loaded.

if its only 20, use the evented way, or a smaller plugin to load a common event
on boot (which I have on it too) and turn it off, so its always loaded when the
game starts.

so you don't have to worry to much anyway 🙂

so try some pictures of the slash on evented way and see if that fixed,
than use galv plugin (as it can load the folder) and/or images required.

from there, if it works, your good to go 🙂
Thank you! I tested this method and it works much better. The first time the sword appears, it still flickers a bit, but after that it doesn’t anymore — and that’s something I can handle. Thanks again and best regards!
galv can work, but if it still flickers after preload/pre-cache it,
its weird as it doesn't really happen on my end.

can be something on the other plugin being delayed. but if its only the first
and not after, its all good, try something with the image loading with 0 opacity.
than call it starting from there, as I have no idea either.

but good luck on your project further 🙂

Original thread: https://forums.rpgmakerweb.com/threads/uncaught-typeerror-cannot-read-property-naturalwidth-of-null.177448/