Save file erase after Game Over

Hi everyone,

I asked a similar question in the general discussion page, but I thought it might fit better here, so here I go again  😀

Is there any way to erase a save file after/during the Game Over scene? And a way to reduce the save file slots? I only want one, cause there are too many.

Yes, this is for a pretty hard core game, I hope it can be done, cause it will be one of the key features.

Thank you very much for your time!

Here you have the scenes.js file, the game over scene part:

Spoiler
// Scene_Gameover
//
// The scene class of the game over screen.

function Scene_Gameover() {
this.initialize.apply(this, arguments);
}

Scene_Gameover.prototype = Object.create(Scene_Base.prototype);
Scene_Gameover.prototype.constructor = Scene_Gameover;

Scene_Gameover.prototype.initialize = function() {
Scene_Base.prototype.initialize.call(this);
};

Scene_Gameover.prototype.create = function() {
Scene_Base.prototype.create.call(this);
this.playGameoverMusic();
this.createBackground();
};

Scene_Gameover.prototype.start = function() {
Scene_Base.prototype.start.call(this);
this.startFadeIn(this.slowFadeSpeed(), false);
};

Scene_Gameover.prototype.update = function() {
if (this.isActive() && !this.isBusy() && this.isTriggered()) {
this.gotoTitle();
}
Scene_Base.prototype.update.call(this);
};

Scene_Gameover.prototype.stop = function() {
Scene_Base.prototype.stop.call(this);
this.fadeOutAll();
};

Scene_Gameover.prototype.terminate = function() {
Scene_Base.prototype.terminate.call(this);
AudioManager.stopAll();
};

Scene_Gameover.prototype.playGameoverMusic = function() {
AudioManager.stopBgm();
AudioManager.stopBgs();
AudioManager.playMe($dataSystem.gameoverMe);
};

Scene_Gameover.prototype.createBackground = function() {
this._backSprite = new Sprite();
this._backSprite.bitmap = ImageManager.loadSystem('GameOver');
this.addChild(this._backSprite);
};

Scene_Gameover.prototype.isTriggered = function() {
return Input.isTriggered('ok') || TouchInput.isTriggered();
};

Scene_Gameover.prototype.gotoTitle = function() {

SceneManager.goto(Scene_Title);
};
I want to instert there a way to delete safe file number 1 (the only one that exists) maybe using this?

 

 

StorageManager.remove = function(savefileId) {

    if (this.isLocalMode()) {

        this.removeLocalFile(savefileId);

    } else {

        this.removeWebStorage(savefileId);

    }

};

 

Thing is I don't know how to implement it, I'm sure it's not dificult, it's just that my JavaScript knowledge is very very minimal. If anyone knows the answer, help me please,

it would be life giving  🙂
The save file number can be limited either in the rpg_manager.js

(this snippet)

DataManager.maxSavefiles = function() {    return 20;};or with Double X's RMMV Constants editor (can't find it right now, but it includes that and other things)
Thank you ver much! I will edit it now.

As for the other part, anyone knows hot to erase a save file upon game over? I've tried myself but can't figure it out... It should be some line of code around the scenes.js, but I don't know how

to write that in JavaScript.
I'm not a scripter, but I keep trying to do something in the codes, so... this is what I (think that I) know:

There is not a way. You can delete the file via "SotrageManager", but its info stays registered in the global.rpgsave file until you erase it. It's the way the game recognizes if you have a save file. It will say that you have this save not by locating the file in the folder, but with this register. And if you try to load this file after it, you will get an error.


I think that you might, after deleting the fisical file, delete its info from the global.rpgsave, doing something that I don't know yet what in the "DataManager.makesavefileinfo" line of rpg_managers.... If you discover how to do it, will help too.

Man, forget what I said... just write StorageManager.(fileId) and it will delete the file and all its info. Sorry.
Where do I write that? I've been trying to use it but I don't figure out where exactly T.T
/ Scene_Gameover//// The scene class of the game over screen.function Scene_Gameover() {this.initialize.apply(this, arguments);}Scene_Gameover.prototype = Object.create(Scene_Base.prototype);Scene_Gameover.prototype.constructor = Scene_Gameover;Scene_Gameover.prototype.initialize = function() {Scene_Base.prototype.initialize.call(this);};Scene_Gameover.prototype.create = function() {Scene_Base.prototype.create.call(this);>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>INSERT HERE<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<this.playGameoverMusic();this.createBackground();};Scene_Gameover.prototype.start = function() {Scene_Base.prototype.start.call(this);this.startFadeIn(this.slowFadeSpeed(), false);};Scene_Gameover.prototype.update = function() {if (this.isActive() && !this.isBusy() && this.isTriggered()) {this.gotoTitle();}Scene_Base.prototype.update.call(this);};Scene_Gameover.prototype.stop = function() {Scene_Base.prototype.stop.call(this);this.fadeOutAll();};Scene_Gameover.prototype.terminate = function() {Scene_Base.prototype.terminate.call(this);AudioManager.stopAll();};Scene_Gameover.prototype.playGameoverMusic = function() {AudioManager.stopBgm();AudioManager.stopBgs();AudioManager.playMe($dataSystem.gameoverMe);};Scene_Gameover.prototype.createBackground = function() {this._backSprite = new Sprite();this._backSprite.bitmap = ImageManager.loadSystem('GameOver');this.addChild(this._backSprite);};Scene_Gameover.prototype.isTriggered = function() {return Input.isTriggered('ok') || TouchInput.isTriggered();};Scene_Gameover.prototype.gotoTitle = function() {SceneManager.goto(Scene_Title);};This shall make this line look like this:

Scene_Gameover.prototype.create = function() {Scene_Base.prototype.create.call(this);StorageManager.remove(1) // HERE! ;]this.playGameoverMusic();this.createBackground();};Everytime the Game Over Scene is called, it has to play the music. So, if you put the command right before the music starts, you will have the desired effect. By the power of the - like we say here arround my country - "gambiarra". haha

I think it should work... :/

If not, I will test something before trying to help again hehe
You sir, are the most AMAZING person in the WHOLE world!

It works like a charm  BD

Thank you, thank you, thank you!

Original thread: https://forums.rpgmakerweb.com/threads/save-file-erase-after-game-over.50718/