Site hosted by Angelfire.com: Build your free website today!

Creating ESM-Files

First of all...

If you don't know exactly, what you are doing,
don't blame me for messing your game up.

You should have experience with:
- TESCS - The Elder Scrolls Construction Kit
- Horatios Leveled List Merger
- TESPCD - The Elder Scrolls Plugin Conflict Detector
- TESAME - The Elder Scrolls Advanced Mod Editor

Second...
Even if you DO know, what you do, don't create esms unecessarily. Create them if one of the following conditions is true:
- You do a total conversion of morrowind
(Not explained in this tutorial. Only esm-dependant custom.esms will be explained)
- You modify spawnpoints located in cells, that are NOT included in your mod
(cells on the mainland of Vardenfell or other major landmasses added by mods or official additions)

If you wanna create an esm for no other reason than "it sounds cool" you are not a "1337 d00d", but a simple wannabe. Just stick with esp, they are much simpler to handle or modify and there is no known way to convert an esm back to esp. So keep with the spirit of modding and share your creations freely with fellow modders.

How to...

Open up ProgramFlow.txt
Look for the second entry: 000001: Computer Name: xxx
Copy the name after the :
Open op Morrowind.ini
Go to [WhoCanMerge]
Modify the line below like this: xxx=1
Save Morrowind.ini.
Fire up TESCS

Voila, if running WinXP, Win98SE, WinME or Win2K, there should be a new button if you open Files->DataFiles from the Menu reading [MergeToMasters].

Even if Bethesda isn't supporting this feature, they fixed some issues in the tribunal release. You now have to choose an active file, just like for plugin modification. Before you choose it, the button will be grayed out. There is no possibility of deleting morrowind or tribunal esm like in the non-tribunal version fo the TESCS, so it is finally SAFE to create esms. There is no possibility of deleting an esm at all. You may check it and [MergeToMasters] and the esp will disappear, but the esm will remain. Only your esps will be deleted, once the new esm is created successfully. Be sure to clean out your plugins using the TESPCD before you merge to esm and be sure to backup your esps, for there is no possibility of bringing them back once merged to esm.


Rules for creating esms

You CAN NOT alter or delete references.

Thats a basic and undiscussable truth.

If you alter any reference, and check the original esm (morrowind, tribunal, ...) there will be two references and there will be the changed object and the original object showing up, when ingame.
If you delete any reference, and check the original esm (morrowind, tribunal, ...) there will be still one reference and the original object will show up, when ingame.


You CAN alter or delete objects.

A cell is an object.
A rock in this cell isn't an object.
A terrain_static_rock_ID is an object.

So here we go:

You can delete the cell. (but who wants that)

You can create a new cell.

You can place additional rocks in the cell.

You can assign a new texture to the rock as long as you keep the ID the same.
It will show up on the rock.

You can create a tree-mesh, texture it and give it terrain_static_rock_ID.
This will replace all rocks with the tree.

You can delete the terrain_static_rock_ID
But it will shower you with errormessages "missing object to ID referenced in cell" even if it is still in the original esm.
But the rock will vanish. (Very bad modding)

You can move the rock.
It will show up twice.
Once at the original position.
Once again at the new one. Bummer.

You can't delete the reference.


What does that indicate for my mod.esp

If you altered any reference already in the cell.. Bummer.
Forget about esm.

Example 1:
You were one of those house-mod builders, placing his home-sweet-home in the middle of Balmora. Nice.
convert to esm.. fine.

Example 2:
You were one of those more adventurous house-mod builders, placing his home-sweet-home in the middle of Balmora, but, damn, that stupid Nord woman is exactly spawning, where my armory should be. You moved her a bit to the side. Nice.
convert to esm.. bummer.
2 Nords, one still inside your armory, the other at the new position.


When do I need to convert to esm

As said above only if you modify spawnpoints located in cells, that are NOT included in your mod

Example 1:
Firemoth. Does add creature spawns. Lots of them. But you won't need to convert to esm, because the cells of firemoth are NOT referenced in any other esm or esp. Creatures will not double.

Example 2: *fictive mod*
Firemoth "Additions". Adds creature spawns. Lots of them. Cells are NOT defined by this mod, but updated only. Creatures will double.

Example 3:
GIANTS 2.0. Does add creature spawns. Lots of them. Cells are NOT defined by this mod, but updated only. Creatures will double.


Solution 1:
Keep it as it is.

Solution 2:
Merge both mods.
You have them both as esp, so this is not much of a problem.

Solution 3:
Make GIANTS 2.0 esm. You could merge them, if you would have a morrowind.esp. But you haven't.


I tried, but it keeps saying:
"Attempting to merge "ID" reference in "Cell_ID" from masterfile morrowind.esm to masterfile "new masterfile.esm"


Bummer.
You have altered some references in your mod.
It will double.
Only possibility: delete the complete cell from your esp.
Go into TESCS and add your changes to the cell.
Do not alter anything.
Do not remove anything.
Do not even touch anything.
Just place and adjust height and position for your new objects.

Hell, only PumaMan knows, how frustrating that really is. He has had 600+ altered references in his mods. In 100+ cells.


Are there exceptions to the above rules
Of course.
First we talk about rules, not laws.
Second we talk about a game made by Bethesda Softworks. ;)
The only exception is hightmap (aka landscape-grid), and its not a real exception at all. Landscape isn't saved in celldata, as it is not a physical object. Landscape is defined by vertices and textures. Vertices are saved in celldata, but vertices are not absolute objects (like items), but relative ones. So instead of 2 landscape only 1 altered landscape shows up, even if 2 vertices are applied to the same point of the grid.

The morrowind.esm applies vectors to a dynamical matrix, making the landscape looking so and so.
Now you come in with your esp.
Your modification was not saved as an position, but as vertices.
If you know, what vectoraddition means, you get the idea.
Basically morrowind.esm says to a given point in the landscape-matrix "go there".
Your esp (later gone esm) says "from that point(!) go there".

You see: 2 "non-references", both applied to a "non-object" (landscape-gridpoint).


Little excurse to hexediting.
So how do "original" references and altered references differ?
In one stupid byte.
If you alter a reference, it is saved in the esp as the same reference but with a minor change. One data byte goes up from 00 to 01. That's for Morrowind to recheck that reference-ID with the esm-data. instead of blindly adding the reference, it adds this reference from esp and removes the original one, placed by the esm-data.
Simple but effective.
Problem is, that ess saves its altered references just the same way. The game loads the ess, sees a altered reference, tries to remove that altered reference, but can't, because it already has been removed by an altered reference from esp. Then it checks for an older altered reference with the same ID, but if your esp-data is newer than the ess data it can't remove that altered reference, too. But it cannot ignore things referenced in ess, so it will add both references.
Fine, how to prevent that was discussed above. simply set the ess to be newer than esp.

But what about esm?
An esm cannot hold any altered references. All reference IDs in an esm have the 00 for unaltered references. That's why an esm can only hold NEW references. If you add new content to an esp, it will have the 00, too, for it is first referenced here. This references are safe to translate to esm. If you altered any reference it will load the original reference from the dependant esm, too and you'll have both references displayed ingame.

So to clean a esp from altered references you basically just have to "reset" them, overwriting the 01 with 00. If you load the mod into TESCS, it will check all new references (00) against the new references already loaded. It will find that the formerly altered reference in your esp is the same reference as a given esm has and it is not altered (you exchanged the 01 with 00). So it will mark it as an duplicate reference. That is causing the little gray errormessage saying "xxx duplicate refereces removed". SAVE. Now all altered references are gone from your mod and only the new one remain.

I hope now the last one will understand, why an esm cannot hold altered references, but only new one and new or altered objects.


How to create a clean creature.esm

- Fire up Horatios Leveled List Manager
- Load your Creature.esp
- Create a leveled List file for this mod
- Rename your leveled list file to "modname"-list.esp
- Fire up TESCS
- Check the Creature.esp
- Press [MergeToMasters]-Button
- If you encounter any "Attempting to merge..." errormessage.
---Bummer.
---Your mod was not clean of altered references, start again.
- Safe the esm to "modname".esm
- Your cleaned Creature.esp will vanish in the process
- Fire up Horatios Leveled List Manager
- Add your "modname"-list.esp
- Merge them to a "masterlist".esp
- Fire up Morrowind
- Check all your newly created esm-files and the "masterlist".esp
- Have fun.


To reduce some misunderstandings:

The method to create esms ist NOT used to create esms, that are independant of other files for use in total conversions. The esms have the same dependencies as the original esps (morrowind.esm or morrowind/tribunal.esm once updated)

Last but not least: Final words from Bethesda Softworks
"First, all of this is only regarding Tribunal and post-Tribunal code. When we decided to make Tribunal a new ESM file, we had to change some things in the way that multiple masters were handled. The following refers to how the game works with those changes.

Master files can be somewhat dependent on other master files. Because of this, they can change or delete Objects in the other master file. However they can NOT change or delete References. Any reference in the main master file which is altered by the dependent one will be duplicated. This is due to the indexing system used for References. Each Reference in a plugin has an index with a component in it indicating the file the Reference originally came from. When a plugin is merged into a master file, any References in it which originated in a master file other than the master file the plugin is being merged to lose track of where they came from. Then when the two masters are loaded together, these altered References in the new master can not match up with their counterparts in the original master so you get both the old Reference and the new one."


Thanks for this confirmation, Beth.
To base my assumptions on empiric evaluation was driving me nuts.