hello there.
i have been searching forum but didn't get what i need (or i have no idea what i looking for)
i'am new in coding, i need help on making my own simple quest window. which now result in error.
TypeError text.replace is not function
this is just fine if i put single text, but i want variable 42 to be an array and when i set it's went error.
i can view it just fine in message window using \v[N]. but when open menu to show on my quest window that error comes.
1. please help fix my code and teach me what should i do.
2. i want it to be shown in paragraph, not a single line text, how to do that?
3. i want it only show 3 line text and when i added 4th array, the 1st one gone so it will be shown
thanks for helping~
i have been searching forum but didn't get what i need (or i have no idea what i looking for)
i'am new in coding, i need help on making my own simple quest window. which now result in error.
TypeError text.replace is not function
JavaScript:
(function() {
var _Scene_Menu_create = Scene_Menu.prototype.create;
Scene_Menu.prototype.create = function() {
_Scene_Menu_create.call(this);
this._statusWindow.x = 0;
this._statusWindow.y = 0;
this._commandWindow.x = this._statusWindow.width;
this._goldWindow.x = 0;
this.createQuestWindow();
};
Window_MenuCommand.prototype.maxCols = function() {
return 1;
};
Window_MenuCommand.prototype.numVisibleRows = function() {
return 8;
};
Window_MenuStatus.prototype.windowWidth = function() {
return Graphics.boxWidth / 4;
};
Window_MenuStatus.prototype.windowHeight = function() {
var h1 = this.fittingHeight(1);
var h2 = this.fittingHeight(2);
return Graphics.boxHeight - h1 - h2;
};
Window_MenuStatus.prototype.maxCols = function() {
return 1;
};
Window_MenuStatus.prototype.numVisibleRows = function() {
return 1;
};
Window_MenuStatus.prototype.setActor = function(actor) {
if (this._actor !== actor) {
this._actor = actor;
this.refresh();
}
};
Window_MenuStatus.prototype.drawItemImage = function(index) {
var actor = $gameParty.members()[index];
var rect = this.itemRectForText(index);
var w = Math.min(rect.width, 144);
var h = Math.min(rect.height, 144);
var lineHeight = this.lineHeight();
this.changePaintOpacity(actor.isBattleMember());
this.drawActorFace(actor, rect.x, rect.y + lineHeight * 2.5, w, h);
this.changePaintOpacity(true);
};
Window_MenuStatus.prototype.drawItemStatus = function(index) {
var actor = $gameParty.members()[index];
var rect = this.itemRectForText(index);
var x = rect.x;
var y = rect.y;
var width = rect.width;
var bottom = y + rect.height;
var lineHeight = this.lineHeight();
this.drawActorName(actor, x, y + lineHeight * 0, width);
this.drawActorLevel(actor, x, y + lineHeight * 1, width);
this.drawActorHp(actor, x, y + lineHeight * 7, width);
this.drawActorMp(actor, x, y + lineHeight * 8, width);
this.drawActorIcons(actor, x, bottom - lineHeight * 1, width);
};
var _Window_MenuActor_initialize = Window_MenuActor.prototype.initialize;
Window_MenuActor.prototype.initialize = function() {
_Window_MenuActor_initialize.call(this);
this.y = this.fittingHeight(2);
};
Scene_Menu.prototype.createQuestWindow = function() {
this._questWindow = new Window_Quest(0, 0);
this._questWindow.width = Graphics.boxWidth - (this._commandWindow.width + this._statusWindow.width);
this._questWindow.height = Graphics.boxHeight;
this._questWindow.x = this._commandWindow.width + this._statusWindow.width;
this._questWindow.y = 0;
this.addWindow(this._questWindow);
};
function Window_Quest() {
this.initialize.apply(this, arguments);
}
Window_Quest.prototype = Object.create(Window_Base.prototype);
Window_Quest.prototype.constructor = Window_Quest;
Window_Quest.prototype.initialize = function(x, y) {
var width = this.windowWidth();
var height = this.windowHeight();
Window_Base.prototype.initialize.call(this, x, y, width, height);
this.refresh();
};
Window_Quest.prototype.windowWidth = function() {
return Graphics.boxWidth;
};
Window_Quest.prototype.windowHeight = function() {
return Graphics.boxHeight;
};
Window_Quest.prototype.refresh = function() {
var x = this.textPadding();
var y = this.lineHeight();
var width = this.contents.width - this.textPadding() * 2;
this.contents.clear();
this.drawTextEx("Quest Name", x, y * 0, width);
this.drawTextEx(this.quest1(), x, y * 1, width);
this.drawTextEx("Quest Description", x, y * 3, width);
this.drawTextEx(this.quest2(), x, y * 4, width);
};
Window_Quest.prototype.quest1 = function() {
if ($gameVariables.value(41))
return $gameVariables.value(41);
else
return '???';
};
Window_Quest.prototype.quest2 = function() {
if ($gameVariables.value(42))
return $gameVariables.value(42);
else
return '???';
};
Window_Quest.prototype.open = function() {
this.refresh();
Window_Base.prototype.open.call(this);
};
})();
JavaScript:
$gameVariables.setValue(42, ["First Text", "Second Text", "Third Text"]);
this is just fine if i put single text, but i want variable 42 to be an array and when i set it's went error.
i can view it just fine in message window using \v[N]. but when open menu to show on my quest window that error comes.
1. please help fix my code and teach me what should i do.
2. i want it to be shown in paragraph, not a single line text, how to do that?
3. i want it only show 3 line text and when i added 4th array, the 1st one gone so it will be shown
JavaScript:
Second Text
Third Text
Fourth Text
thanks for helping~