RMMZ Set height of Window_EventItem (RMMZ)

dyoghenes

Veteran
Veteran
Joined
Jul 14, 2014
Messages
47
Reaction score
9
First Language
Hungarian
Primarily Uses
RMMZ
Hi!

I recently started porting my MV game into MZ and here is the problem: I wanted the "Select Item" window to have 3 instead of 2 columns, so I opened rmmz_windows.js and modified
Window_ItemList.prototype.maxCols = function() {
return 2;
};
into 3.

This worked, but now the Select Item window shows an extra row (I have 9 items) and I don't know how to modify it to only have 3 rows instead of four.

Can anybody help me please? Thanks!
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
1,942
Reaction score
1,393
First Language
EN
Primarily Uses
RMMZ
Try this, seems to work for me~
JavaScript:
(alias => {
  Window_ItemList.prototype.initialize = function() {
    alias.apply(this, arguments);
    this.move(this.x, this.y, this.width, this.fittingHeight(3));
  };
})(Window_ItemList.prototype.initialize);
I.e. after the default initialize routine, move the window to its current position with only 3 rows of height. :)

Edit @dyoghenes: just noticed you mentioned editing the core scripts, which is inadvisable! :kaoback:

I'd suggest putting my script, plus your override, in a .js file (Save As > File Type: All Files, Filename: whatever.js), putting that file in your project's js/plugins folder, and importing as a plugin through Tools > Plugin Manager in the editor. This allows you to preserve the core scripts (very helpful for support reasons!) as well as track and enable/disable your edit(s) at will. :kaophew:
 

dyoghenes

Veteran
Veteran
Joined
Jul 14, 2014
Messages
47
Reaction score
9
First Language
Hungarian
Primarily Uses
RMMZ
Thank you so much! It worked perfectly! I also reverted the core script change, thanks for the tip!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

We are truly intellectuals.
Without using violence without weapons
Our group has as many as 1.3 million people and more than 1 hundred thousand talks.
We gathered in an hour, more than 4.5 Half a hundred thousand



I got a Sword.
I got an Axe.
I got two Swords.
Nothing to see here, just walking with my dog.
I haven’t worked on my game in a while. Tomorrow might be the day.
*squeals* :kaoblush:


I've been experimenting with improved memory management again, which allowed me to include items to increase player path length. These are both 44 grid spaces long, and stable. :LZSexcite:
I FINALLY DID IT! 5 years making my very first game and I just officially released it on STEAM..... OMG..... I can say I finished a game! The feelings!!!!!

Forum statistics

Threads
104,463
Messages
1,006,474
Members
135,971
Latest member
Akasheee
Top