For future reference: wanted to share a solution that worked for me. I also have a custom title screen and
setupNewGame threw some errors in my case.
So basically, I'm resetting the party, switches, variables and self switches in a script call:
JavaScript:
// Clear Party
$gameParty._actors = [];
$gameParty._gold = 0;
$gameParty.initAllItems();
// Clear Variables & Switches
$gameSwitches.clear();
$gameVariables.clear();
$gameSelfSwitches.clear();
Note that
setupNewGame does a lot of this, but it also does other things that can cause some plugins to crash (which is what happened in my case). Not using
setupNewGame also means the player won't automatically transfer to the start location, and instead you can transfer them wherever you want.
It's generally not recommended to mess with
._actors directly, but right after this I am re-adding my main character (initialized).
By the way: Gold is clamped between 0 and 99999999, so instead of
._gold = 0 you can just use the "change gold" event button and reduce 99999999 gold.
If you want to know what else is being reset in a new game, here's the Party initialization code:
JavaScript:
Game_Party.prototype.initialize = function() {
Game_Unit.prototype.initialize.call(this);
this._gold = 0;
this._steps = 0;
this._lastItem = new Game_Item();
this._menuActorId = 0;
this._targetActorId = 0;
this._actors = [];
this.initAllItems();
};
Game_Party.prototype.initAllItems = function() {
this._items = {};
this._weapons = {};
this._armors = {};
};
And here's the
setupNewGame code:
JavaScript:
DataManager.setupNewGame = function() {
this.createGameObjects();
this.selectSavefileForNewGame();
$gameParty.setupStartingMembers();
$gamePlayer.reserveTransfer($dataSystem.startMapId,
$dataSystem.startX, $dataSystem.startY);
Graphics.frameCount = 0;
};
DataManager.createGameObjects = function() {
$gameTemp = new Game_Temp();
$gameSystem = new Game_System();
$gameScreen = new Game_Screen();
$gameTimer = new Game_Timer();
$gameMessage = new Game_Message();
$gameSwitches = new Game_Switches();
$gameVariables = new Game_Variables();
$gameSelfSwitches = new Game_SelfSwitches();
$gameActors = new Game_Actors();
$gameParty = new Game_Party();
$gameTroop = new Game_Troop();
$gameMap = new Game_Map();
$gamePlayer = new Game_Player();
};