RPG Maker Forums

So I'm using @SomeFire's skill tree plugin in addition to Yanfly's Job Points plugin so that I have both JP & SP as a resource for the player. I was able to get the SP to show up on another line underneath JP on the character menu but SP isn't aligned to the right edge like JP is. For JP, the text and icon ill always hug the right side with a certain amount of padding so when the number in front of the icon changes, the position of the icon stays the same. However, this doesn't happen with SP. When the number in front of the SP icon changes, the position of the icon also changes depending on the width of the text (numbers in front of the icon).
Screenshot:
1594513157265.png

Notice how the position of the JP icon remains the same whether the number in front is "11" or "15". However, this is not the case for SP. From what I can tell, the code is using the width of the text for JP as a basis for its position. (i.e. wx += ww - this.textWidthEx(text);)
JavaScript:
Window_Base.prototype.drawActorJp = function(actor, id, wx, wy, ww, align) {
    var jp = actor.jp(id);
    var icon = '\\i[' + Yanfly.Icon.Jp + ']';
    var fmt = Yanfly.Param.JpMenuFormat;
    var sp = actor.getTreesPoints(skillTree); //Gets actor's available Skill Points
    var text = fmt.format(Yanfly.Util.toGroup(jp), Yanfly.Param.Jp, icon);
    if (align === 'left') {
      wx = 0;
    } else if (align === 'center') {
      wx += (ww - this.textWidthEx(text)) / 2;
    } else {
      wx += ww - this.textWidthEx(text);
    }
    this.drawTextEx(text, wx, wy);
    this.drawTextEx(sp + '\\i[157]', ww - this.textWidthEx(text), wy + 32); //Shows Skill Points
};
The issue lies in here: ww - this.textWidthEx(text) which I used in the last line of code. The "text" inside the parenthesis refers to fmt.format(Yanfly.Util.toGroup(jp), Yanfly.Param.Jp, icon); which returns a string if I'm not mistaken. It contains both the JP icon as well as the number representing the quantity that goes in front of it.

Perhaps I need to create something similar for SP, but I don't know how to. Instead, I created a var sp that returns the number of Skill Points. Then I had it draw the icon separately.

I tried using this.drawTextEx(sp + '\\i[157]', ww - this.textWidthEx(sp), wy + 32); instead, but it threw an error...

Substituting ww - this.textWidthEx(text) with wx also doesn't align it correctly since that references the text width of JP instead of SP as well.

Basically, I need it to use the text width of SP instead of JP as a basis for its position. Any solutions? Thx in advance!

Note: My use of Galv_BustMenu should have no effect on this since the issue is present with the default menu setup as well.

Edit: I'm guessing the reason for the error when I tried this.textWidthEx(text)->this.textWidthEx(sp) was because the contents inside the parenthesis has to be a string?

I did just try making it into a string but the result was both lines becoming blank (nothing gets drawn)...

Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,038
Messages
1,018,466
Members
137,821
Latest member
Capterson
Top