I need to make it so that when I return to the main menu, the game resets as from the f5 key, in order for some plugins I need to work correctly. Does anyone know how to do this?
Resetting the game when exiting to the main menu?
RPG Maker MV Supporttry saving this as a .js file and loading it as a plugin
Code:
Scene_GameEnd.prototype.commandToTitle = function() {
location.reload()
};
Game_Interpreter.prototype.command354 = function() {
location.reload()
};
Also you may also need to do the same in command354.
However, doing that will bypass any code that would have been executed after the button is clicked.
However, doing that will bypass any code that would have been executed after the button is clicked.
good catch. ill add it
Works like a charm. Thanks for the help, just what I needed!
not sure what this does though.
I have it slightly than this as I added the fadeOut before location.reload() as it is smoother.
because it was the only way to my TitleRewardIcons to work as it should, or it stays
until you press F5 or reboot the game.
I wonder why it isn't default though as I use this way for 6 month as it is better.
Could you please share your code? Cause I can't seem to get it to work.
I come to think about it, you can also return to title from gameover scene.
So maybe put the check in SceneManager.changeScene is better?
So maybe put the check in SceneManager.changeScene is better?
JavaScript:
(function (alias) {
SceneManager.changeScene = function () {
if (this._nextScene instanceof Scene_Title && this.isSceneChanging() && !this.isCurrentSceneBusy()) {
if (
this._scene instanceof Scene_GameEnd ||
this._scene instanceof Scene_Gameover ||
this._scene instanceof Scene_Map
) {
location.reload();
return;
}
}
alias.apply(this, arguments);
};
})(SceneManager.changeScene);
this is my code that I use inside my base plugin.
so it just don't suddly flashes like F5 but fadeOut first before reload.
so it just don't suddly flashes like F5 but fadeOut first before reload.
JavaScript:
//=> Game End (Clear Cache)
Scene_GameEnd.prototype.commandToTitle = function() {
this.fadeOutAll();
location.reload();
};
//=> Game Over (Clear Cache) (same idea as GameEnd)
Scene_Gameover.prototype.gotoTitle = function() {
this.fadeOutAll();
location.reload();
};
Original thread: https://forums.rpgmakerweb.com/threads/resetting-the-game-when-exiting-to-the-main-menu.175381/