MZ How to realign equip shown VisuStella Main Menu Core

1661875484021.png


Hey 🙂
I am using SOLO STYLE menu property from VisuStella Main Menu.
I have created a few more equipment slots but I can't equip them otherwise they will be displayed vertically like above.
How can I split the equipments into 2 rows or more?

Example:
NOW: 8 equips - 0 equips
GOAL: 4 equips - 4 equips
Anyone would know? :c I think this is the part of the code where it draws the equips.

Spoiler
const equips = actor.equips();

totalHeight += lineHeight;

totalHeight += equips.length * lineHeight;

sy = Math.max(rect.y, rect.y + Math.floor((rect.height - totalHeight) / 2));


1662227947188.png
JavaScript:
Window_EquipSlot.prototype.maxCols = function() {
    return x;
};

Window_EquipSlot.prototype.maxRows = function() {
    return x;
};

This should do the trick, though you might need to resize the slot width and or window depending on the layout.
JavaScript:
Window_EquipSlot.prototype.maxCols = function() {
    return x;
};

Window_EquipSlot.prototype.maxRows = function() {
    return x;
};

This should do the trick, though you might need to resize the slot width and or window depending on the layout.
Thanks for your input.

Though, it seems to be affecting the Equip Scene rather than the Main Menu Scene which displays the equipments of the Actor.

I will write here the code that draws the equip display:
Spoiler: Draw Actor Equipment
// Draw Actor Equipment
this.resetFontSettings();
sx = rect.x + Math.floor(rect.width / 2);
sy = ny + lineHeight;
sw = rect.width / 2;

for (const equip of equips) {
if (equip) {
this.drawItemName(equip, sx, sy, sw);
sy += lineHeight;
if (sy + lineHeight > rect.y + rect.height) return;
}
}
Ah okay my bad, I missed that part of it being displayed in the main menu.
Anyway, I'm no expert and there's probably a better way to do this, but I was able to get the intended results with this:
JavaScript:
// Draw Actor Equipment
this.resetFontSettings();
sx = rect.x + Math.floor(rect.width / 2);
sy = ny + lineHeight;
sw = rect.width / 2;
current_index = 0;
new_xpos = (sw/2);

for (const equip of equips) {
    if (equip) {
current_index ++;
        if (current_index == 5){
            sy = ny + lineHeight;
        };

        if (current_index > 4){
            this.drawItemName(equip, sx + new_xpos, sy, sw);
            sy += lineHeight;
        } else {
            this.drawItemName(equip, sx, sy, sw);
            sy += lineHeight;
        }
        
        if (sy + lineHeight > rect.y + rect.height) return;
    }
}

Again, you might need to play with new_xpos var to get it to fit to your liking.
Ah okay my bad, I missed that part of it being displayed in the main menu.
Anyway, I'm no expert and there's probably a better way to do this, but I was able to get the intended results with this:
JavaScript:
// Draw Actor Equipment
this.resetFontSettings();
sx = rect.x + Math.floor(rect.width / 2);
sy = ny + lineHeight;
sw = rect.width / 2;
current_index = 0;
new_xpos = (sw/2);

for (const equip of equips) {
    if (equip) {
current_index ++;
        if (current_index == 5){
            sy = ny + lineHeight;
        };

        if (current_index > 4){
            this.drawItemName(equip, sx + new_xpos, sy, sw);
            sy += lineHeight;
        } else {
            this.drawItemName(equip, sx, sy, sw);
            sy += lineHeight;
        }
      
        if (sy + lineHeight > rect.y + rect.height) return;
    }
}

Again, you might need to play with new_xpos var to get it to fit to your liking.
I really appreciate your help!

I didn't test your input but I have managed with a different (but quite similar) approach, and it's now working:

JavaScript:
// Draw Actor Equipment

this.resetFontSettings();

    sy += 7 + lineHeight;

    const pw = Math.floor(cw / 2) - 24;

    let px = sx3;

    let counter = 0;

    for (const equip of equips) {

        this.resetFontSettings();

        this.drawItemName(equip, px, sy, pw, gaugeLineHeight);

        this.resetTextColor();

        this.contents.fontSize -= 2;

        counter++;

        this.resetTextColor();

        if (counter % 2 === 0) {

            px = sx3;

            sy += lineHeight;

        } else {

            px += pw + 24;

        }

    }

I'm sure the ''+new_xpos'' you have inserted after the ''> 4 checker'' will make it work as well.

It's solved.

Thanks!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-realign-equip-shown-visustella-main-menu-core.150940/