Hi everyone,
I was working on a way to switch actors during battle by manipulating the default javascript files, and actually managed to make it work.
However, when I open the window to select the actor who will replace the one battling, I still have the "ActorCommandWindow" focused and selected WHILE I'm choosing an actor on the second window.
Here is the screenshot :
http://puu.sh/v2axY/58ee5f4c6c.jpg
I can both choose an action (attack, use magic, etc.) and swap characters.
I simply copied/pasted another existing command, and replaced the variables inside by a new "SwitchActorWindow". The method activate() correctly give focus of the new window, but it's somehow not losing focus of "ActorCommandWindow".
I do am missing something, but I have no idea if it's about a "battle command list" I haven't noticed or something similar, maybe a specific method I haven't called.
I'm using the default Window_MenuActor, and using it the same way as in using an item or a skill on a teammate from the menu.
Just ask if you need any bits of additionnal info to help me fix this issue.
P.S. : I believe a sample of the script would prove to be helpful :
I was working on a way to switch actors during battle by manipulating the default javascript files, and actually managed to make it work.
However, when I open the window to select the actor who will replace the one battling, I still have the "ActorCommandWindow" focused and selected WHILE I'm choosing an actor on the second window.
Here is the screenshot :
http://puu.sh/v2axY/58ee5f4c6c.jpg
I can both choose an action (attack, use magic, etc.) and swap characters.
I simply copied/pasted another existing command, and replaced the variables inside by a new "SwitchActorWindow". The method activate() correctly give focus of the new window, but it's somehow not losing focus of "ActorCommandWindow".
I do am missing something, but I have no idea if it's about a "battle command list" I haven't noticed or something similar, maybe a specific method I haven't called.
I'm using the default Window_MenuActor, and using it the same way as in using an item or a skill on a teammate from the menu.
Just ask if you need any bits of additionnal info to help me fix this issue.
P.S. : I believe a sample of the script would prove to be helpful :
Code:
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();
//kohl - Adding battle command "switch"
this.createSwitchActorWindow();
};
Code:
Scene_Battle.prototype.createActorCommandWindow = function() {
this._actorCommandWindow = new Window_ActorCommand();
this._actorCommandWindow.setHandler('attack', this.commandAttack.bind(this));
this._actorCommandWindow.setHandler('skill', this.commandSkill.bind(this));
this._actorCommandWindow.setHandler('guard', this.commandGuard.bind(this));
this._actorCommandWindow.setHandler('item', this.commandItem.bind(this));
//kohl - Adding battle command "switch"
this._actorCommandWindow.setHandler('switch', this.commandSwitch.bind(this));
this._actorCommandWindow.setHandler('cancel', this.selectPreviousCommand.bind(this));
this.addWindow(this._actorCommandWindow);
};
Code:
//kohl - Adding battle command "switch"
Scene_Battle.prototype.createSwitchActorWindow = function() {
this._switchActorWindow = new Window_MenuActor();
this._switchActorWindow.setHandler('ok', this.onSwitchOk.bind(this));
this._switchActorWindow.setHandler('cancel', this.onSwitchCancel.bind(this));
this.addWindow(this._switchActorWindow);
};
Code:
//kohl - Adding battle command "switch"
Scene_Battle.prototype.commandSwitch = function() {
this._switchActorWindow.refresh();
this._switchActorWindow.setFormationMode(false);
this._switchActorWindow.selectLast();
this._switchActorWindow.show();
this._switchActorWindow.activate();
};
Code:
//kohl - Adding battle command "switch"
Scene_Battle.prototype.onSwitchOk = function() {
var index = BattleManager._actorIndex;
var pendingIndex = this._switchActorWindow.index();
if (index === pendingIndex) {
SoundManager.playBuzzer();
} else if (pendingIndex < 4) {
SoundManager.playBuzzer();
} else {
$gameParty.swapOrder(index, pendingIndex);
this._switchActorWindow.hide();
this.updateStatusWindow();
this._actorCommandWindow.activate();
}
};
Scene_Battle.prototype.onSwitchCancel = function() {
this._switchActorWindow.hide();
this._switchActorWindow.deselect();
this._actorCommandWindow.activate();
};