johnbturnip Posted May 19, 2016 Posted May 19, 2016 So, I'm well-aware of the fact that Skyrim bakes your scripts into your save file(aggravatingly), so any changes to scripts should cause undefined behavior. This, in theory, should mean that it's impossible to "safely" update a mod's scripts mid-playthrough. However, there are lots of mods on LoversLab -- such as Schlongs of Skyrim, SexLab Aroused, and even SexLab itself -- that support updating mid-playthrough by including an "uninstall" option in the MCM. So, what guidelines should I follow if I want to release an updated version of my mod? What kinds of things should my "uninstall/update" button do in order to ensure the new version of a script is used, instead of an old one? What kinds of pitfalls do I need to look out for?For example, I have this script, which is attached to a quest. Scriptname BCMFUT_QuestScript extends Quest SexLabFramework Property sexlab auto SOS_AddonQuest_Script Property emptySchlong auto SOS_API Property sos auto hidden ;Events Event OnInit() ;Get the SOS api sos = SOS_API.Get() Debug.Notification("Becoming Futanari initialized.") EndEvent ;Functions Bool Function IsFutanari(Actor akActor) ;Returns if this actor is a futanari. return (akActor.GetActorBase().GetSex() == 1) && (sos.IsSchlonged(akActor)) && (sos.GetSchlong(akActor) != emptySchlong) EndFunction Form Function SelectSchlong(Actor akActor) ;Selects a suitable schlong for the given actor ;If none was found, returns emptySchlong. ;TODO: Select randomly, based on SOS's settings. int addonCount = SOS_Data.CountAddons() int i = 0 While (i < addonCount) SOS_AddonQuest_Script schlongChosen = SOS_Data.GetAddon(i) as SOS_AddonQuest_Script ;If this schlong is female and not emptySchlong, break. float schlongGender = schlongChosen.SOS_Addon_Gender.GetValue() if ( schlongChosen != emptySchlong && (schlongGender == 1.0 || schlongGender == 2.0) ) Debug.Notification("Selected schlong " + schlongChosen.GetName()) return schlongChosen endif i += 1 EndWhile ;None was found, so return empty schlong Debug.Notification("No suitable schlong found.") return emptySchlong EndFunction Function MakeFutanari(Actor akActor) ;Makes the target actor a futanari, if she isn't one already ;Don't go on if male or futa bool isMale = akActor.GetActorBase().GetSex() == 0 if (isMale || IsFutanari(akActor)) return endif ;Set the schlong sos.SetSchlong(akActor, SelectSchlong(akActor)) ;Tell SexLab the actor is male. sexlab.TreatAsMale(akActor) EndFunction Function MakeNotFuta(Actor akActor) ;Makes the target actor a normal woman, if she's a futa. ;Don't go on if not futa if (!IsFutanari(akActor)) return endif ;Remove the schlong sos.SetSchlong(akActor, emptySchlong) ;Tell SexLab the actor is female sexlab.TreatAsFemale(akActor) EndFunction I then want to rewrite the SelectSchlong function so that it randomly selects an installed SOS addon, rather than what it currently does.If I just change it, recompile it, and then load up a save file that already has the old version installed, I would get the old behavior instead of my updated behavior, right? So, let's say I decide to add a button to my MCM that results in this script being "cleaned" from the save file, so that the new version will be used when the player updates. What would my button need to do to achieve that effect? Would stopping the quest do the trick?Sorry for asking such a broad question, but this isn't exactly the kind of thing that's google-friendly. Thanks in advance for the advise!
Veladarius Posted May 19, 2016 Posted May 19, 2016 If you change a script from one version of a mod to another the changes will take effect. Some mods have continuously running scripts that may need changes made to or they want to change script properties (script properties won't change unless it is uninstalled). Do not remove script properties from scripts or it will generate errors that they are missing. Question on your script, does it continually run on its own? If so then you may want to put in something to stop the script.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.