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,720
Reaction score
15,304
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 Profile Posts

Woot got a promotion and a pay rise ᕙ( • ‿ • )ᕗ now I'm set.
does anyone feel like explaining to me the difference between simulation and emulation? you have my full permission to be as pedantic as you want.
About the Deer, I had to cut some piece of video due the *swearing* Youtube copyrights issues...
A caveman pokes his head in...
I was listening to songs by Chuck E Cheese's voice actor (Jaret Reddick from Bowling for Soup) when the meds I was taking for my stomach virus apparently stopped working. I can't take my next dose until morning, but it's no use anyway. I'm officially sick again. Of course, I'll definitely take the next dose either way, but it's useless now.

Forum statistics

Threads
116,006
Messages
1,094,859
Members
151,311
Latest member
OpenWings
Top