Great idea but Description says "Add commands and hotkeys to save world data and character data at any given time" However, only the character data is saved, not the world data. Just an fyi for anyone reading this. Could definitely come in handy for some as is.
Would love something like this to make a complete save!
this. my world hasn't saved for 2 days, and I've lost everything I built and put into containers. frustrating. thanks for posting so I knew it was this mod
Found to cause Hang on Logout from Local or Server worlds. The cloud save was not being reached on exit. It would update the cloud only with a Escape & Quit.
I'd like to see some in-game confirmation that this mod is backing up players characters. Currently we are not seeing any indication that anything is happening when we press the hotkey other than the "you must wait longer" message if the key is pressed too soon.
If we have it set to auto save every 3 minutes, can it please say so in the console window when it saves?
When a save is made, a floppy symbol will appear in the upper left corner of the screen. Also, if the save is successful, a large indication of the completion of the save will appear on the screen. In 1.3.0, the save completion is also logged in the BepInEx console.
Saving backup in the standard folder can create issues with Steam Cloud, would be nicer to configure an external saving path, leaving the save folder untouched.
Without your mod installed i would have lost a 40,000 wood longhall castle due to a hoe opening a unfixable sinkhole from a glitched piece of terrain right in the middle of it. Thank you so much.
Thank you for this !! I really needed backups created cuz I've just been copying the whole appdata folder, but forgetting too often and sometimes I lose a lot on a crash. Not to mention that's a pain. and the ability to edit mod makes it so much better!
I had this isue, and 1 backup file didn't help in my case: Died with good loot, took a long time to reach where tombstone was nowhere to be found...
keep original code (mentioning this because had issues removing it):
where game saves current savedata into an .old (backup) file;
added:
it saves into an .bak (backup) file;
keep up to 5 files after that, deletes the older one(s)
I am not experienced how mods works, altho i can modify this part of code easily and keep game clean with only this changed, so I will appreciate if any modders use this code...
code found at: PlayerProfile.SavePlayerToDisk() if (File.Exists(text)){ if (File.Exists(text2)) { File.Delete(text2); } File.Copy(text, string.Concat(new string[] { Utils.GetSaveDataPath(), "/characters/", DateTime.Now.ToString("yyyyMMdd_hhmmss"), "_", this.m_filename, ".fch.bak" })); File.Move(text, text2); } File.Move(text3, text); FileInfo[] files = (from x in newDirectoryInfo(Utils.GetSaveDataPath() + "/characters").GetFiles("*" + this.m_filename + "*.old") orderby x.LastWriteTime descending select x).ToArray<FileInfo>(); ZLog.Log("current number of backups:\n" + files.Length); if (files.Length > 5) { ZLog.Log("deleting backups..."); for (int i = 5; i < files.Length; i++) { ZLog.LogWarning("deleting: " + files[i]); File.Delete(files[i].FullName); } } else { ZLog.Log("Less than 5 backups yet..."); } ZLog.Log("Done!"); return true;
also posted this at reddit: https://www.reddit.com/r/valheim/comments/ll1dy2/server_side_characters/gpfbxj5?utm_source=share&utm_medium=web2x&context=3
14 comments
However, only the character data is saved, not the world data. Just an fyi for anyone reading this. Could definitely come in handy for some as is.
Would love something like this to make a complete save!
If we have it set to auto save every 3 minutes, can it please say so in the console window when it saves?
I will try to figure out how it works.
Thanks for the feedback.
Also, if the save is successful, a large indication of the completion of the save will appear on the screen.
In 1.3.0, the save completion is also logged in the BepInEx console.
Thanks for the feedback.
I really needed backups created cuz I've just been copying the whole appdata folder, but forgetting too often and sometimes I lose a lot on a crash. Not to mention that's a pain.
and the ability to edit mod makes it so much better!
Thank you!
keep original code (mentioning this because had issues removing it):
- where game saves current savedata into an .old (backup) file;
added:I am not experienced how mods works, altho i can modify this part of code easily and keep game clean with only this changed, so I will appreciate if any modders use this code...
code found at: PlayerProfile.SavePlayerToDisk()
if (File.Exists(text)){
if (File.Exists(text2))
{
File.Delete(text2);
}
File.Copy(text, string.Concat(new string[]
{
Utils.GetSaveDataPath(),
"/characters/",
DateTime.Now.ToString("yyyyMMdd_hhmmss"),
"_",
this.m_filename,
".fch.bak"
}));
File.Move(text, text2);
}
File.Move(text3, text);
FileInfo[] files = (from x in newDirectoryInfo(Utils.GetSaveDataPath() + "/characters").GetFiles("*" + this.m_filename + "*.old")
orderby x.LastWriteTime descending
select x).ToArray<FileInfo>();
ZLog.Log("current number of backups:\n" + files.Length);
if (files.Length > 5)
{
ZLog.Log("deleting backups...");
for (int i = 5; i < files.Length; i++)
{
ZLog.LogWarning("deleting: " + files[i]);
File.Delete(files[i].FullName);
}
}
else
{
ZLog.Log("Less than 5 backups yet...");
}
ZLog.Log("Done!");
return true;
also posted this at reddit: https://www.reddit.com/r/valheim/comments/ll1dy2/server_side_characters/gpfbxj5?utm_source=share&utm_medium=web2x&context=3
I would like to implement it when I get some free time.
Please try it out.