One very common type of complaint is unexplained changes in their mod as they're
working on it: doors disappearing, two or more copies of NPCs, changes
that show up in the Construction Set but not when they test the mod in
the game, etc. The following is my standard reply to many of those posts.
Most likely, what you have is a dirty save game. To
fix it, go back to a saved game made before you first installed the
mod, and do all your testing from there. Note: the mod should be fine;
the problem is the dirty save.
Rule #3: Once a
mod is part of your saved games, don't edit it. Note: If you're going
to be doing much modding, it's probably safest to create a special
saved game that you use just for testing mods. Load that saved game
when you want to test a mod, and remember not to save it with any test
mods enabled.
About Dirty Saves
A dirty save is what you get when you edit (or update) a mod
after it's already included in your saved game. The saved game
contains data that doesn't match the data in the new version of the .esp
file, so the save is now 'dirty'. You can wind up with duplicated
items, disappearing items, containers that lose their contents, and
various other problems.
Editing a mod after it's included in your saved game is probably
the biggest cause of major foul-ups for inexperienced modders,
and it's probably the single most common cause of problems that
people post about here.
When you're editing an area that's already part of the game, it's
safest to only add
new objects, rather than editing anything
that's already in the game. Editing NPCs, containers, etc. that are
already in the game is a good way to cause problems with saved games, to
cause conflicts with other mods, and to possibly break something that's
important to the game.
If you do want to edit an existing NPC or another object that's part of
the original game, do your testing with a character that has never been
anywhere near the area you're modifying: not in the same cell or in any
adjacent cells (if you're modifying something in an exterior cell).
NPCs and Inventory
If you've already interacted with that NPC, or possibly just been in the same cell,
their inventory is stored in your saved game. The data in an .esm or .esp file just sets
the initial condition of the NPC (and everything else in the game) when you start a new game.
When you load up your game: first it reads in the data from the .esm
files, then from the .esp files, and then it updates that based on
what's in your saved game. So if you've interacted with the NPC already,
the NPC's data from your save will over ride the data in the .esm
and .esp files.
You can change the clothing on NPCs your character hasn't seen in the game yet,
or create new NPCs to wear the clothes. If you're trying to give a merchant new items to sell, you can put them in a
container (in the same cell) that the merchant owns. Use a new container (with a new ID) you've added to the game yourself, and set their ownership to the merchant.
Important: When changing ownership (or other reference data) for an object, close the properties sheet by clicking
the 'close' button (the small 'X' in the upper-right corner).
NEVER click on the 'Save' button for any object that you
didn't give a unique ID to. Clicking the 'Save' button will
change every copy of that object in the game, not just the one reference
you're working with.
What Gets Saved?
Not all data about an NPC or other object is stored in your save game files. For example,
the head and hair data isn't saved. That's why the various mods that change NPC heads/hair can change
the look of NPCs even after you've dealt with them.NPC inventory, the contents of containers, and a lot of
other data is saved in your save game when you interact with that object, so changing it in a mod won't have
any affect once you've dealt with that object.
I don't have any kind of complete list of what data actually gets
saved in save files, just some speculation. As a rule of thumb, I
would guess that data that can only be changed by loading a mod, but
not during the normal course of playing the game, probably won't be
saved. For example, NPC head and hair normally can only be changed by
using a mod; there's no way to change them while in the game. So
there wouldn't be much point in saving that information in the save
game files.
On the other hand, the inventory affects what an NPC can sell and
what you get as loot when they're dead, and that can change during
the normal course of playing the game. So inventory data certainly
has to be saved. And scripts can move almost any object in the game
world around, add new items to the game world or remove existing
objects, etc. So a lot of data about what objects are in the game
world also has to be saved.