I've noticed a big loophole in the functions to adjust http://www.creationkit.com/index.php?title=LeveledItem_Script lists.
1. Items added to Leveled Item lists will persist through game saves, meaning that if you ever add an item more than once, it will have multiple entries in the list.
2. The Revert() function will remove ALL script added forms to the Leveled Item list.
So what does this mean? It means that you should only ever add to this list once, for example the first time your mod is loaded.
However, it also means that if another mod ever uses the Revert() function, it will remove everything you added to the list.
This doesn't make sense at all, because if you add things to the lists multiple times, you will screw up the game's probability of selecting other items on it. And if you only add them once, theres a risk of another mod breaking your changes. It looks something like this:
- Skyrim loads default lists, with previous saved changes applied.
- Mod_01 reverts a list to remove changes, and adds new items to it.
- Mod_02 reverts the same list, removing Mod_01's list items, then add it's own items.
- Mod_03 resets the list, etc. etc.
- Result: Only default items and Mod_03's items are on the specified list.
It would be a lot smarter if the game did not save changes made to these lists, then each mod would be responsible of adding their items to the lists after each game load, which would look something like this:
- Skyrim loads default lists.
- Mod_1 adds items to the vendor misc list
- Mod_2 adds more items to the vendor misc list
- Mod_3 adds even more items to the same list
- Result: All mods have their items on the list
So.. Are there any ways to fight against the current system?
The only way I can think of right now would be if it was possible to return the index in the list where your item is added to, and save it in a global variable. Then on each load, you would check that index for the item you placed there, and if that index doesn't exist or another item is there, it's safe to assume someone has reverted the list.
However, for that to work, it would have to be possible to return an integer when using the AddForm() function, so you know where to check..
What are your thoughts about all this?