MV [SOLVED] Issue relating to YEP_EquipCore's horizontal positioning of the parameters

Menu is looking great except the current parameters are misplaced and merging with the parameter names, not sure how to move them more to the right, it's obviously somewhere in the Window_StatCompare section in the code but I've tried changing everything seemingly relevant to the positioning of the text and I can't figure it out for the life of me. Edit: Forgot to put this but I have reduced the screen size to be 480 x 432 using Yanfly, 3x more than the Game Boy screen size
1763843939735.png

(The blank parameter (which is MDF) is meant to be blank, was gonna sort it out later, seems easy but if you know how to get rid of it feel free to tell me 😛)

What's interesting is that when I turn off Eli_BitmapFontPro, the current parameters set in the right position, but of course the font not being bitmapped makes it look a bit shiiiiiiiit
1763844023019.png


Stat Compare window of code
Spoiler: CODE
//=============================================================================
// Window_StatCompare
//=============================================================================
function Window_StatCompare() {
this.initialize.apply(this, arguments);
}
Window_StatCompare.prototype = Object.create(Window_Base.prototype);
Window_StatCompare.prototype.constructor = Window_StatCompare;
Window_StatCompare.prototype.initialize = function(wx, wy, ww, wh) {
Window_Base.prototype.initialize.call(this, wx, wy, ww, wh);
this._actor = null;
this._tempActor = null;
this.refresh();
};
Window_StatCompare.prototype.createWidths = function() {
this._paramNameWidth = 0;
this._paramValueWidth = 0;
this._arrowWidth = this.textWidth('\u2192' + ' ');
var buffer = this.textWidth(' ');
for (var i = 0; i < 8; ++i) {
var value1 = this.textWidth(TextManager.param(i));
var value2 = this.textWidth(Yanfly.Util.toGroup(this._actor.paramMax(i)));
this._paramNameWidth = Math.max(value1, this._paramNameWidth);
this._paramValueWidth = Math.max(value2, this._paramValueWidth);
}
this._bonusValueWidth = this._paramValueWidth;
this._bonusValueWidth += this.textWidth('(+)') + buffer;
this._paramNameWidth += buffer;
this._paramValueWidth;
if (this._paramNameWidth + this._paramValueWidth * 2 + this._arrowWidth +
this._bonusValueWidth > this.contents.width) this._bonusValueWidth = 0;
};
Window_StatCompare.prototype.setActor = function(actor) {
if (this._actor === actor) return;
this._actor = actor;
this.createWidths();
this.refresh();
};
Window_StatCompare.prototype.refresh = function() {
this.contents.clear();
if (!this._actor) return;
for (var i = 0; i < 8; ++i) {
this.drawItem(0, this.lineHeight() * i, i);
}
};
Window_StatCompare.prototype.setTempActor = function(tempActor) {
if (this._tempActor === tempActor) return;
this._tempActor = tempActor;
this.refresh();
};
Window_StatCompare.prototype.drawItem = function(x, y, paramId) {
this.drawDarkRect(x, y, this.contents.width, this.lineHeight());
this.drawParamName(y, paramId);
this.drawCurrentParam(y, paramId);
this.drawRightArrow(y);
if (!this._tempActor) return;
this.drawNewParam(y, paramId);
this.drawParamDifference(y, paramId);
};
//Dark Rectangle Controler
Window_StatCompare.prototype.drawDarkRect = function(dx, dy, dw, dh) {
var color = this.systemColor();
this.changePaintOpacity(false);
this.contents.fillRect(dx + 1, dy + 1, dw - 2, dh - 2, color);
this.changePaintOpacity(true);
};
Window_StatCompare.prototype.drawParamName = function(y, paramId) {
var x = this.textPadding();
this.changeTextColor(this.systemColor());
this.drawText(TextManager.param(paramId), x, y, this._paramNameWidth);
};
Window_StatCompare.prototype.drawCurrentParam = function(y, paramId) {
var x = this.contents.width - this.textPadding();
x -= this._paramValueWidth * 2 + this._arrowWidth + this._bonusValueWidth;
this.resetTextColor();
var actorparam = Yanfly.Util.toGroup(this._actor.param(paramId));
this.drawText(actorparam, x, y, this._paramValueWidth, 'right');
};
Window_StatCompare.prototype.drawRightArrow = function(y) {
var x = this.contents.width - this.textPadding();
x -= this._paramValueWidth + this._arrowWidth + this._bonusValueWidth;
var dw = this.textWidth('\u2192' + ' ');
this.changeTextColor(this.systemColor());
this.drawText('\u2192', x, y, dw, 'center');
};
Window_StatCompare.prototype.drawNewParam = function(y, paramId) {
var x = this.contents.width - this.textPadding();
x -= this._paramValueWidth + this._bonusValueWidth;
var newValue = this._tempActor.param(paramId);
var diffvalue = newValue - this._actor.param(paramId);
var actorparam = Yanfly.Util.toGroup(newValue);
this.changeTextColor(this.paramchangeTextColor(diffvalue));
this.drawText(actorparam, x, y, this._paramValueWidth, 'right');
};
Window_StatCompare.prototype.drawParamDifference = function(y, paramId) {
var x = this.contents.width - this.textPadding();
x -= this._bonusValueWidth;
var newValue = this._tempActor.param(paramId);
var diffvalue = newValue - this._actor.param(paramId);
if (diffvalue === 0) return;
var actorparam = Yanfly.Util.toGroup(newValue);
this.changeTextColor(this.paramchangeTextColor(diffvalue));
var text = Yanfly.Util.toGroup(diffvalue);
if (diffvalue > 0) {
text = ' (+' + text + ')';
} else {
text = ' (' + text + ')';
}
this.drawText(text, x, y, this._bonusValueWidth, 'left');
};
I would suspect based on the code given that the pixel font plugin is causing the window to get an incorrect value for this.contents.width, causing the text to get all jumbled up on top of itself. I'm not real sure how you'd fix that, but it'd probably be an issue with the pixel font plugin.

As for hiding the Mdf stat, you can skip it in the function that's drawing the stats by overriding the function
Window_StatCompare.prototype.refresh().

If you look in that function, it does a loop through params 0-7, 0 being hp, 1 being mp, etc. If you add an if statement that skips the function call if the i value is 5, it will not draw the mdf parameter. It'll still leave a blank space in the window, though, unless you also put some math into the bottom half of the function (where it calls drawItem), to subtract a value from y if i is greater than 5.
Note that straight overriding functions is not good for compatibility, so there's a good chance it will cause problems with other plugins that do anything with this window.


Something like the below should fix that for you.
JavaScript:
Window_StatCompare.prototype.refresh = function() {
this.contents.clear();
if (!this._actor) return;
for (var i = 0; i < 8; ++i) {
    if (i == 5) continue
    if (i > 5) {
        this.drawItem(0, this.lineHeight() * (i-1), i);
    } else {
        this.drawItem(0, this.lineHeight() * i, i);
    }
}
};
I would suspect based on the code given that the pixel font plugin is causing the window to get an incorrect value for this.contents.width, causing the text to get all jumbled up on top of itself. I'm not real sure how you'd fix that, but it'd probably be an issue with the pixel font plugin.

As for hiding the Mdf stat, you can skip it in the function that's drawing the stats by overriding the function
Window_StatCompare.prototype.refresh().

If you look in that function, it does a loop through params 0-7, 0 being hp, 1 being mp, etc. If you add an if statement that skips the function call if the i value is 5, it will not draw the mdf parameter. It'll still leave a blank space in the window, though, unless you also put some math into the bottom half of the function (where it calls drawItem), to subtract a value from y if i is greater than 5.
Note that straight overriding functions is not good for compatibility, so there's a good chance it will cause problems with other plugins that do anything with this window.


Something like the below should fix that for you.
JavaScript:
Window_StatCompare.prototype.refresh = function() {
this.contents.clear();
if (!this._actor) return;
for (var i = 0; i < 8; ++i) {
    if (i == 5) continue
    if (i > 5) {
        this.drawItem(0, this.lineHeight() * (i-1), i);
    } else {
        this.drawItem(0, this.lineHeight() * i, i);
    }
}
};

Just tried that code, didn't work, I put it in the right spot, too. It's weird that it didn't work though because that code seems to make perfect sense.
1763920459865.png


Tried something else, what if i set it so that it only reads 4 parameters, might've done something wrong but yeah that didn't work either
1763920715368.png


Next it tried trial and erroring it, just commenting stuff out till something broke and seemed to just break everything, editing out stuff doesn't remove elements like I thought it would it just breaks it completely like pulling out the wrong jenga brick.
1763920887015.png


Thought maybe VSC just sucked so i got notepad++ instead, didn't work either
1763921743046.png


for the moment i'll just go see if i can get some support from the bitmap font dev
((Link to it here BTW if anyone is curious -> https://hakuenstudio.itch.io/eli-bitmap-font-for-rpg-maker))
Just tried that code, didn't work, I put it in the right spot, too. It's weird that it didn't work though because that code seems to make perfect sense.
View attachment 353465

Tried something else, what if i set it so that it only reads 4 parameters, might've done something wrong but yeah that didn't work either
View attachment 353466

Next it tried trial and erroring it, just commenting stuff out till something broke and seemed to just break everything, editing out stuff doesn't remove elements like I thought it would it just breaks it completely like pulling out the wrong jenga brick.
View attachment 353467

Thought maybe VSC just sucked so i got notepad++ instead, didn't work either
View attachment 353468

for the moment i'll just go see if i can get some support from the bitmap font dev
((Link to it here BTW if anyone is curious -> https://hakuenstudio.itch.io/eli-bitmap-font-for-rpg-maker))
If no changes you're making are having any effect, one of three things is going on:
  1. You're editing a plugin file, but the project is using a different copy of it.
  2. You haven't reloaded the game since changing the plugin (that seems unlikely)
  3. Some other plugin is also overriding the same function, and it's ignoring the changes you're making in this plugin.
Add the function to its own file instead of overwriting it in the yanfly plugin, then save it as a .js file, and import it into your plugin manager below all of the other plugins you have, which will ensure that it's not being overwritten by anything else.
If no changes you're making are having any effect, one of three things is going on:
  1. You're editing a plugin file, but the project is using a different copy of it.
  2. You haven't reloaded the game since changing the plugin (that seems unlikely)
  3. Some other plugin is also overriding the same function, and it's ignoring the changes you're making in this plugin.
Add the function to its own file instead of overwriting it in the yanfly plugin, then save it as a .js file, and import it into your plugin manager below all of the other plugins you have, which will ensure that it's not being overwritten by anything else.
1763936993484.png

It was 3, some plugin was overwriting code, don't know which one but I know it was a YEP plugin but it helped regardless thank you so much for your help even if it turned out to be a dumb mistake (and especially thank your for the fix of getting rid of the MDF that was a big help)

Original thread: https://forums.rpgmakerweb.com/threads/solved-issue-relating-to-yep_equipcores-horizontal-positioning-of-the-parameters.181135/