Equip Menu Stuff

I almost got this down, but I know I am missing stuff again. I snagged a few lines here and there and made some small modifications, but I cannot figure out where to even start. So, here's a list of things I want, but don't seem to understand how to make.

1. I want the StatusWindow to only show Attack, Defense, Agility, and Luck. I don't want it to show "Name' or any of the other stats.

2. I want the Item list width to match the width of the rest of the menu and to only show 6 items at a time, 3 on the left and 3 on the right.

Spoiler: Code
(function() {

Scene_Equip.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
this.createHelpWindow();
this.createStatusWindow();
//this.createCommandWindow();
this.createSlotWindow();
this.createItemWindow();
this.refreshActor();
this.commandEquip();
};



(function() {

Window_Help.prototype.initialize = function() {
var width = Graphics.boxWidth;
var height = Graphics.boxHeight;
Window_Base.prototype.initialize.call(this, 140, 70, 512, 60);
this._text = '';
};


})();

Scene_Equip.prototype.createStatusWindow = function() {
this._statusWindow = new Window_EquipStatus(340, 130);
this.addWindow(this._statusWindow);
};

Scene_Equip.prototype.createSlotWindow = function() {
var wx = 0
var ww = Graphics.boxWidth;
var wh = this._statusWindow.height;
this._slotWindow = new Window_EquipSlot(140, 130, 200, 180);
this._slotWindow.setHelpWindow(this._helpWindow);
this._slotWindow.setStatusWindow(this._statusWindow);
this._slotWindow.setHandler('ok', this.onSlotOk.bind(this));
this._slotWindow.setHandler('cancel', this.popScene.bind(this));
this.addWindow(this._slotWindow);
};

})();

Please! Help me with this project! This community is the best!
For parameters customization, see my note below. The script come from rpg_window.js
JavaScript:
Window_EquipStatus.prototype.refresh = function() {
    this.contents.clear();
    if (this._actor) {
        // Delete the line below if you don't want to draw the actor name
        this.drawActorName(this._actor, this.textPadding(), 0);
        //======================================================
        // Edit the loop below to draw only param of interest.
        // remember the parameters have the following indexes :
        // 0:HP - 1:MP - 2:ATK - 3:DEF - 4:MAT - 5:MDF - 6:AGI - 7:LUK
        for (var i = 0; i < 6; i++) { // this loop goes from i=0 to i=5
            this.drawItem(0, this.lineHeight() * (1 + i), 2 + i); // here the paramID that is drawn is i+2.
        }
    }
};

Didn't understand what you want to do with item list...
Thank you so much for this!
I am a little confused though. This is what I have and it makes it to 4, but I can't figure out how to select which Parameters. Also, how do I start the Parameters at the top where the Name would be.

JavaScript:
        for (var i = 0; i < 4; i++) { // this loop goes from i=0 to i=5
            this.drawItem(0, this.lineHeight() * (1 + i), 2 + i); // here the paramID that is drawn is i+2.
well it's not because the original script use a loop that you have to use it. Thanks to the low amount of item yo have to draw (only 4) ou can do something like this per example :

JavaScript:
this.drawItem(0, this.lineHeight() * 1, 2); // draw param 2 -> ATK
this.drawItem(0, this.lineHeight() * 2, 3); // draw param 3 -> DEF
this.drawItem(0, this.lineHeight() * 3, 6); // draw param 6 -> AGI
this.drawItem(0, this.lineHeight() * 4, 7); // draw param 7 -> LUK

Or if you really want to use a loop, below a template that you intensively retrieve in a lot of script

JavaScript:
var paramID = [2,3,6,7]; // we create a variable that contain the ID we want
for (var i=0; i<4; i++){ // set the loop from 0 to 3
    this.drawItem(0, this.lineHeight()*i, paramID[i]); // paramID[i] is the value of paramID at position i
                                                         // javaScript start counting with 0
};

Be creative !!

Then, for positioning the item you draw in the window, you probably noticed that the function drawItem take 3 arguments

JavaScript:
this.drawItem( x , y , id)

I hope you have already understood the last argument "id".
The argument x and y are the x,y coordinate at which you want to draw your stuff. If y is closer to 0, then the item will be draw closer to the top of the window. if y is huge, the item is drawn closer to the bottom.
In the original code, y is proportional to i what means that y increases after each loop iteration. If you don't use a loop, impossible to make y proportional to i since i doesn't exist. You have to define y manually. Compare my two examples to understand how we can do it 😉
You are amazing!!!! I can't believe this game is coming to life!!!

So, I was pretty sure I understood the Window x,y,width, height, but this doesn't make the box smaller so it is only big enough to fit the 4 Parameters. The position of the box worked perfectly, but the width and height did not.

JavaScript:
Scene_Equip.prototype.createStatusWindow = function() {
this._statusWindow = new Window_EquipStatus(340, 130, 200, 200);
this.addWindow(this._statusWindow);
};
ahah this is a bit more tricky than your previous request, especially if you're a beginner in rmmv script.
Every time you create a new object, in this case the object is Window_EquipStatus, go take a look at the corresponding initialize function.
Because this object is a window, you will find it in the rpg_window.js file.

Here the function :

JavaScript:
Window_EquipStatus.prototype.initialize = function(x, y) {
    var width = this.windowWidth();
    var height = this.windowHeight();
    Window_Base.prototype.initialize.call(this, x, y, width, height);
    this._actor = null;
    this._tempActor = null;
    this.refresh();
};

Do you see width and height in the argument ? the arguments are in the function(argument1, argument2, ...).
No there aren't.
So, when you call
JavaScript:
this._statusWindow = new Window_EquipStatus(340, 130, 200, 200);
The two first argument are well understood by the initialize function as x and y.
But the two extra arguments are just.... ignored since there aren't two extra arguments.

Hopefully, you can see in the function that Width and Height are define by the a function within the same object namely windowWidth() and windowHeight() respectively.

Go find those function !! They should be name Window_EquipStatus.prototype.windowWidth I'm sure you can understand how to modify the width and height from now.
Oh wow! I don't know how I missed that now that you have explained it to me! I looked in that area for hours! xD
Okay! So, basically, I can do the same thing with the ItemWindow?
Well I gave you a method to understand those script. Maybe it's not the best method, but it's nicely suitable for beginner. If you are interested in ItemWindow :
  • go in the rpg_window.js file (the object you are interested in will obviously be in this file I think...).
  • Find the initialize function and look at how this window is initialized : what are the arguments etc. It's not because the previous example hasn't width and height in arguments that all windows will work the same way. Perhaps, for some specific windows, the width and height will be given in the argument.
  • Read the initialize function to understand how height and width are define.
  • Find the function that do the job.
  • Edit those functions to fit your game
  • And give a screenshot to your sadistic teacher also !!
haha Yes Sensei!
You are amazing! Thank you so much for everything. I think I have a decent understanding on how to modify windows. I cannot thank you enough!
I ran into a small problem. It Item box only shows the top Item's Icon. I'm not sure why.

JavaScript:
(function() {

Scene_Equip.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
this.createHelpWindow();
this.createStatusWindow();
this.createSlotWindow();
this.createItemWindow();
this.refreshActor();
this.commandEquip();
};


(function() {

Window_Help.prototype.initialize = function() {
var width = Graphics.boxWidth;
var height = Graphics.boxHeight;
Window_Base.prototype.initialize.call(this, 140, 80, 512, 60);
this._text = '';
};


Window_EquipStatus.prototype.refresh = function() {
this.contents.clear();
if (this._actor) {
var paramID = [2,3,6,7]; // we create a variable that contain the ID we want
for (var i=0; i<4; i++){ // set the loop from 0 to 3
this.drawItem(0, this.lineHeight()*i, paramID[i]);
        }
    }
};


Window_EquipStatus.prototype.initialize = function(x, y) {
    var width = this.windowWidth();
    var height = this.windowHeight();
    Window_Base.prototype.initialize.call(this, 340, 140, 312, 180);
    this._actor = null;
    this._tempActor = null;
    this.refresh();
     };


})();


Scene_Equip.prototype.createSlotWindow = function() {
var wx = 0
var ww = Graphics.boxWidth;
var wh = this._statusWindow.height;
this._slotWindow = new Window_EquipSlot(140, 140, 200, 180);
this._slotWindow.setHelpWindow(this._helpWindow);
this._slotWindow.setStatusWindow(this._statusWindow);
this._slotWindow.setHandler('ok', this.onSlotOk.bind(this));
this._slotWindow.setHandler('cancel', this.popScene.bind(this));
this.addWindow(this._slotWindow);
};


Window_EquipItem.prototype.initialize = function(x, y, width, height) {
    Window_ItemList.prototype.initialize.call(this, 140, 320, 512, 180);
    this._actor = null;
    this._slotId = 0;
};
Are you using plugins related to items ? I see that you have 'sword' which is repeated many times, a feature that could be introduced by YEP_ItemCore per example. Or maybe you have created thousands of sword item in the database and some miss the icon.
Well, I made 10 different Swords and each one has an icon. I did make a plugin to modify the size of Icons.

I found time today to remove this code and test it and all the icons returned. So, I bet they were ALL stacked in that one position with this code.


HEY SENSEI! You will be extremely proud of me! I figured out how to keep the icon size 24 AND got ALL the Icons on the screen!!

All I had to do is add +4 to x and y instead of replacing it!

JavaScript:
this.contents.blt(bitmap, sx, sy, pw, ph, x + 4, y + 4, dw, dh);



JavaScript:
Window_Base.prototype.drawIcon = function(iconIndex, x, y) {
    var bitmap = ImageManager.loadSystem('IconSet');
    var pw = Window_Base._iconWidth;
    var ph = Window_Base._iconHeight;
    var sx = iconIndex % 16 * pw;
    var sy = Math.floor(iconIndex / 16) * ph;
    var dw = 24; //your desired portrait width
    var dh = 24; //your desired portrait heith
    this.contents.blt(bitmap, sx, sy, pw, ph, 8, 6, dw, dh);
};
Check it out!
Okay great I didn't have the time to see your previous answers that you've already fixed your Pb.

And yes it's logical, the window for weapon selection draw items using a loop. After every loop iteration, the position of the next item is update according to the position of the previous item. If you give a X and Y that are not proportional to the last item or not proportional to the loop iteration, then all the icons are drawn at the same position. (You thought that only Icon 1 was drawn, but in fact the visible Icon was the one of the Item 4, all the others were stacked under)

But sure you've already understood it. You are now as good as me with JS and RMMV scripts. Good luck for the next 😉

Original thread: https://forums.rpgmakerweb.com/threads/equip-menu-stuff.121475/