- Joined
- Aug 15, 2013
- Messages
- 72
- Reaction score
- 32
- First Language
- English
- Primarily Uses
- RMMV
Hello all!
TL-DR - I'm looking to have an unselectable "Header" inside of a Window_Command subclass.
I'm working on a custom quest system in the game. I've written a script to populate some quest data, and now I'm writing the code to show the quests the player can currently go on. I would like to split this list out into two separate lists. At the top will be the active quests. At the bottom will be the completed quests. Above the active quests, I'm looking to add an "Active Quests" header: I hope to make this text either bigger than the selectable texts, or at least a different colour. Does anyone know how to go about doing something like this? I've attached my code at the bottom
(please don't judge the formatting too harshly, it's horrible - I'm a c++ developer who's only about 10 development hours into Javascript!)
TL-DR - I'm looking to have an unselectable "Header" inside of a Window_Command subclass.
I'm working on a custom quest system in the game. I've written a script to populate some quest data, and now I'm writing the code to show the quests the player can currently go on. I would like to split this list out into two separate lists. At the top will be the active quests. At the bottom will be the completed quests. Above the active quests, I'm looking to add an "Active Quests" header: I hope to make this text either bigger than the selectable texts, or at least a different colour. Does anyone know how to go about doing something like this? I've attached my code at the bottom
(please don't judge the formatting too harshly, it's horrible - I'm a c++ developer who's only about 10 development hours into Javascript!)
Code:
//-----------------------------------------------------------------------------
// Window_MenuQuestList
//
// The window for selecting a quest and travelling.
function Window_MenuQuestList() {
this.initialize.apply(this, arguments);
}
Window_MenuQuestList.prototype = Object.create(Window_Command.prototype);
Window_MenuQuestList.prototype.constructor = Window_MenuQuestList;
Window_MenuQuestList.prototype.initialize = function (x, y) {
Window_Command.prototype.initialize.call(this, x, y);
this.selectLast();
this._previousIndex = -10; // set this to something that index() will never be set to
};
Window_MenuQuestList._lastCommandSymbol = null;
Window_MenuQuestList.initCommandPosition = function () {
this._lastCommandSymbol = null;
};
Window_MenuQuestList.prototype.windowWidth = function () {
return 240;
};
Window_MenuQuestList.prototype.windowHeight = function () {
return Graphics.boxHeight;
};
Window_MenuQuestList.prototype.numVisibleRows = function () {
return this.maxItems();
};
Window_MenuQuestList.prototype.update = function () {
Window_Command.prototype.update.call(this);
if (this.index() != this._previousIndex) {
this._previousIndex = this.index();
var key = this._questKeyArray[this.index()];
this._helpWindow._text = $gamePlayer._questInformation[key]["description"];
this._helpWindow.refresh();
}
console.log(this.index());
};
Window_MenuQuestList.prototype.makeCommandList = function () {
this.addMainCommands();
};
Window_MenuQuestList.prototype.addMainCommands = function () {
var questArray = $gamePlayer._questInformation;
this._questKeyArray = {};
var index = 0;
// TODO: Insert "Active Quests" Header here
for (var key in questArray) {
var value = questArray[key];
if (value["unlocked"] === true) {
this.addCommand(value["title"], undefined, true, undefined);
this._questKeyArray[index] = key;
index = index + 1;
}
}
// TODO: Show Completed Quests Here
};
Window_MenuQuestList.prototype.processOk = function () {
Window_MenuQuestList._lastCommandSymbol = this.currentSymbol();
Window_Command.prototype.processOk.call(this);
};
Window_MenuQuestList.prototype.selectLast = function () {
this.selectSymbol(Window_MenuQuestList._lastCommandSymbol);
};



