Adaptable Skills Window in Battle

Hello to all of you,

I am trying to create a skills window in battle with one column (instead of the standard two) and with a height depending on the number of skills the user have.

So I created this little .js

Window_SkillList.prototype.maxCols = function() {
return 1;
};

Window_SkillList.prototype.windowHeight = function() {
return this.maxItems()*70;
};

It worked for the number of colums but not for the height. My knowledge is quite limited so can you help me make this .js work ?

Thanks 🙂
The Window Height function gets called once the window is initialized (meaning when it is created). When initialized, it has no actor set in it by default, meaning maxItems doesn't return the number of skills.

The solution to your problem is to modify the window height (and y position I suppose) each time it sets an actor. Don't forget that there is only one window skill for every actor in battle, so of course the number of skills is going to vary each time, meaning different height (and y?). I believe it can be achieve inside the Window_SkillList.prototype.setActor function:
Code:
Window_SkillList.prototype.setActor = function(actor) {
    if (this._actor !== actor) {
        this._actor = actor;
        this.refresh();
        this.resetScroll();
        this.setNewHeight(); // Be sure to make the change after it sets the new actor.
    }
};

Window_SkillList.prototype.setNewHeight = function() {
    this.height = 36 + this.maxItems() * 36;
    // y position adjustment?
}

Also a line is by default 36 pixels, and you need to add the default padding (portion of the window with no content) which is 36. So to have the exact height for the number of skills, the formula would be: return (36 + this.maxItems() * 36);

EDIT: I haven't tested the code. Also, I never used the default battle since I also create from scratch my own battle plugins. So this is all based on a quick glance at the default code of RPG Maker, not on experience and knowledge of the default battle lol.
Thanks for your reply !

I quickly try your code and it partially worked. The size of the skills windows varied but not like I wanted. For my 1st character, it was only 36 pixels. For my second one, it was 36 x 5. They both have 3 skills...

Furthermore, I have two skills types for each character. Taking account of the fact there is only one window skill for every actor in battle, like you said, I think it will be very difficult to create 2 different skills windows per character 🙁

At this point, I see 2 problems : why the windows size do not vary as expected ? Is the creation of two adaptable skills windows too difficult to code ?

Original thread: https://forums.rpgmakerweb.com/threads/adaptable-skills-window-in-battle.103351/