Hacktank Posted December 23, 2014 Share Posted December 23, 2014 (edited) I was wondering, is there any way to detect when a user has randomly uninstalled your mod so you can run some cleanup code? The specific situation I am having a problem with is with ActiveMagicEffects. When the mod is uninstalled the magic effect is removed from the actor, but the OnEffectFinish() event is not fired. While this does make sense, it is very inconvenient. I have one possible idea on how this could be rectified. On the creation kit wiki it says that if a script is in the middle of executing when a save is made, and the script is removed prior to reloading, a copy of the script will have been stored in the save-file, and will be allowed to finish before being permanently purged. If this is the case (haven't tested it), I could conceivably have an update chain or something running in my ActiveMagicEffect script that does the following:wait some time (10 seconds maybe) check if the mod is still installed again, if not, artificially call OnEffectFinish() and return re-register for the eventDoes this sound like a good idea? If so, how can I poll for whether or not my mod is still installed. If not, is there another way? Thank you. Edited December 23, 2014 by Hacktank Link to comment Share on other sites More sharing options...
cdcooley Posted December 24, 2014 Share Posted December 24, 2014 The OnEffectFinish function won't be there. The entire script isn't kept in memory, just the currently running function. Just tell people not to uninstall your mod unless they are going to start a new character or go back to a saved game made before adding it. Bethesda doesn't provide any mechanism in the game to clean up after an uninstall. That's why players get the warning message about missing content. Link to comment Share on other sites More sharing options...
Korodic Posted December 24, 2014 Share Posted December 24, 2014 If you're using a quest to run all of your scripts some say you can have them stop the quest, move to a location like the testing hall, save/quit skyrim, start a new game, exit skyrim again, then load their save. However, I dunno if the science is proven. Users shouldn't go around the "I'll uninstall it when I'm done with it" mentality. Link to comment Share on other sites More sharing options...
Arocide Posted December 24, 2014 Share Posted December 24, 2014 (edited) You can technically check to see if your mod is not installed by using GetFormFromFile, since forms from your mod won't exist anymore you could perform that check at the end of each Event and Function you have in your mod, then print a message box saying it wasn't uninstalled correctly. You can't do much other then that nor can you call any functions from any of your mods scripts since they won't exist anymore (As was said previously :wink: ). Since it would add more time to your scripts can't say it's a good idea, and well it's not your fault if a user doesn't follow the instructions that you set out. Edited December 24, 2014 by Arocide Link to comment Share on other sites More sharing options...
Hacktank Posted December 24, 2014 Author Share Posted December 24, 2014 Ahh well. Thanks for the replies and information. Hmm, perhaps the SKSE team could look into adding a way to register uninstallation script fragments that would run if the mod was removed? Either way, its not that big of a problem, if my users read the instructions they will be fine, but its always nice to be able to idiot-proof things when possible. Link to comment Share on other sites More sharing options...
Recommended Posts