Jump to content

[LE] Why is this mod using .Revert() function on formlists?


blackc

Recommended Posts

Hi! I've been working on and off for about a year on fixing the mod 'Diseased' by Manaflow and updating it for SSE. The mod has some compatibility issues, namely with Hunterborn; the death items on animal corpses added by Diseased overwrite the death items added by Hunterborn.

I found this is pretty strange, as Diseased adds all its new items to leveled lists directly by script, with a function run once at game start, which, as far as I know, is done solely to ensure compatibility with other mods.

Well...as it turns out, before adding the mod items to their respective formlist, the function does this:

Function RunOncePerUpdate()
Utility.Wait(20)
;Fixing save bloat issue
LItemApothecaryRecipesRare50.Revert()
LItemApothecaryRecipesCommon100.Revert()
LItemApothecaryRecipesCommon100.Revert()
LItemApothecaryPotionCureHMS75.Revert()
LItemMiscVendorPotion50.Revert()

...etc etc for about 30 lines, for every single formlist it edits.
Eventually we get to this:

DeathItemChaurus.Revert()
DeathItemChaurusEggs25.Revert()
DeathItemHagraven.Revert()
DeathItemSabreCat.Revert()
DeathItemSabrecatSnow.Revert()
DeathItemBear.Revert()
DeathItemBearSnow.Revert()
DeathItemBearCave.Revert()
DeathItemSkeever.Revert()
DeathItemWolf.Revert()
DeathItemWolfIce.Revert()

...which I guess is the root of the compatibility problems. Looking up the .Revert() command on the creation kit wiki, it does the following: "Removes all script added forms from the list". IF I understand this right, this would also remove any script-added formlists that were added by other mods aswell...which seems to defeat the purpose of adding to formlists by script in the first place. In fact, it makes compatibility worse, as it is now impossible to create a bashed patch.

So...what the hell? Why has the author of this mod done this? Manaflow, the original author, marks this as a fix for save bloat, but I cannot for the life of me figure out why.

The script as a whole is attached if you are interested. Any help would be greatly appreciated.

 

Edit: Attachment doesn't seem to be working for some reason. Here it is by dropbox: https://www.dropbox.com/s/lbm1sai657lk8cm/diseasedmqscript.psc.txt?dl=0

Edited by blackc
Link to comment
Share on other sites

I could see reverting some leveled lists and subsequently removing many entries causing a small reduction in file size. But enough to consider it as a fix to save file bloat? No way.

 

I could see reverting being done for mid-game updates where the items added to leveled lists were being changed. But that kind of work isn't needed for new games. So, I'm not sure of their intent by just reading the code.

Link to comment
Share on other sites

Cheers for the reply. I'm edging towards thinking its actually badly-coded mid-game update code, as you suggested. It turns out that there is also a script that triggers the maintenence code with OnPlayerLoadGame placed on the player's alias, so it runs every time the player loads the game. This code was written all the way back in 2012 when Skyrim modding was still pretty novel, so I can't complain too much. My guess is that, considering the function RunOncePerUpdate(), which triggers these Revert() functions, has the condition:

 

[code] If !(fVersion >= 1.08)

RunOncePerUpdate() [/code]
...these Revert() functions are either something to do with problems in the way the mod was adding items to formlists before version 1.08 (maybe duplication?). Hence, .Revert() was added to undo the damage done by whatever issue existed before 1.08. Alternatively, it could just be that original author was using this to update their formlists, but this feels like a very silly way to do that, the problem being that fVersion is only defined as something other than 0 after these Revert functions have already been performed once, which basically makes the mod incompatible with any script-based form edits that were loaded before it. Unfortunately the original author never documented the updates, so I can't really be certain as to the reason why they added this.
I'll probably try removing, or at least rewriting part of the script to avoid the Revert() functions. I doubt I'll ever be updating the formlists myself, and if I do, I don't see any trouble in just adding them in separate formlists. And then I'll test out save size and all that to check I'm not missing something with the save bloat.
Not sure how much of that made sense, but thinking out loud seems to have helped me formulate it in my head a bit haha.
Thanks for the help anyway! Pretty sure you've got me thinking on the right track.
Edited by blackc
Link to comment
Share on other sites

  • Recently Browsing   0 members

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