[RMMV] Faceset not loading?

● ARCHIVED · READ-ONLY
Started by Lady_Blackpearl 9 posts View original ↗
  1. So, I made another custom menu, for now I added some graphic and the status window. but I have a small problem. The faceset of characters are not loading the first time you open menu, they load only after close and open again the menu. Any fix? (I have try do a search on google but I can't find anything). The js contain also the reserveface code, but seem does nothing...
  2. 3 options I can think of:

    1.) The normal code uses the "Window_Base.prototype.reserveFaceImages" function when creating the windows, which seems to work fine.

    Code:
    Scene_Menu.prototype.createStatusWindow = function() {
        this._statusWindow = new Window_MenuStatus(this._commandWindow.width, 0);
        this._statusWindow.reserveFaceImages();  //  <-- You can add a similar line to your custom code
        this.addWindow(this._statusWindow);
    };


    2.) Use the Sprite class. This class already comes with a "load listener" so that it automatically draws after the bitmap is loaded.

    Code:
    //Call this function when initializing Scene_Menu
    Scene_Menu.prototype.drawMyFaceSprites = function() {
        this._haroldFace = new Sprite(ImageManager.loadFace('harold');
        this.addChild(this._haroldFace);
    };

    Note: Using this method has no link between the face and the window anymore


    3.) Set a timeout and try to draw the image again later. You can/should read more information about window.setTimeout here.

    Basically this option will try to draw the image. If the image bitmap is not loaded yet, it will try again after XX time.

    Code:
    Window_MyCustomWindow.prototype.safelyDrawFace = function(name, index, x, y, w, h) {
        // Try to load the image bitmap. If we have loaded it before, it comes instantly.
        // Otherwise, it takes some time.
        const bitmap = ImageManager.loadFace(name);
        // If we do not have the bitmap ready to draw, then try again after 25 ms
        if (bitmap.width <= 0) {
          return setTimeout(this.safelyDrawFace.bind(this, name, index, x, y, w, h), 25);
        }
        // The bitmap must be ready if we got here, so draw the face now
        this.drawFace(name, index, x, y, w, h);
    };
  3. Thank you! I will try one of this options and see. It is strange tho, because I didn't made much chnges to the code (for now) but just add a background and some more images to it. But isn't the first time that it does that.

    EDIT: forgot to mention that my custom menu plugin have the first option but it does nothing at all.

    this._statusWindow.reserveFaceImages(); this for my custom menu plugin isn't working :X yes it is inside that function.
  4. I would not recommend #2 for menu faces, because it would become separated from the window if the player changed formation, for example.
    It is very useful in other scenarios, so it could be good to try for research purposes. Here's a decent tutorial on using Sprite.

    You can also call the reserveFaces function from an event. It only reserves the face for actors in the party, so you would have to call it any time the party gets new actors.
    Code:
    // in an event Script command
    Window_Base.prototype.reserveFaceImages.call(null);
  5. Well yes, problem is that reserveFaceImage isn't working for me at all. :x yep the option 2 is to complicated I guess.

    EDIT: So I made a test. I placed this Window_Base.prototype.reserveFaceImages.call(null); in the Scene_Map.prototype.callMenu = function() {} before the this_waitCount = 2;

    Is working. My guess is could be a bug of rpg maker loading to fast menu to don't manage to load the images faster? or the lack of an update/refresh somewhere.
  6. the problem is that rmmv initialize a new stage at each opening menu.
    You can create a pre-loaded menu but it hard and need good knowledge in js.

    best way it make a special sceneLoading manager for loading all perma stuff like menu!.
    Good approach are to dispatch resource as a pack.
  7. Well I know some java but cant do much deep things, I guess leaving for now that code in the scene_map will do because I'm not sure where to start. I have been watching and following tutorials so Im making my own menu with some copy paste and modify of the scene and window default js. I copied the whole window_menustatus and paste in my plugin, it work but it had same problem of images not loading at first menu opening, they load only after close and reopen it. So my guess was that this problem only happened once (the first time you open menu) and the problem is between the Scene_Map.prototype.callMenu and my plugin. In fact placing Window_Base.prototype.reserveFaceImages.call(null); before the waitcount remove the problem...

    EDIT: also this work too... But placing Window_Base.prototype.reserveFaceImages.call(); in the create function won't work. No clue tho. Now is working just fine. Until i find better or I remake the whole status window. :p Still don't know why it does this problem, afetr all is just a copy of the original code... with soem small modify in the coord pos and the row/cols.
    Code:
    Scene_Menu.prototype.initialize = function() {
        Scene_MenuBase.prototype.initialize.call(this);
        Window_Base.prototype.reserveFaceImages.call();
    };
  8. I geuss this topic can be closed as I found this way to fix the small problem, until i find better solution! Thankst o everyone that helped, appreciate!
  9. This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.