For some reason changing the script to this has caused NPCs to start teleporting to the WIDeadBodyCleanupCell while being alive. It happened after I rented a room and slept. Both the NPCs I've had teleport there were Innkeepers. Removing the edited script resolved the issue. Not blaming the script, it looks as if it should be fine. The issue was reproducible with my mod setup, but not sure what combination of mods causes it other than throwing this script into the mix. The only mods that I have that edit innkeepers is USSEP and Ask Innkeepers to Show Room. Just posting incase someone runs into a similar issue.
Having the same issues with live innkeepers being teleported to the dead body cell. Took me a few hours but I finally isolated it to this script "fix".
In my case, I can reproduce it by renting a room, leaving the inn, traveling to a different area, and waiting for 24 hours. Upon returning to the original inn the innkeeper will be gone. It doesn't seem to occur until renting the room for the first time - so possibly something to do with the handling of the quest aliases? I did notice that the vanilla room rental and related quests do check if the innkeeper has died (to "clear" your booking of the room). Might be related? Or might not... Nothing in the source provided here looked suspect to me, but I'm by no means a Papyrus wizard.
Encountered this as well. Was a bit stumped and then I remembered having this active. Unfortunately, removing it mid-game probably won't help as the script would be baked into the already loaded actors. At least not without having to wait for a full cell reset.
The script assumes that the NPC is dead due to the OnDeath event. Perhaps there should be a sanity check that ensures the NPC is truly dead prior to moving them?
The script assumes that the NPC is dead due to the OnDeath event. Perhaps there should be a sanity check that ensures the NPC is truly dead prior to moving them?
The question in my mind is why is that event being raised if the actor isn't dead? I know you have enough knowledge of scripting to follow, but the stock script follows the same logic. Event OnDeath(Actor akKiller) GoToState("Dead") if DeathContainer bool cleanedUp = false while cleanedUp == false utility.waitGameTime(DaysBeforeCleanUp * 24) cleanedUp = checkForCleanup() endWhile else endif EndEvent That's stock, with whitespace removed to fit better. OnDeath, start polling for cleanup. The only functional change I made was RegisterForSingleUpdateGameTime() instead of WaitGameTime()
I haven't been able to reproduce this, even with this method:
In my case, I can reproduce it by renting a room, leaving the inn, traveling to a different area, and waiting for 24 hours. Upon returning to the original inn the innkeeper will be gone. It doesn't seem to occur until renting the room for the first time - so possibly something to do with the handling of the quest aliases?
So, the only thing I can think of is: Event OnDeath(Actor akKiller) GoToState("Dead") if DeathContainer RegisterForSingleUpdateGameTime(DaysBeforeCleanUp * 24.0) endif EndEvent ...if some mod is altering the vanilla quest to fill the DeathContainer property earlier than expected, this could happen. BUT- if that's the case, it should happen with both the stock and this version of the script.
Looking at Mralki, innkeeper at Rorikstead: Stock has no dead body clean up script applied and thus no container. USSEP adds the WIDeadBodyCleanup script to him and assigns a death container This change has been present since USKP v1.0
Not sure why the improper cleanup happens with your script and not the other.
I got it. There's only one logical reason: https://www.creationkit.com/index.php?title=Talk:RegisterForModEvent_-_Form
Did you know that when a script is attached to a Form, and it makes an event registration, the event is registered with the FORM itself. When multiple scripts are attached to the same Form (Quest), the event registration will apply to ALL the Form's scripts.
Another script attached to the actors is doing a RegisterForSingleUpdateGameTime() while they're still alive, and it's firing this script's event.
v1.1 will be uploaded shortly after a little more testing.
Interested in this, and appreciate the explanation in description - makes total sense to me, but I'm concerned about the bug reports in the comments below.
If those issues are resolved, would this mod (i.e. having a stable, scheduled time for dead body cleanup) render this mod unnecessary?
That Cleaner script is intended to clean up dead levelled bodies: non-unique characters. the WIDeadBodyCleanup is meant to be used on unique NPCs only (per Bethesda's comments at the top of it). They're actually opposites in other ways, The Cleaner is set to remove dead bodies immediately after a cell unloads (or you burn them) but the WIDeadBodyCleanup delays cleanup by at least 1/2 a game day.
What does WIDeadBodyCleanupScript do exactly? It moves dead NPCs to the dead body cleanup cell and moves their items into coffins right? But why? A Reddit post I read said the game 'can't delete NPCs that don't respawn' so they move them there so the corpse is gone.
That makes me wonder, I were to make a mod that makes all NPCs respawn, could I just remove the script from the NPC without any bad things happening to my game?
I added this script and your other one for Sleep Tight as instructed on a moderate 200+ game mid play through and instantly began getting CTD's on a pretty stable build. I used MO2, ran Loot, etc. I had to remove this mod, still using your Sleep Tight patch, and now everything is fine. So, something is not meshing. I do use USSEP, if that matters.
I can theorize, first I don't think it will be related to either the number of mods you're running or to USSEP. I had shared this initially with several friends, and all of us are (AFAIK) using USSEP, and one of them runs "normally" with just over 1,300 mods. I like to use her as a beta tester of sorts, because in general if something's gonna break it's going to happen with that sort of modload!
If the vanilla (or even USSEP's, for that matter) script was running something other than the WaitGametime() when you made the save, then it was reloaded and papyrus found this script in its place, that may cause problems. I don't know if you use ReSaver/Fallrim Tools, but if you do and see something like this in the save, then my theory is probably correct.
That's an image from one of my older saves, which clued me in on this in the first place. The other active script is from Sacrosanct, and to be perfectly clear I'm not criticizing Enai Siaion at all for it- it only has a 1.5second wait in it, and it's just random luck that I happened to save during that time.
No, no Sacrosanct won't be a problem. :) I meant in my previous post that it's an example of a wait that IS NOT going to cause problems!
A single short wait() like Enai Siaion did in Sacrosanct isn't going to hurt anything. The issue with the stock WIDeadBodyCleanup is that it's a very long wait, inside a possibly infinitely-repeating loop.
a) check if dead body can be cleaned up b) if not, wait for 12 game hours c) go back to a
Forgive my ignorance, as I'm genuinely curious but not knowledgeable enough to have the answer by myself, but if I'm already using USSEEP, is there any reason to use your script replacement? Is it more of a script for people not already using USSEEP?
The main reasons are #10 and #11 here: http://wiki.beyondskyrim.org/wiki/Arcane_University:Scripting_Best_Practices If you google "skyrim registerforsingleupdategametime" you'll get a lot of results such as https://forums.nexusmods.com/index.php?/topic/2373259-waitgametime-or-registerforsingleupdate/ The first reply poses the question, the next two explain the difference. You can feel free to read more, or not, as you prefer but the gist of it is that a wait uses papyrus resources and registerforsingleupdategametime uses much less. Except in certain specific instances, the latter is the preferred method.
No. He neglected to leave a phone number in the comments that I could contact him at.
The only jduvall I can find mentioned at Bethesda is Jon Paul Duvall, credited as a Quest Designer on Skyrim. Which could explain why this happened, if programming wasn't his main role. https://fallout.fandom.com/wiki/Jon_Paul_Duvall
I did put serious consideration into asking Arthmoor about it, as he usually has no qualms about completely rewriting vanilla scripts in USSEP. But ultimately, for a < 2k file it was just easier to do this.
26 comments
I had a CTD and checked my last save with re-saver and this was the problem.
There are 93 stacks and 220 frames, which may indicate a problem.
WIDeadBodyCleanupScrip occurs the most often (89 occurrences)
nevermind. i recommend the before mentioned and linked Crash Fix.Can someone help out?
In my case, I can reproduce it by renting a room, leaving the inn, traveling to a different area, and waiting for 24 hours. Upon returning to the original inn the innkeeper will be gone. It doesn't seem to occur until renting the room for the first time - so possibly something to do with the handling of the quest aliases? I did notice that the vanilla room rental and related quests do check if the innkeeper has died (to "clear" your booking of the room). Might be related? Or might not... Nothing in the source provided here looked suspect to me, but I'm by no means a Papyrus wizard.
The script assumes that the NPC is dead due to the OnDeath event. Perhaps there should be a sanity check that ensures the NPC is truly dead prior to moving them?
The question in my mind is why is that event being raised if the actor isn't dead?
I know you have enough knowledge of scripting to follow, but the stock script follows the same logic.
Event OnDeath(Actor akKiller)
GoToState("Dead")
if DeathContainer
bool cleanedUp = false
while cleanedUp == false
utility.waitGameTime(DaysBeforeCleanUp * 24)
cleanedUp = checkForCleanup()
endWhile
else
endif
EndEvent
That's stock, with whitespace removed to fit better. OnDeath, start polling for cleanup. The only functional change I made was RegisterForSingleUpdateGameTime() instead of WaitGameTime()
I haven't been able to reproduce this, even with this method:
So, the only thing I can think of is:
Event OnDeath(Actor akKiller)
GoToState("Dead")
if DeathContainer
RegisterForSingleUpdateGameTime(DaysBeforeCleanUp * 24.0)
endif
EndEvent
...if some mod is altering the vanilla quest to fill the DeathContainer property earlier than expected, this could happen. BUT- if that's the case, it should happen with both the stock and this version of the script.
Stock has no dead body clean up script applied and thus no container.
USSEP adds the WIDeadBodyCleanup script to him and assigns a death container
This change has been present since USKP v1.0
Not sure why the improper cleanup happens with your script and not the other.
I got it. There's only one logical reason:
https://www.creationkit.com/index.php?title=Talk:RegisterForModEvent_-_Form
Another script attached to the actors is doing a RegisterForSingleUpdateGameTime() while they're still alive, and it's firing this script's event.
v1.1 will be uploaded shortly after a little more testing.
If those issues are resolved, would this mod (i.e. having a stable, scheduled time for dead body cleanup) render this mod unnecessary?
https://www.nexusmods.com/skyrimspecialedition/mods/10614
This is without using anything that adds a ton of extra spawns.
That makes me wonder, I were to make a mod that makes all NPCs respawn, could I just remove the script from the NPC without any bad things happening to my game?
If the vanilla (or even USSEP's, for that matter) script was running something other than the WaitGametime() when you made the save, then it was reloaded and papyrus found this script in its place, that may cause problems.
I don't know if you use ReSaver/Fallrim Tools, but if you do and see something like this in the save, then my theory is probably correct.
That's an image from one of my older saves, which clued me in on this in the first place. The other active script is from Sacrosanct, and to be perfectly clear I'm not criticizing Enai Siaion at all for it- it only has a 1.5second wait in it, and it's just random luck that I happened to save during that time.
I meant in my previous post that it's an example of a wait that IS NOT going to cause problems!
A single short wait() like Enai Siaion did in Sacrosanct isn't going to hurt anything. The issue with the stock WIDeadBodyCleanup is that it's a very long wait, inside a possibly infinitely-repeating loop.
a) check if dead body can be cleaned up
b) if not, wait for 12 game hours
c) go back to a
They're two totally different scenarios.
http://wiki.beyondskyrim.org/wiki/Arcane_University:Scripting_Best_Practices
If you google "skyrim registerforsingleupdategametime" you'll get a lot of results such as https://forums.nexusmods.com/index.php?/topic/2373259-waitgametime-or-registerforsingleupdate/
The first reply poses the question, the next two explain the difference. You can feel free to read more, or not, as you prefer but the gist of it is that a wait uses papyrus resources and registerforsingleupdategametime uses much less. Except in certain specific instances, the latter is the preferred method.
The only jduvall I can find mentioned at Bethesda is Jon Paul Duvall, credited as a Quest Designer on Skyrim. Which could explain why this happened, if programming wasn't his main role.
https://fallout.fandom.com/wiki/Jon_Paul_Duvall
I did put serious consideration into asking Arthmoor about it, as he usually has no qualms about completely rewriting vanilla scripts in USSEP. But ultimately, for a < 2k file it was just easier to do this.