MZ Changing the X coordinate of actor battle window

1742571095636.png

After I changed the resolution, the UI became off-centered, and I don't seem to have scripts that change the X coordinate, so I would be glad, if someone could write one that could move the actor window (pretty sure I'm able to move the command and 'eyes' window).
In your screenshot, the core windows (status and command) are centred. It's the custom "eyes" window that is off-centre.

Note that MZ implements 2 sizes (both found on the System 2 tab in the Database):
  • Screen Width/Height - this affects the game display size;
  • UI Area Width/Height - this affects the area in which windows are placed in-game.
By default the UI Area is centred in the screen...but as always, plugins might change that.

In MZ, the X position of the battle status window is based on the scene's statusWindowX method. So I guess you'll need a plugin to patch that method to account for the width of your custom window? E.g. (untested):
Spoiler: plugin code A
JavaScript:
/*:
 * @target MZ
 * @help Free to use and/or modify for any project, no credit required.
 */
;void (alias => {
  Scene_Battle.prototype.statusWindowX = function() {
    const eyesWindowWidth = 123;  // edit this line
    return alias.apply(this, arguments) - (eyesWindowWidth >> 1);
  };
})(Scene_Battle.prototype.statusWindowX);
...or maybe something similar for statusWindowRect, e.g.
Spoiler: plugin code B
JavaScript:
/*:
 * @target MZ
 * @help Free to use and/or modify for any project, no credit required.
 */
;void (alias => {
  Scene_Battle.prototype.statusWindowRect = function() {
    const r = alias.apply(this, arguments);
    const eyesWindowWidth = 123;  // edit this line
    r.x -= eyesWindowWidth >> 1;  // subtract half, truncated to int
    return r;
  };
})(Scene_Battle.prototype.statusWindowRect);
I didn't realised it was off-centered because of 'eyes' window before, that kinda eases it. Thanks for help, it might be useful, if it proves an issue in the future.

Original thread: https://forums.rpgmakerweb.com/threads/changing-the-x-coordinate-of-actor-battle-window.176442/