Help with cropping faces/changing face Y position in message windows!

● ARCHIVED · READ-ONLY
Started by 8bitboy 5 posts View original ↗
  1. Hello again, fellow makers.

    This time I've been facing an issue that could probably be easily solved, but since I have almost no .js knowledge it has been a huge headscratcher...

    I've decided to reduce the number of message rows from 4 to 3 (By using Yanfly's YEP_MessageCore) and at first sight, it looks pretty great!
    But then, here comes the problem: The faces end up getting cropped in a weird way. See below:

    1581793654911.png

    I tried to follow the steps on this thread, but even though it solved my problem (more-or-less), the faces on the menu got a little bit stretched, so I gave up on that.

    Now I only wanna know if there's a way for me to change the Y aspect of the face on the message window, so I don't have to manually edit every .png file manually (Since my game has lots of face files, it could be a very lenghty task).

    Any help is appreciated!
  2. Hi!
    I did not test it, but maybe you can put this in a text file and save it as .js:

    Code:
    Window_Message.prototype.drawMessageFace = function() {
        this.drawFace($gameMessage.faceName(), $gameMessage.faceIndex(), X, Y);
        ImageManager.releaseReservation(this._imageReservationId);
    };

    By default, the X and Y are 0. I think if you put a negative value on Y, it will help.

    But If I was you, I will change my png files instead of Js.
  3. I'm assuming that by "change the Y aspect of the face" you mean that you want to change the height of the image (as opposed to the Y-coordinate), and still have it centered. If you take a look at the original code in rpg_windows.js, you can see the following:
    Code:
    // Original function in rpg_windows.js
    Window_Message.prototype.drawMessageFace = function() {
        this.drawFace($gameMessage.faceName(), $gameMessage.faceIndex(), 0, 0);
        ImageManager.releaseReservation(this._imageReservationId);
    };
    Now, the drawFace function accepts an additional two arguments that are not seen above, but you can actually specify the exact width and height of the face image. So, for example, if I want to retain the face width but change the height from the default of 144 to 100, I just add that after the 0, 0 arguments of drawFace (FYI, the 0, 0 specify the X and Y-coordinates of the image, respectively):
    Code:
    // Override of the original function to add arguments for width and height
    Window_Message.prototype.drawMessageFace = function() {
        this.drawFace($gameMessage.faceName(), $gameMessage.faceIndex(), 0, 0, Window_Base._faceWidth, 100);
        ImageManager.releaseReservation(this._imageReservationId);
    };
    So what you can do is copy the second block of code into a new plugin, and change Window_Base.faceWidth and the number 100 to whatever width and height you want. It should be compatible with YEP_MessageCore.js. This only affects the message window.
  4. I've moved this thread to JavaScript Support. Thank you.