Lollipoppingu

Warper
Member
Joined
Sep 7, 2021
Messages
2
Reaction score
0
First Language
Italian
Primarily Uses
RMMZ
Hi, a quick question:

Currently I have commented these lines in the rmmz_scenes.js file to remove the character and gold windows:
// this.createGoldWindow();
// this.createStatusWindow();
// this._statusWindow.refresh();

Now, is there a way to position the menu in the center and resize it?
Thank you
 

Attachments

  • Immagine 2021-09-19 011910.png
    Immagine 2021-09-19 011910.png
    501.3 KB · Views: 7

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,728
Reaction score
15,308
First Language
English
Primarily Uses
RMMV

I've moved this thread to Learning Javascript. Thank you.

 

casper667

Casper Gaming
Veteran
Joined
Mar 15, 2012
Messages
326
Reaction score
444
First Language
English
Primarily Uses
RMMZ
Window position and size in MZ is usually defined in a rect function called when the window is created (for the menu command window, this would be Scene_Menu.prototype.commandWindowRect).

You can change this function to change the position/size of the window.

Example:

JavaScript:
Scene_Menu.prototype.commandWindowRect = function() {
    const ww = this.mainCommandWidth();
    const wh = this.calcWindowHeight(4, true); // 4 is how many lines tall the window will be
    const wx = Graphics.boxWidth/2 - ww/2;
    const wy = Graphics.boxHeight/2 - wh/2;
    return new Rectangle(wx, wy, ww, wh);
};

I would also caution against editing the rmmz_scenes.js file directly since your changes will be overwritten when updating the corescript (and it will also make debugging harder). It is better to make a separate js file with just your changes and import that into the plugin manager.
 

Lollipoppingu

Warper
Member
Joined
Sep 7, 2021
Messages
2
Reaction score
0
First Language
Italian
Primarily Uses
RMMZ
Window position and size in MZ is usually defined in a rect function called when the window is created (for the menu command window, this would be Scene_Menu.prototype.commandWindowRect).

You can change this function to change the position/size of the window.

Example:

JavaScript:
Scene_Menu.prototype.commandWindowRect = function() {
    const ww = this.mainCommandWidth();
    const wh = this.calcWindowHeight(4, true); // 4 is how many lines tall the window will be
    const wx = Graphics.boxWidth/2 - ww/2;
    const wy = Graphics.boxHeight/2 - wh/2;
    return new Rectangle(wx, wy, ww, wh);
};

I would also caution against editing the rmmz_scenes.js file directly since your changes will be overwritten when updating the corescript (and it will also make debugging harder). It is better to make a separate js file with just your changes and import that into the plugin manager.
Perfect thank you :)
 

Latest Threads

Latest Posts

Latest Profile Posts

My home state baseball team is going back to the World Series for the first time since 1999. I remember when they went in 1995 and won, that was like the best day of my life. (I'm a huge baseball fan and yes I'm talking about the Braves).
FL Studio is a huge step up from LMMS but I'm having such a tough time with it D:<
The new Dune movie reminds me of the game Dune 2 made by Westwood. A quality product on its own, but extremely disloyal to its source of inspiration.
Terrible Writing Advice, you've done it again.
1635026211997.png
Feeling like my new profile picture is nice. Thinking of making it semi-permanent, does any one has an opinion? Does it look too evil or does it work as a public profile picture? :)
Bishiba.png

Forum statistics

Threads
116,037
Messages
1,095,204
Members
151,382
Latest member
ApeXKitsune
Top