Project Zomboid

Project Zomboid

27 ratings
Advanced Death Log
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
810.993 KB
28 Jul, 2024 @ 7:38am
10 Dec, 2024 @ 3:57am
9 Change Notes ( view )

Subscribe to download
Advanced Death Log

Description
I am on an indefinite hiatus from Project Zomboid. Feel free to use my code for future mods, and feel free to update my mods for B42. Please do not reuse their exact names or mod id's to avoid confusion and bugs for B41 players. I can only guarantee my mods worked when used alone before B42 dropped. I will no longer be retesting them when people have conflicts. Thanks for the support over the years.

I happened to notice some interest in improving on Konijima's Death Log, so I decided to take a crack at it. Simply logs player death data in timestamped files in a folder called AdvancedDeathLog, which will be found in the server's default directory for writing files. This data may be useful to admins who need to restore characters who are lost to abnormal circumstances, such as lag. You may optionally duplicate log data to the vanilla Logs folder. This mod can also be used to restore death data to players on a server; you must have admin privileges to do this by default, but sandbox options are available for extending this privilege on small, casual servers among friends.

In both solo and coop mode on Windows, this mod's default folder for writing files is:
%UserProfile%/Zomboid/Lua

In both solo and coop mode on Windows, the vanilla Logs folder is:
%UserProfile%/Zomboid/Logs

What Makes This Version "Advanced"

I have rewritten the mod entirely to be more concise, more importable, more patchable, and more presentable. Options are available for storing logs in customizable folder names for long-term access. I have also added a new feature allowing hosts (and optionally their players) to restore lost character details from death logs.

Restoring Lost Data from Death Logs

This mod can restore data from a player's death log using the filename of the log, the timestamp of the death in milliseconds, and the player's Steam username or ID.

By default, you must be an admin to use this power, and only people with access to server files will be able to read the logs. This can be adjusted in sandbox options.

Commands that use the formats in the following examples will work from any chat stream:
-- If no filename is provided below, "Most-Recent-Deaths.txt" will be used by default. -- Paths are relative to the server's Lua folder (where mods can write files in Project Zomboid). -- General format: triggerEvent("AdvancedDeathLogRestoreData", username, timestamp, filename) triggerEvent("AdvancedDeathLogRestoreData", "Burryaga", "1722092013137", "2024-07-27/03-48-00-GMT") triggerEvent("AdvancedDeathLogRestoreData", "Burryaga", "1722092013137") AdvancedDeathLogRestoreData("Burryaga", "1722092013137", "2024-07-27/03-48-00-GMT") AdvancedDeathLogRestoreData("Burryaga", "1722092013137") /say AdvancedDeathLogRestoreData("Burryaga", "1722092013137") /admin triggerEvent("AdvancedDeathLogRestoreData", "Burryaga", "1722092013137") -- Slash commands that precede valid requests to restore data will be dropped automatically. -- You can also target specific player indexes on a given client. -- This will allow hosts to restore data to splitscreen players. -- Simply include the target player index, where index 0 is player one. -- The following command would restore player on Burryaga's client to local player two: AdvancedDeathLogRestoreData("Burryaga", "1722092013137", "Most-Recent-Deaths", 1)

Commands that use the formats in the following examples will work from the debug console:
-- General format: triggerEvent("AdvancedDeathLogRestoreData", username, timestamp, filename) triggerEvent("AdvancedDeathLogRestoreData", "Burryaga", "1722092013137") triggerEvent("AdvancedDeathLogRestoreData", "Burryaga", "1722092013137", "2024-07-27/03-48-00-GMT")

In sandbox options, you can enable the use of "UNKILL" in place of "AdvancedDeathLogRestoreData" in chat commands.

Questions and Answers

Q: Can this be added and removed from an existing world safely?
A: Yes, but you should always make back-up saves when you're changing the modlist of an existing save. The consequences of undiscovered conflicts are unpredictable by nature.

Q: Will this mod make infinite files over time?
A: In theory, yes, albeit very slowly (depending of course on how frequently you die and how much stuff you carry). Plan to periodically delete your death logs like you clear files from your Downloads folder. If you are worried about this, do not enable logging to dated Lua folders or the vanilla Logs folder. The lone log in Lua/AdvancedDeathLog will be replaced any time you start your server on a new calendar day, so it will not grow without limit.

Q: Does this work in solo games, too?
A: Yes; it was tested many times in both solo and coop. Obviously you will need to use debug mode to restore lost data in solo mode, because there is no chat.

Q: What username should I use in solo mode?
A: Any username will work in singleplayer.

Looking for more fun or useful mods? Feel free to explore my other work, including:

Kimono: A translation mod for the awesome kimono in Japanese Traditional Outfit.
Wookiee Gamepad Support: Improve gamepad support on your Project Zomboid server.
Mod Options Readability Enhancements: Revamp the Game Options menu.
True Music Jukebox: An apocalypse is always better with good music!

. . . and many more!

Please review the screenshots on this page if you do not know where to find the timestamps; the first one is intended to illustrate this process.

[ko-fi.com]

Workshop ID: 3298519559
Mod ID: AdvancedDeathLog
16 Comments
Jenek 1 May @ 7:03pm 
I finally made it to work. It turns out that I need to let the server sit for a while and the admin killed to update the logs after sandbox option update. Now it works!
Burryaga  [author] 1 May @ 11:31am 
If you cannot figure out how to use this mod in B41, please contact me on Discord for assistance. If B41 received an update AFTER the release of B42, which is unlikely, then I can no longerr guarantee that it works. If not, it almost certainly still works the same as it ever did in B41, and any failure to use it is either user error or a file permission issue associated with specific dedicated hosting environments that are beyond the scope of the mod's influence.
Jenek 1 May @ 9:35am 
I want to use the command to restore someone's character but I don't know how to use it... I am confused. I don't get it. What is "1722092013137" in the example?
Burryaga  [author] 13 Feb @ 1:15am 
You just don't put slashes in front of this mod's commands. You write this mod's commands exactly as the examples above, changing only the input values in the parentheses.
RegularPlayer 12 Feb @ 1:31pm 
._.

So just remove any / command when executing a command from this mod?
Burryaga  [author] 12 Feb @ 2:02am 
Entirely possible depending on how they did their commands. However, a common mistake that people make it to treat the above commands as slash commands, so be sure you aren't using a slash in your command, as you shouldn't be.
RegularPlayer 11 Feb @ 4:19pm 
The Unkill command is likely incompatible with the TICS chat system, it is not recognized as a command, both the short and long version
Burryaga  [author] 16 Jan @ 2:20pm 
Haha, sadly, no, it does not, but it does let you restore held inventory which includes wearables.
Lu5ck 16 Jan @ 6:49am 
It doesn't record what the player was wearing. T_T
Burryaga  [author] 27 Dec, 2024 @ 2:26am 
Well I'm not sure if it'll help but you can try it! That sounds like it could be a bugged interaction between a sleep mod and a mod that influences the effect of some player stats, like their hunger or something. I'm not sure if this will log the cause of death in that case, but it won't break anything to check.