Skyrim Special Edition
0 of 0

File information

Last updated

Original upload

Created by


Uploaded by


Virus scan

Safe to use

Tags for this mod

About this mod

Attempted to resolve a perceived programming error that turned out not to be a programming error. Ignore this mod if you are already using a mod that fixes the dragon stalking bug

Permissions and credits
Before we proceed...
Final Edit: As has been revealed to me, despite it not being made clear in the papyrus documentation, Event objects and Function objects are treated exactly the same by the compiler, meaning that this fix is mostly redundant. I do still make a minor edit, by moving the event call into state DeadDisintegrated, but this shouldn't technically matter in the long term because the script should only be catching the event while it's in that state anyway. This mod is not technically needed if you already use the Fixed Dragon Stalking Fix, though I'll leave this page up, mostly to serve as a lesson to any mod authors who thought like I did.

This will NOT fix any stack overflows mentioning the DragonActorScript, I still don't have concrete information on how those might occur. my current theories include:

  • Changing dragon overhauls mid-playthrough. This potentially causes the dragonactorscript instances in your save game to have incorrect variable assignments.
  • Having mismatched dragonactorscript.pex files. If you are using a mod like KS Dragon Overhaul, ensure that none of its script files are being overwritten. These scripts might directly reference/communicate with each other, so if any of them are mismatched, you may get papyrus errors

As has been pointed out to me, and been corroborated by own testing, the programming error in Fixed Dragon Stalking Fix was NOT the root cause of the stack overflow that many users, including myself, have been experiencing. For this misinformation, I apologize. Despite this, the code DID still need to be fixed. I am still investigating the cause of said stack overflow, and will update the mod page when I further narrow down the cause.

This is NOT meant to be a personal attack on tarlazo. I am unaffiliated with them, and do not believe there was any malice or intended negligence on their part. I do not endorse any form of hatred or abuse sent their way. Programmers make mistakes all the time (just look at bethesda lol) and I could see myself making the exact same mistake were I in their shoes. That being said, given that the programming error (described below) can cause significant harm to a user's save game (requires further investigation*), I feel compelled to describe it in detail, so that similar errors are not repeated in the future.

What is the Dragon Stalking Glitch?

Many people have fallen prey to the infamous "Dragon Stalking" bug, wherein a dragon's corpse will appear to follow the player around, never despawning. This is caused by the slain dragon's parent cell being unloaded before the dragon can be properly deleted.

The first attempt to resolve this issue, Dragon Stalking Fix, used the OnLoad() and OnUnload() form events to delete a dragon after its soul has been absorbed, but this method has the issue of being simultaneously unreliable and overly aggressive, due to the unreliability of the OnLoad() and OnUnload() events.

The second attempt to resolve this fix came in the form of Fixed Dragon Stalking Fix (link is a reupload). This version uses of the fix uses the much more reliable IsAttached function to execute the fix.

Why did you make this
Upon looking into the source files for the mod, I found that the mod incorrectly calls OnUpdateGameTime() as a function, rather than as an event. This is NOT a valid way to call this event, and results in the aforementioned stack overflow error.(requires further testing*).  As has been shown to me, functions and events are treated exactly the same by the compiler, so tarlazo's mod was NOT in error.

*upon deeper examination, it seems that the stack overflow error doesn't appear to occur in an otherwise vanilla game with only USSEP and the Fixed Dragon Stalking Fix. Despite this, in an installation where the stack overflow was otherwise occuring, fixing this code prevented the issue. I am still investigating the root cause of this issue, because I know that I am not the only one who has experienced this.

Presenting: The Fixed Fixed Dragon Stalking Fix
I have fixed up Tarlazo's code by changing the Function OnUpdateGameTime() into an event call, and moving it into State deadDisintegrated. Otherwise, the code is exactly the same as Tarlazo's

Any mod that edits DragonActorScript.pex is incompatible with this mod.