Showing More Than 4 States (Outside of Battle)

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
808
First Language
English
Primarily Uses
RMMV
So I've looked around but haven't been able to find a way to show more than 4 states in the main character menu (not the in-combat status window). I don't want to use that one plugin that makes the states scroll, nor am I willing to scale the state icons smaller. Instead, I'd rather utilize the empty space afforded to me and allow 8 states to show. (I've calculated the width so that it fits exactly 8 icons)...

1594547328370.png

Notice how I have enough space on the bottom row to fit 8 icons, but it only shows 4. I have an event setup to give the party a bunch of states for testing purposes, which is what led me to notice this issue.
 
Last edited:

Wavelength

Edge of Eternity
Global Mod
Joined
Jul 22, 2014
Messages
5,404
Reaction score
4,801
First Language
English
Primarily Uses
RMVXA
Well, you're obviously using some kind of custom Menu Screen plugin (maybe Luna Engine?), so any answer we give you might be overridden by whatever that plugin is doing.

I did find this method in the core JS library which seems to be responsible for drawing an actor's icons on windows:
Code:
Window_Base.prototype.drawActorIcons = function(actor, x, y, width) {
    width = width || 144;
    var icons = actor.allIcons().slice(0, Math.floor(width / Window_Base._iconWidth));
    for (var i = 0; i < icons.length; i++) {
        this.drawIcon(icons[i], x + Window_Base._iconWidth * i, y + 2);
    }
};
Notice in particular this line:
var icons = actor.allIcons().slice(0, Math.floor(width / Window_Base._iconWidth));

This makes me think that it should be taking the "drawable area" width into account when choosing how many icons to draw (I think "slice" returns a subset of an existing array or set of data). It's possible that whatever change you made increased the width of the bar available for icons or something, but didn't actually increase the size of the drawable area as RPG Maker's code is seeing it. It's also possible that whatever change you made was overwritten by whatever plugin you're using.

What you can try is to change that line to something like var icons = actor.allIcons().slice(0, Math.floor(2 * width / Window_Base._iconWidth)); or even hard-code the second value as var icons = actor.allIcons().slice(0, 7); and unless overwriting was the problem, it should allow you to show 8 icons on this actor menu.

HOWEVER, it will also allow 8 icons on other menus, such as battle windows, which might cause it to overflow visually from the window's border. So you'd have to either create a special version of this (I think this would mean copying the method but replacing Window_Base with Window_MenuActor and then making the changes I recommended above but I'm not sure!!), or you'd have to do a check to see whether the window being processed is an instance of the actor status window.
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
808
First Language
English
Primarily Uses
RMMV
Cool, I'll try that. My menu looks that way due to Galv_BustMenu.js, which shouldn't affect how the states are drawn. I'm pretty sure it simply moves the entire "drawable area" of said states. Good thing this is the only place in my game that will use the default state "box". Combat is LTBS, which has its own method for handling state icons. Anyways thx! Brb, testing...

Edit: Omg, thank you so much @Wavelength, that did it!:kaojoy:

1594553543955.png
 
Last edited:

Black Pagan

Veteran
Veteran
Joined
Feb 21, 2017
Messages
295
Reaction score
222
First Language
English
Primarily Uses
RMMV
And here I am worrying about my Characters having 2 State Buffs at the same time.. :)
 

Wavelength

Edge of Eternity
Global Mod
Joined
Jul 22, 2014
Messages
5,404
Reaction score
4,801
First Language
English
Primarily Uses
RMVXA
OK. Glad it worked for you. Just keep in mind that it's a very "hacky" kind of solution, so if you end up with other windows in the future and this plays badly with them, it might be worth redoing the whole thing rather than trying to shoehorn my solution into the new window. :p
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
808
First Language
English
Primarily Uses
RMMV
Lol, I actually think your solution was super elegant. The only other state icon box in my project was suffering from the same issue anyways. Killed 2 birds w/ 1 stone!
 

Wavelength

Edge of Eternity
Global Mod
Joined
Jul 22, 2014
Messages
5,404
Reaction score
4,801
First Language
English
Primarily Uses
RMVXA
That's right, I'm a genius and I knew it was going to be perfect for every window in your game all along!! :2k32:
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
478
Reaction score
210
First Language
English
Primarily Uses
RMMV
I think a better change would have been to replace 144 with 288. Then windows that do explicitly pass a larger width to the function will still work. That said, if you don't have any such windows, then I guess it doesn't matter.
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
808
First Language
English
Primarily Uses
RMMV
I think a better change would have been to replace 144 with 288.
I actually just tried that, but it was still limited to 4 states using that method. Anyways, I went and changed it further to allow for 12 states (3x multiplier) since I had extra room in this window:
States Test.png

However, this means there's a bit of extra in the main menu now:
1594624191378.png

Is there a way I can use a 2x multiplier in the default window (bottom pic) but use a 3x multiplier in the Yanfly windows (top pic)? In the 1st screenshot, drawActorIcons is used in YEP_CoreEngine.js:
JavaScript:
Window_Base.prototype.drawActorSimpleStatus = function(actor, x, y, width) {
    var lineHeight = this.lineHeight();
    var xpad = Window_Base._faceWidth + (2 * Yanfly.Param.TextPadding);
    var x2 = x + xpad;
    var width2 = Math.max(180, width - xpad - this.textPadding());
    this.drawActorName(actor, x, y);
    this.drawActorLevel(actor, x, y + lineHeight * 2);
    this.drawActorIcons(actor, x2, y);
    this.drawActorClass(actor, x, y + lineHeight * 1, width2);
    this.drawActorHp(actor, x2, y + lineHeight * 1, width2);
    this.drawActorMp(actor, x2, y + lineHeight * 2, width2);
    if (Yanfly.Param.MenuTpGauge) {
      this.drawActorTp(actor, x2, y + lineHeight * 3, width2);
    }
};
And here is the code for drawActorIcons in rpg_windows.js:
JavaScript:
Window_Base.prototype.drawActorIcons = function(actor, x, y, width) {
    width = width || 144;
    var icons = actor.allIcons().slice(0, Math.floor(3 * width / Window_Base._iconWidth));
    for (var i = 0; i < icons.length; i++) {
        this.drawIcon(icons[i], x + Window_Base._iconWidth * i, y + 2);
    }
};
Edit: Like, is there any way I can introduce a conditional in the drawActorIcons function so that it used 3x in Yanfly windows and 2x everywhere else?

Edit2: SOLVED! I simply duplicated the drawActionIcons function and called it "drawActionIconsX" and had YEP_CoreEngine use this.drawActorIconsX(actor, x2, y); instead. Now I can give all my passives icons and not worry about them not fitting!
:VXA1:
 
Last edited:

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
478
Reaction score
210
First Language
English
Primarily Uses
RMMV
The fourth argument to drawActorIcons is the width, so why not just pass in the width in drawActorSimpleStatus? Instead of this.drawActorIconsX(actor, x, y), try this.drawActorIcons(actor, x, y, width).
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
808
First Language
English
Primarily Uses
RMMV
The fourth argument to drawActorIcons is the width, so why not just pass in the width in drawActorSimpleStatus? Instead of this.drawActorIconsX(actor, x, y), try this.drawActorIcons(actor, x, y, width).
Seems more efficient than my solution, so I think I'll do that, thx!

Edit: It worked perfectly! Even though my previous method worked just as well, this way saves on code.
^.^
 
Last edited:

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

Latest Threads

Latest Posts

Latest Profile Posts

ESAMarathon on Twitch, now streaming "Eat Girl". Yep, that's the title of a game... Apparently it's a Pacman knockoff.... Which is of course the only logical conclusion one would get from a name like "Eat Girl". :kaopride: I can't believe anybody would think anything else! :kaoback:
Super stoked i just finished my first town in my project, by finished i mean i can always add more decorative aesthetics and the NPCs don't talk yet but the mapping is complete and all the important chess pieces are present!
My brain: Hey, I have an idea how to make the transition to the main story quest in The Wastes more natural!
Me: Good!
My brain: You need to remake the hotel you start out in, it's not realistic enough.
Me: Ok... This was unexpected, but I can do it.
My brain: Now make each hotel floor 5 times as large to match the main part. Oh, you also need to make a bunch of new npcs to fill in the space on these maps.
Me: Crap.
Should be able to release Haxe MV/MZ next weekend.
It look that somehow MZ tracks are messed up (for example battle4 is obviously a theme, castle2 is a ship, ship1 is a scene and so on..). Maybe they just named them after with some ambiguity.

Forum statistics

Threads
100,617
Messages
977,828
Members
132,227
Latest member
YourBaka
Top