RMMV Listing Skills or Items from Top to Bottom (instead Left to Right) in Window with 2+ Columns

MikeMakes

Veteran
Veteran
Joined
Sep 30, 2015
Messages
215
Reaction score
50
First Language
English
Primarily Uses
Hi,

How do I go about listing window items from top to bottom, left to right instead of left to right, top to bottom? This is for windows with 2 or more columns

Also looking for an option to lock scrolling in left/right in certain cases.

//-----------------------------------------------------------------------------
// Window_SkillList
//
// The window for selecting a skill on the skill screen.

function Window_SkillList() {
this.initialize.apply(this, arguments);
}

Window_SkillList.prototype = Object.create(Window_Selectable.prototype);
Window_SkillList.prototype.constructor = Window_SkillList;

Window_SkillList.prototype.initialize = function(x, y, width, height) {
Window_Selectable.prototype.initialize.call(this, x, y, width, height);
this._actor = null;
this._stypeId = 0;
this._data = [];
};

Window_SkillList.prototype.setActor = function(actor) {
if (this._actor !== actor) {
this._actor = actor;
this.refresh();
this.resetScroll();
}
};

Window_SkillList.prototype.setStypeId = function(stypeId) {
if (this._stypeId !== stypeId) {
this._stypeId = stypeId;
this.refresh();
this.resetScroll();
}
};

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

Window_SkillList.prototype.spacing = function() {
return 48;
};

Window_SkillList.prototype.maxItems = function() {
return this._data ? this._data.length : 1;
};

Window_SkillList.prototype.item = function() {
return this._data && this.index() >= 0 ? this._data[this.index()] : null;
};

Window_SkillList.prototype.isCurrentItemEnabled = function() {
return this.isEnabled(this._data[this.index()]);
};

Window_SkillList.prototype.includes = function(item) {
return item && item.stypeId === this._stypeId;
};

Window_SkillList.prototype.isEnabled = function(item) {
return this._actor && this._actor.canUse(item);
};

Window_SkillList.prototype.makeItemList = function() {
if (this._actor) {
this._data = this._actor.skills().filter(function(item) {
return this.includes(item);
}, this);
} else {
this._data = [];
}
};

Window_SkillList.prototype.selectLast = function() {
var skill;
if ($gameParty.inBattle()) {
skill = this._actor.lastBattleSkill();
} else {
skill = this._actor.lastMenuSkill();
}
var index = this._data.indexOf(skill);
this.select(index >= 0 ? index : 0);
};

Window_SkillList.prototype.drawItem = function(index) {
var skill = this._data[index];
if (skill) {
var costWidth = this.costWidth();
var rect = this.itemRect(index);
rect.width -= this.textPadding();
this.changePaintOpacity(this.isEnabled(skill));
this.drawItemName(skill, rect.x, rect.y, rect.width - costWidth);
this.drawSkillCost(skill, rect.x, rect.y, rect.width);
this.changePaintOpacity(1);
}
};

Window_SkillList.prototype.costWidth = function() {
return this.textWidth('000');
};

Window_SkillList.prototype.drawSkillCost = function(skill, x, y, width) {
if (this._actor.skillTpCost(skill) > 0) {
this.changeTextColor(this.tpCostColor());
this.drawText(this._actor.skillTpCost(skill), x, y, width, 'right');
} else if (this._actor.skillMpCost(skill) > 0) {
this.changeTextColor(this.mpCostColor());
this.drawText(this._actor.skillMpCost(skill), x, y, width, 'right');
}
};

Window_SkillList.prototype.updateHelp = function() {
this.setHelpWindowItem(this.item());
};

Window_SkillList.prototype.refresh = function() {
this.makeItemList();
this.createContents();
this.drawAllItems();
};
 
Last edited:

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
6,114
Reaction score
5,859
First Language
English
Primarily Uses
RMVXA
Moved this topic to Learning JavaScript. (Plugin Support is for issues using a specific plugin.)
 

NotADev

Villager
Member
Joined
Jul 4, 2020
Messages
13
Reaction score
9
First Language
English
Primarily Uses
RMMV
Window_SkillList inherits its behaviour from Window_Selectable. In there you'll find the itemRect function which dictates where the items in a window will be drawn (the function is called for each item in the window.) Look at how that function chooses the x and y position of each item and try to adjust to your liking. It will involve a bit of math.

You'll also need to look at the functions cursorDown, cursorUp, cursorRight, and cursorLeft. These look at the number of items and columns in the window to decide how the cursor is moved. Again, you'll have to use some math to calculate the proper movement.

It would be a good idea to overwrite these functions in the window you want to change so you don't end up changing the logic for all windows that inherit from Window_Selectable.
 

Latest Threads

Latest Posts

Latest Profile Posts

Another thumb update. The nail is beginning to break away, along with the aforementioned hard and blackened dead skin. The final join has regained some of its flexibility, tho it's a bit stiff after being held still for so long. The very tip of my thumb has a strange dry and somewhat tingly feeling to it when I touch it to something, but at least it isn't numb. I am so ready for this to be over. :o
Can I get away with calling a "shortsword" a dagger and not a sword?
So here's the full cycles, I'm not so familiar with actually animating and giving motion so any observation on that matter would be really helpful! :kaoswt:
EfGHbLh.gif

Just now I realized I didn't scale it up so its smol...
I wanna make a YouTube video about reviewing a game, but I don't know what RPG Maker game I should play...

Forum statistics

Threads
118,705
Messages
1,118,058
Members
155,835
Latest member
dracodfs
Top