babachele Posted June 11, 2013 Share Posted June 11, 2013 (edited) Babachele's Mod Talks: Making Scripts Safely Uninstallable (Pulled from my Mod Talk on Dynamically Modifying Skyrim. I thought it was an important enough thing to keep in mind on its own, so I've added it here as its own topic.) 1. Script everything you can into custom functions. Even when you don't really need to, use a custom function in lieu of just the native/global/skse function and just define your desired function(s) within that custom function. Then set your scripts up to have States. For every script you added, include one State at the very end that defines all the custom functions you defined earlier, except in this state leave the definition empty. [ex. CustomFunction() EndFunction]. Now, either include a menu option or some sort of activator that when enabled will set ALL of your scripts to this Stage. This will effectively disable your Mod, allowing it to be safely uninstalled/updated without leaving lingering functions running to bloat your savegame. 2. I REPEAT - Do Not Modify Vanilla FormLists directly using the CK. If you want to add something to a Vanilla FormList, add it via script. 3. You can use the Revert function to remove all script-added forms from a FormList. Useful to get rid of any additions you made to Vanilla FormLists, though it will also remove script-added Forms from other Mods. I have a workaround for this, but I'm too lazy to explain it right now. I'll get to it eventually. Edited June 11, 2013 by babachele Link to comment Share on other sites More sharing options...
steve40 Posted June 16, 2013 Share Posted June 16, 2013 That won't necessarily work. When you change the state, any functions that were executing while in the previous state will continue to run until completion, so looping scripts will be a problem. You also need to incorporate some sort of mechanism to kill running loops (maybe a flag in a While statement, or an If statement that will issue a Return when a certain flag is true). You should also cancel any registrations for updates, animation events etc. Also I don't see why they need to be custom functions, it should make no difference. Only the state of running functions gets saved into your save game, whether native or custom. I agree wholeheartedly about the FormLists though. Link to comment Share on other sites More sharing options...
EnaiSiaion Posted June 16, 2013 Share Posted June 16, 2013 You can use the Revert function to remove all script-added forms from a FormList. Useful to get rid of any additions you made to Vanilla FormLists, though it will also remove script-added Forms from other Mods. WHAAAAATAaaaaaaaaaaaaaaaaaaaaaaaaargh :facepalm: Link to comment Share on other sites More sharing options...
GrimyBunyip Posted June 16, 2013 Share Posted June 16, 2013 You can use the Revert function to remove all script-added forms from a FormList. Useful to get rid of any additions you made to Vanilla FormLists, though it will also remove script-added Forms from other Mods. WHAAAAATAaaaaaaaaaaaaaaaaaaaaaaaaargh :facepalm:its not that earth shattering, when's the last time you made or used a mod that edited formlists? Link to comment Share on other sites More sharing options...
EnaiSiaion Posted June 17, 2013 Share Posted June 17, 2013 Um, every single one of them? Link to comment Share on other sites More sharing options...
BotOwned Posted June 17, 2013 Share Posted June 17, 2013 (edited) You can use the Revert function to remove all script-added forms from a FormList. Useful to get rid of any additions you made to Vanilla FormLists, though it will also remove script-added Forms from other Mods. WHAAAAATAaaaaaaaaaaaaaaaaaaaaaaaaargh :facepalm:its not that earth shattering, when's the last time you made or used a mod that edited formlists? I use Form Lists fairly often as well as I enjoy the functionality of using Conditions, but I don't see this as much of an issue unless your adding it to a vanilla formlist... I'm surprise you didn't know though Enai when it says all on the Creation kit wiki it really means all. ;) Edited June 17, 2013 by BotOwned Link to comment Share on other sites More sharing options...
GrimyBunyip Posted June 18, 2013 Share Posted June 18, 2013 Um, every single one of them?I meant one that edits them with a script :prevert isn't going to do anything to a formlist unless it was edited by a script. Link to comment Share on other sites More sharing options...
hypno88 Posted June 18, 2013 Share Posted June 18, 2013 Until the community decodes the save file format, we will never know the full extent on what data from mods gets "baked into" the save. It's not just scripts, navmesh changes as well as door marker changes also get baked. This is just the tip of the iceberg that we can see. Until that time, its probably best if we as mod authors just follow Bethesda's lead. For their mods (DLC), their stance is: "Uninstalling plugins is not supported by the game. If you wish to remove a plugin, revert to a save made before it was installed, or start a new game" So many times I've seen users berate a mod author for a problem they think that mod is causing, only for it to come out that that user was experiencing problems due to uninstalling other mods. We need to get people out of the old habit of the "clean save procedure" - Hypno Link to comment Share on other sites More sharing options...
Sjogga Posted June 19, 2013 Share Posted June 19, 2013 You can use the Revert function to remove all script-added forms from a FormList. Useful to get rid of any additions you made to Vanilla FormLists, though it will also remove script-added Forms from other Mods. WHAAAAATAaaaaaaaaaaaaaaaaaaaaaaaaargh :facepalm: You could create a quest with the player as a Reference Alias. Attach a script that looks something like this: Event OnPlayerLoadGame() if !<Script-edited formlist>.HasForm(<A script-added form>) ;Function to re-add all the forms endif EndEvent Link to comment Share on other sites More sharing options...
Recommended Posts