As the name says, I want my game to save in the first slot when choosing the option of the menu that brings you back to the title. It's simple but really specific. I searched for many but they also made it so that it auto saves when crashes happen or similar. Which is good but since I am using some plugins that change battles a lot, it might cause problems if the player exits the game early. Anyways hope anyone can help me with this. Thank you!
MV I want to autosave when exiting the game
JS Plugin Requestsif the existing autosave plugins have compatibility problems, then you should list the compatibility problems because otherwise no programmer will be able to program something compatible - they don't have a crystal ball to read your mind.
I think you understood it wrong or maybe there was a confusion. It's not that they aren't compatible, but that with the way battles are handled, it might save in part that I don't want. It's a srpg using the actual map as the battlefield. As such if it crashes in battle for whatever reason and it auto saves then I will have problems.
What I only want is 1 simple plugin for saving when the menu option of "shutdown, to title" is selected. I tried myself but I admit I am not good at coding. But yeah I only need that, nothing else.
closing can also be from the "X" button in window mode, but it's doable
what you want.
the best way is to change how "game end" works and the X button in window mode.
but it require a plugin for this to work.
what you want.
the best way is to change how "game end" works and the X button in window mode.
but it require a plugin for this to work.
I am on phone right now, I tried it by myself and I could show u the code of the plugin for you all to correct me, but I am at work rn so it might take some time for me to send.
Tho I will say this gives me hope is doable, thanks!
I can do the game end part, but I cannot do the nwjs part atm as it needs
a bit different when the X is clicked, but there is a confirmation plugin
when you press X or try to exit the so through the confirmation, you can
save the game if it isn't done yet.
there are also auto save plugin which could be used to call those as well.
I just dont have the time to find them atm.
a bit different when the X is clicked, but there is a confirmation plugin
when you press X or try to exit the so through the confirmation, you can
save the game if it isn't done yet.
there are also auto save plugin which could be used to call those as well.
I just dont have the time to find them atm.
As long as the game end one works that's a big help for me. I would really appreciate. And I understand if u are busy, am texting at work atm which I shouldn't do XD
The X confirmation I think is optional so no worries on that
Take ur time, thanks!
So, do you already have some mechanism for autosaving implemented and just need to trigger it when exiting the game?
If so, if your function is called
When closing the game through the X button or otherwise force-closing it (note that this is not 100% reliable):
If you don't already have that, it'd probably be easiest to find a plugin that provides a script call or plugin command that triggers an autosave, and use that.
If so, if your function is called
autosave(), you can call it when exiting the game normally (the scene where the player needs to confirm whether or not to exit) like so:
JavaScript:
void ((alias) => {
Window_GameEnd.prototype.initialize = function() {
alias.call(this);
autosave();
}
})(Window_GameEnd.prototype.initialize);
When closing the game through the X button or otherwise force-closing it (note that this is not 100% reliable):
JavaScript:
window.onunload = () => {
autosave();
};
If you don't already have that, it'd probably be easiest to find a plugin that provides a script call or plugin command that triggers an autosave, and use that.
I don't have a function, but I do have a script that I found online that autosaves. I could make it a function.
I am new to this to do it alone, but I could send the script here once I get a hold of it. I was gonna send some code for reference yesterday but I arrived home at like 11pm due to personal stuff.
I will see if maybe I have it on my phone or I can send it once I get home
Maybe force an autosave after each combat to slot 1 to use as your main load. Add a "recovery" option to the save menu, to restore from an old restoration point. This restoration save slot could create itself after major events, at towns, or maybe every 10 minutes if not in combat.
Found where the original script is!
Autosave, Autoload with script only?
What's up, so I just want to create an event where I can autosave when I touch an specific event (without entering the Menu/Save window, because it'll be disabled), like a checkpoint. Same with autoload, at the beginning of the game you pick one of the options, then it loads that file and every...
forums.rpgmakerweb.com
This is the auto save script I am using. How would I go about making it a function and trigger the function in game end?
Do I just make a plugin where I define the function first and then put the "game end" code?
You could add something like this (the order of that and the earlier script doesn't matter):
JavaScript:
autosave = function (){
$gameSystem.onBeforeSave();
if(DataManager.saveGame(1)) {
StorageManager.cleanBackup(1);
}
}
Or just add it directly to the script from earlier if you only want it to happen when exiting:
JavaScript:
void ((alias) => {
Window_GameEnd.prototype.initialize = function() {
alias.call(this);
$gameSystem.onBeforeSave();
if(DataManager.saveGame(1)) {
StorageManager.cleanBackup(1);
}
}
})(Window_GameEnd.prototype.initialize);
Tysm! Once I arrive home Imma test it and I will let you know
Update: it works!!! Thank you so much! I decided to use the second code since I don't really need a function atm. Thank you all for the support!
@lcj271 he means more like this way if you want it shorter and re-useable.
this function can than also be used in other ways in the same @caethyril mentioned.
and there are more you can use it so you avoid using the same code over and over,
saving 3-4 lines per function and just call 1 as it exist.
another way using this as plugin is you can use "autosave()" inside the game
anytime you like too (interact with npc or after opening a chest.
so it have multiple purposes ^^
but use what you find most comfortable way you like.
this function can than also be used in other ways in the same @caethyril mentioned.
and there are more you can use it so you avoid using the same code over and over,
saving 3-4 lines per function and just call 1 as it exist.
another way using this as plugin is you can use "autosave()" inside the game
anytime you like too (interact with npc or after opening a chest.
so it have multiple purposes ^^
but use what you find most comfortable way you like.
JavaScript:
autosave = function (){
$gameSystem.onBeforeSave();
if(DataManager.saveGame(1)) {
StorageManager.cleanBackup(1);
}
}
void ((alias) => {
Window_GameEnd.prototype.initialize = function() {
alias.call(this);
autosave();
}
})(Window_GameEnd.prototype.initialize);
Original thread: https://forums.rpgmakerweb.com/threads/i-want-to-autosave-when-exiting-the-game.167402/