This is my first plugin so forgive me if this is a stupid question. I am modifying the battle scene so that when you press 'Attack' it pops up with a third selection window that has a 4 choices in it. Thing is when I call .close() after a choice is selected, the window simply does not close. Interestingly enough my Prompt Window closes when I call .close() but not my custom class window that extends Window command. Anyone see any issues with the plugin. Now granted I could use .hide() and that does work but I like the window closing animation and .hide() seems to just erase it without an animation. I marked the line giving me trouble.
.
.
//=============================================================================
// Test.js
//=============================================================================
/*:
* @plugindesc A test plugin
* @author Prismskey
*
* @help ---
*/
function Window_answer() {
this.initialize.apply(this, arguments);
}
(function() {
Scene_Battle.prototype.onEnemyOk = function() {
var action = BattleManager.inputtingAction();
action.setTarget(this._enemyWindow.enemyIndex());
this._enemyWindow.hide();
this._skillWindow.hide();
this._itemWindow.hide();
if(action.isAttack()) {
this.changeInputWindow();
} else {
this.selectNextCommand();
}
}
BattleManager.previousActor = function() {
return this._actorIndex >= 1 ? $gameParty.members()[this._actorIndex - 1] : this.actor();
};
Scene_Battle.prototype.changeInputWindow = function() {
if (BattleManager.isInputting()) {
if (BattleManager.actor()) {
if(BattleManager.actor().inputtingAction().isAttack()) {
this.startAttackanswers();
} else {
this.startActorCommandSelection();
}
} else {
this.startPartyCommandSelection();
}
} else {
this.endCommandSelection();
}
};
Scene_Battle.prototype.startAttackanswers = function() {
this._partyCommandWindow.close();
this._actorCommandWindow.close();
this._statusWindow.hide();
this._answerWindow.setup();
this._answerWindow._promptWindow.show();
this._answerWindow._promptWindow.activate();
};
Scene_Battle.prototype.createAllWindows = function() {
this.createLogWindow();
this.createStatusWindow();
this.createPartyCommandWindow();
this.createActorCommandWindow();
this.createHelpWindow();
this.createSkillWindow();
this.createItemWindow();
this.createActorWindow();
this.createEnemyWindow();
this.createMessageWindow();
this.createScrollTextWindow();
this.createAnswerWindow();
this.createPromptWindow();
};
Scene_Battle.prototype.createPromptWindow = function() {
this._answerWindow._promptWindow = new Window_Help();
this._answerWindow._promptWindow.setText("test");
var height = 75;
var width = 300;
var x = Graphics.boxWidth/2 - width/2;
var y = Graphics.boxHeight - this._answerWindow.windowHeight() - 75;
this._answerWindow._promptWindow.move(x, y, width, height);
this.addWindow(this._answerWindow._promptWindow);
this._answerWindow._promptWindow.hide();
this._answerWindow._promptWindow.deactivate();
}
Scene_Battle.prototype.createAnswerWindow = function() {
this._answerWindow = new Window_answer();
this._answerWindow.setHandler('a', this.selectAnswerA.bind(this));
this._answerWindow.setHandler('b', this.commandSkill.bind(this));
this._answerWindow.setHandler('c', this.commandGuard.bind(this));
this._answerWindow.setHandler('d', this.commandItem.bind(this));
//this._answerWindow.setHandler('cancel', this.selectPreviousCommand.bind(this));
this.addWindow(this._answerWindow);
};
Scene_Battle.prototype.selectAnswerA = function() {
this.closeQuestionWindows();
}
Scene_Battle.prototype.closeQuestionWindows = function() {
this._answerWindow._promptWindow.close(); //THIS WORKS
this._answerWindow.close(); // <---THIS DOES NOT
}
Scene_Battle.prototype.isAnyInputWindowActive = function() {
return (this._partyCommandWindow.active ||
this._actorCommandWindow.active ||
this._skillWindow.active ||
this._itemWindow.active ||
this._actorWindow.active ||
this._enemyWindow.active ||
this._answerWindow.active);
};
//this.selectNextCommand();
//-----------------------------------------------------------------------------
// Window_answer
//
// The window for answers
Window_answer.prototype = Object.create(Window_Command.prototype);
Window_answer.prototype.constructor = Window_answer;
Window_answer.prototype.initialize = function() {
var y = Graphics.boxHeight - this.windowHeight();
Window_Command.prototype.initialize.call(this, 0, y);
this.openness = 0;
this.deactivate();
this._actor = null;
};
Window_answer.prototype.windowWidth = function() {
return Graphics.boxWidth;
};
Window_answer.prototype.numVisibleRows = function() {
return 4;
};
Window_answer.prototype.makeCommandList = function() {
this.addCommand('Test1', 'a', true);
this.addCommand('Test2', 'b', true);
this.addCommand('Test3', 'c', true);
this.addCommand('Test4', 'd', true);
console.log(this._list);
console.log(this.currentSymbol());
console.log(this._list[this.index()]);
};
Window_answer.prototype.setup = function(actor) {
this._actor = actor;
this.clearCommandList();
this.makeCommandList();
this.refresh();
this.selectLast();
this.activate();
this.open();
};
Window_answer.prototype.processOk = function() {
if (this._actor) {
if (ConfigManager.commandRemember) {
this._actor.setLastCommandSymbol(this.currentSymbol());
} else {
this._actor.setLastCommandSymbol('');
}
}
Window_Command.prototype.processOk.call(this);
};
Window_answer.prototype.selectLast = function() {
this.select(0);
if (this._actor && ConfigManager.commandRemember) {
var symbol = this._actor.lastCommandSymbol();
this.selectSymbol(symbol);
if (symbol === 'skill') {
var skill = this._actor.lastBattleSkill();
if (skill) {
this.selectExt(skill.stypeId);
}
}
}
};
})();