After watching Poryg's JavaScript guide on how to create custom Scenes and Windows, I managed to create a basic Scene that's supposed to allow you to swap between between parties. The Scene is called when selecting the "Change Scenario" command on the menu. So far, I managed to get the commands to show, allow the player to cancel out of the scene, and to scroll to different commands by using the code from the tutorials as a basis.
Unfortunately, I can't manage to allow for the player to actually select them and swap parties. I know I'm supposed to use .setHandler and .bind, but I just can't understand the tutorial for some reason. It's probably something small that I'm missing.
(Also, I can't seem to get commands to only show up if a particular switch is on, but that might be easier to fix)
Code (Without attempting to use .setHandler and .bind):
The Scene:
Unfortunately, I can't manage to allow for the player to actually select them and swap parties. I know I'm supposed to use .setHandler and .bind, but I just can't understand the tutorial for some reason. It's probably something small that I'm missing.
(Also, I can't seem to get commands to only show up if a particular switch is on, but that might be easier to fix)
Code (Without attempting to use .setHandler and .bind):
JavaScript:
function Scene_Tut () {
this.initialize.apply (this, arguments);
}
Scene_Tut.prototype = Object.create(Scene_MenuBase.prototype);
Scene_Tut.prototype.initialize = function () {
Scene_MenuBase.prototype.initialize.call(this);
}
Scene_Tut.prototype.create = function () {
Scene_MenuBase.prototype.create.call(this);
this._tutWindow = new Window_Tut ((Graphics.boxWidth - 600) / 2, 0);
this._tutWindow.select(0);
this._tutWindow.activate();
this.addWindow(this._tutWindow);
}
function Window_Tut() {
this.initialize.apply(this, arguments);
}
Window_Tut.prototype = Object.create(Window_Selectable.prototype);
Window_Tut.prototype.constructor = Window_Tut;
Window_Tut.prototype.initialize = function(x, y) {
var width = this.windowWidth();
var height = this.windowHeight();
Window_Selectable.prototype.initialize.call(this, x, y, width, height);
this.refresh();
};
Scene_Tut.prototype.update = function () {
Scene_MenuBase.prototype.update.call(this);
if (Input.isTriggered("cancel")) this.popScene();
}
Scene_Tut.prototype.command1 = function () {
$gameParty.addActor(1);
$gameParty.addActor(4);
$gameParty.addActor(6);
$gameParty.addActor(7);
$gameParty.removeActor(2);
$gameParty.removeActor(3);
$gamePlayer.reserveTransfer(7, 6, 12, 0, 0);
}
Scene_Tut.prototype.command2 = function () {
$gameParty.addActor(2);
$gameParty.removeActor(1);
$gameParty.removeActor(4);
$gameParty.removeActor(6);
$gameParty.removeActor(7);
$gameParty.removeActor(3);
$gamePlayer.reserveTransfer(9, 5, 12, 0, 0);
}
Scene_Tut.prototype.command3 = function () {
$gameParty.addActor(3);
$gameParty.removeActor(1);
$gameParty.removeActor(4);
$gameParty.removeActor(6);
$gameParty.removeActor(7);
$gameParty.removeActor(2);
$gamePlayer.reserveTransfer(11, 7, 9, 0, 0);
}
Window_Tut.prototype = Object.create (Window_Command.prototype);
Window_Tut.prototype.constructor = Window_Tut;
Window_Tut.prototype.initialize = function (x, y) {
Window_Command.prototype.initialize.call (this, x, y);
this.opacity = 0;
}
Window_Tut.prototype.makeCommandList = function() {
if ($gameSwitches.value(57));
this.addCommand ("Reid", "command1");
if ($gameSwitches.value(58));
this.addCommand ("Priscilla", "command2");
if ($gameSwitches.value(59));
this.addCommand ("Gale", "command3");
};
The Scene: