Jump to content

Technical insight again, mod removal?


hereami

Recommended Posts

Sorry for kinda spam, but unfortunately can't update title. Also that's probably very basic question?

 

What happens to data of removed mods? Let's say a custom keyword, perk or av attached to Actor (but not limited to). Is there some cleanup of invalid data on load (or else) or does it just sit forever as NULL or whatever set of bits, because game says it doesn't support uninstallation of mods.

 

Some weird occurence i remember, if a REFR has vanilla script attached by override in some patch, and has none in base mod, but anyway script sticks to an object after patch removal. Though overrides should be fully safe to remove i thought.

 

Thanks.

 

ps. Well, there's another weird thing about scripts on deleted/disabled objects, they keep running... Not really intuitive, thoug maybe understandable, but still would be more logical if only handled OnLoad and alike critical system events, especially deleted ones.

Edited by hereami
Link to comment
Share on other sites

Which is why when attaching scripts to objects that can be deleted it is good practice to use IsBoundGameObjectAvailable() and IsDeleted() tests to stop long running functions, timers and UnregisterForAllEvents. Example:

 

 

 


;*************************************************************************************

Event OnLoad()

If (Self.IsBoundGameObjectAvailable() == True) && (Self.IsDeleted() == false)
   ;do stuff
Else
   Self.CancelTimerGameTime(iSpawnTimer)
   Self.UnregisterForAllEvents()
   GoToState("Deleted") 
EndIf

EndEvent

;*************************************************************************************

 

 

Link to comment
Share on other sites

There is some cleanup yes but of course it's far from perfect thus, mod removal isn't officially supported.

 

For example, if someone's using a huge mod pack that adds a lot of creatable workshop objects then they decide to remove it for some reason, the next time they save the game the save file will be considerably smaller (depending on how many of these object were already placed).. Their REFR records in a save editor can't be found either.

 

I don't think it's difficulty to make a system that cleans up missing objects and removes their script instances, the problem is that objects are usually referenced or used by other objects and the system can't trace back everything, can't edit or zero out every affected variable, e.g., one removes a mod that added a furniture to the game but when happens all the quests or formlists that use this furniture.. Fail the quest?, hide the objective if one is pointing to it? I suppose this is when we see "Nullptr" or something like that, when the game sees a formlist as if its element at that index is not empty ( != None) but the variable in it points to nowhere. Depending on what other scripts, forms are trying to do with that element, the game may crash.. Modders can't completely prevent this but I think we should do everything we can within reason to protects users' saves..

 

What kind of objects and how they get deleted / edited exactly is unknown because the engine is not open source.. only "typical scenarios" can be identified during making mods. But you can PM the authors of save game editors, they're likely to have much more knowledge on saves since they put a lot of time and effort into decompiling them.

Edited by LarannKiar
Link to comment
Share on other sites

To add to this:

 

If a mod adds a powered object and player builds that object and wires it up, player is guaranteed to get the scrap crash in their game after mod removal.

Only solution is to scrap (or at least un-wire) the object before mod removal.

Doing this by script is not possible in vanilla configuration, as using Delete() on powered, wired-up object (or on any wires) also causes the scrap crash.

 

Other then that, generally the auto clean-up on game load is not so bad. It works reportedly much better than it used to in Skyrim. You can see some of it in action when you have papyrus logs enabled; For example, the engine will log notices/warnings when it finds a property value in a plugin, but the property doesn't exist anymore on the script in question or when the script is gone entirely.

 

There's however some cases where script code might keep executing even after it's PEX had been removed.

So, the tip SKK gave is very good advice especially if you have long running loops and stuff in your script.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...