If, in the future, this gets replaced by a more updated version due to Skyrim update and I am not here to update these requirements, use your brain and find the update yourself.
Other user's assetsSome assets in this file belong to other authors. You will need to seek permission from these authors before you can use their assets
Upload permissionYou are not allowed to upload this file to other sites under any circumstances
Modification permissionYou are allowed to modify my files and release bug fixes or improve on the features so long as you credit me as the original creator
Conversion permissionYou can convert this file to work with other games as long as you credit me as the creator of the file
Asset use permissionYou are allowed to use the assets in this file without permission as long as you credit me
Asset use permission in mods/files that are being soldYou are not allowed to use assets from this file in any mods/files that are being sold, for money, on Steam Workshop or other platforms
Asset use permission in mods/files that earn donation pointsYou are allowed to earn Donation Points for your mods if they use my assets
Author notes
You are free to compile this fix into you mod as long as your mod is open permissions
File credits
Unofficial Skyrim Special Edition Patch - Arthmoor - Unofficial Skyrim Special Edition Patch team - Please see Unofficial Skyrim Special Edition Patch readme in the download. This list is rather extensive and ever changing.
Donation Points system
Please log in to find out whether this mod is receiving Donation Points
Changelogs
Version 0.4
potential work around for removeallitems inventory corruption freeze (vanilla bug)
Version 0.3
Change to use the console version of unequipall. Confirmed to work in testing
Uploaded correct file this time
Donations
No donations accepted
Description This fix is somewhat theoretical. The change won't cause any harm, but I make no guarantees about it fixing your game.
WIDeadBodyCleanUpScript is a script that cleans up dead bodies of persistent NPCs. This script will also sometimes move their inventory to a coffin container. There are 2 issues that can happen during the execution of this script:
For reasons unknown to me, sometimes this will create a corrupt inventory record during the NPC to coffin transfer. This is observed to happen for items equipped on the NPC via script. This will cause the game to crash when saving the game, as the game is unable to save the corrupt inventory record in the coffin. People have reported this happening with items wet & cold equips on NPCs. I've seen multiple instances of this happening with Ancano.
The vanilla game has bugs where inventory items can sometimes become corrupt. This can be due to the items being special such as iron arrow or gold. It can be due to those items are equipped via script. Or it can be due to those items having stolen flags on them.
This mod tries to avoid these issues with the following changes:
Alter WIDeadBodyCleanUpScript so it unequips all items on the NPC using the unequipall console command before transfering their items
Transfering NPC items one by one before calling removeallitems to avoid freezes caused by corrupt inventory items
Requirements
ConsoleUtilSSE NG. If, in the future, this gets replaced by a more updated version due to Skyrim update and I am not here to update these requirements, use your brain and find the update yourself.
Installation If an NPC is already dead, their WIDeadBodyCleanUpScript is already running. If you think this will cause a crash, installing this fix won't prevent it, as that script instance is already baked into your save.
If you want to prevent a crash for an already dead NPC:
Select them in console either by clicking on them or by using the prid <reference id> command.
Unequip their entire inventory using the unequipall command.