TESfaith

(The stuff that moves mountains)


TESfaith is a utility to Move, Copy or Delete cells stored in a TES3 file (such as Morrowind: Elder Scrolls III). It also processes the landscape and all objects associated with that cell. e.g. if you make a copy of a region or cell (internal or external) then all objects (NPCs, statics such as furniture, lighting, sound) will be copied with it. Likewise if you move a cell all objects will be moved with it.
You can easily do the following:

TESfaith is a simple command line program (i.e. run it from a command prompt), born out of necessity in September 2003 when I briefly got back from a 6month trip to Australia and found Bethesda had released Bloodmoon, placing an island of exactly the same size and in exactly the same place as my earlier plugin (the island of  The Attack on Ynys Mon). No such functionality currently exists in the TES Construction Set Editors, so something like this had to be written. It should be far simpler to solve conflicting plugin problems with this utility.

All TESfaith needs to run is an ESM/ESP file (a Morrowind master or plugin file) and a Rules file (always called TFAITH.CFG) which you can easily modify using Notepad. You should already have an example TFAITH.CFG file when you downloaded this distribution.
 

1. Format of the Rules File (TFAITH.CFG)

An example rules file (TFAITH.CFG) is included with the distribution. You can edit this using Windows' Notepad or any other plain text editor.
Each rule tells TESfaith what to do if it finds a matching Cell or Region. Each rule must start with a valid upper-case two character command, followed by up to 4 commar delimited parameters, depending on the type of command.
Once a rule is matched, no further processing is done to that cell. Many examples are given below:

Examples:

1. TA: Transposing all external cells a new location:

TA, -100, 80

This would move all the cells contained in the master/plugin and all objects in it far to the North-West (-100 is West by 100 cells, 80 is north by 80 cells).

2. CA: Copying all external cells to a new location:

CA, 30, -28

This would make a copy of all cells contained in the master/plugin and everything in them to the South-East (30 is east by 30 cells, -28 is south by 28 cells).

3. CR: Copying a Region to a new location:

CR, "Ascadian Isles Region", -100, 80
CR, "Ashlands Region", -100, 80
CR, "Azura's Coast Region", -100, 80
CR, "Bitter Coast Region", -100, 80
CR, "Grazelands Region", -100, 80
CR, "Molag Mar Region", -100, 80
CR, "Red Mountain Region", -100, 80
CR, "Sheogorad", -100, 80
CR, "West Gash Region", -100, 80

This would make a copy of Vvardenfell and everyone in it far to the North-West (-100 is West by 100 cells, 80 is north by 80 cells).

4. TR: Moving a Region (Transpose Region) to a new location:

TR, "Azura's Coast Region",3,0

This would detach all cells in the Azura's Coast Region from the rest of Vvardenfell, moving each cell in the region east by 3 cells, declaring clear independence for The Lady. ;)

5. Deleting a Region

DR,"Red Mountain Region"

Would delete all cells in the Red Mountain Region, leaving a big hole in the north of Vvardenfell, but solving the problem of Dagoth Ur once and for all. (Note that TES will complain about any Dialogue, Doors or AITravel references to any deleted cells when the new file is first opened).

6. Copying an Exterior Cell.

CE, -2, 5, 23, 5

Would make a copy of the cell at (-2,5) and place this copy at (23, 5). Note: (-2, 5) happens to be Buckmoth Legionnary Fort, so this would create an identical Fort and landscape somewhere off the east coast.

7. Moving an Exterior Cell.

MC, 0, 0, 25, 25

Would move the cell at (0,0) to (25,25), leaving a hole in the centre of Vvardenfell; presumably it was Vvarden who first found this out. Hoho.

8. Transposing an Exterior Cell.

TC, 1, -13, 0, -10
TC, 2, -13, 0, -10

Would move the cells at (1,-13) and (2,-13) by an offset of (0,-10). Therefore (1,-13) would be moved to (1,-23) and (2,-13) would be moved to (2,-23).
This example would move the exterior of Ebonheart south by 10 cells. This option is just a little more handy than 'MC' if you want to displace a group of cells, without having to calculate the exact position for each.

9. Deleting all Exterior Cells.

DA

This would delete all the external cells contained in the master/plugin and everyone/everything located in them. It's a pretty devastating option to use.

10. Deleting an Exterior Cell.

DE, 2, 8

This would remove the cell at (2,8) from the land, leaving a flat wilderness in its place; since (2,8) is the ruins of Dagoth Ur, this would make the game incompletable.

11. Copying an Interior Cell.

CI, "Vivec, Arena Pit", "My Arena 1"

Would create anew interior cells called "My Arena 1" which is an exact duplicate of "Vivec, Arena Pit". Very handy if you quickly want to duplicate the internal structure of an existing building or ship without spending ages starting from scratch.

12. Delete an Interior Cell.

DI, "ken's test hole"
You can do this in the TES editor anyway, but it was so easy to implement I put it in anyway. This example deletes the interior cell called "ken's test hole" - something Bethesda left in the original "Morrowind.esm".
Note that lines beginning with a # or a space character are ignored. So a # usually denotes a comment.

2. Running the program

Copy these 3 files to the same directory containing the mod (ESM/ESP) that you want to move:
  • TESfaith.exe
  • tfaith.cfg
  • tf_interiors.dat
  • Whilst TESfaith was originally designed to be run from a command prompt (a DOS-style prompt from Windows) and still can be, this has been unecessary since January 2004. It is also possible to tell TESfaith which ESM/ESP file it should process and other options by adding a single line to the rules file, tfaith.cfg. The simplest line you could add add to tfaith.cfg to tell TESfaith it should process the Morrowind plugin file called MyFile.ESP is:
    tesfaith  MyFile.ESP
    That should be all most people will want to run. If you save the tfaith.cfg file with a line like this in it and double-click on TESfaith.exe in Windows explorer then TESfaith will do the rest:  It will read MyFile.ESP, test each cell it encounters against the rules in TFAITH.CFG and create a modified version in a file called TFOUT.ESP.  If no rules were matched then the contents of TFOUT.ESP will be identical to MyFile.ESP. NOTE: TESfaith never alters your original input file! (unless your original ESP file happened to be called TFOUT.ESP. ;)
    You can also run ESM (Master) files through TESfaith in the same way. e.g.
    tesfaith  Morrowind.esm
    This will still place the output in TFOUT.ESP, but you can simply rename the extension to '.ESM' and load it in to Morrowind as a Master if you wish.

    TESfaith writes a log of everything it changes to TFTHLOG.TXT, which you can open in Wordpad (it'll probably look wrong in Notepad) if you wish to confirm all the changes that it has made.

    You may also specify more verbose ([b]highly detailed[/b]) logging by specifying '-v' on the command line; every record and object that is found is recorded in the log file with this option, regardless of whether a rule matched it or not.

    tesfaith -v MyFile.ESP

    You can tell TESfaith to only save moved or copied Cells, Land and Objects to TFOUT.ESP using the '-n' option. This is ideal if you just want to rip land from another Master or plugin file in to a fresh plugin. For example, to only save modified or copied cells from Bloodmoon.esm to TFOUT.ESP:

    tesfaith -n Bloodmoon.esm
    Note that when using '-n', information such as scripts or region data are not stored, so you may get some warnings when you try to load the resulting file in to TES CS or Morrowind itself.

    You can ask TESfaith to dump a verbose explanation of your Rules by using the '-r' option. It won't make any modifications - it's just for information purposes. A copy of these verbose (plainer English) rules will be stored in TFTHLOG.TXT which you can easily view in Notepad:

    tesfaith -r

    For backwards compatibility you can tell TESfaith NOT to modify any Scripts or Dialog commands by using the '-d' option:

    tesfaith -d "Siege at Firemoth.esp"

    Finally you can also ask TESfaith to dump a list of all the cell co-ordinates that exist in your ESP/ESM file by specifying '-l':

    tesfaith -l  MyFile.ESP
    This will create a file called CELL_LOG.TXT with all the cell co-ordinates listed. This output file may easily be turned in to a TFAITH.CFG file - the co-ordinates of your cells will already be listed. No modifications are made in list cell mode.

    3. A Complete Novice's example to moving land in a plugin.

    Here's an example: You have a plugin called "Siege at Firemoth.esp" and want to move all the land and objects in the region called "Firemoth Region" 10 cells west and 15 cells south. You also want to move the cell at (-2,9) to (-60, 40) just because you feel like it. Here's what you'd need to do:

    1. Open tfaith.cfg in Notepad (e.g. double-click on it in Windows Explorer).
    2. Delete everything that's currently there in the file (or make sure all the current lines have a '#' in front of them).
    3. Type in the following 3 lines:
    tesfaith "Siege at Firemoth.esp"
    TR, "Firemoth Region", -10, -15
    MC, -2, 9, -60, 40
    4. Save the file.
    5. Now double-click on tesfaith.exe in Windows Explorer.
    6. That's it. A new file called TFOUT.ESP will appear in the same directory which is the modified version of the "Siege at Firemoth.esp"
    7. As a precaution, untick the "Siege at Firemoth" if you have it listed as one of your Data Files in Morrowind.
    8. You can now open this TFOUT.ESP in the TES Construction Set or Morrowind itself to see if the new plugin has been changed as you wanted it.
    9. If you're curious, you can open the file called tfthlog.txt in Notepad to see a detailed list of the things TESfaith changed when building TFOUT.ESP.
    10. If you're even more curious, it is possible to get TESfaith to give a very detailed account of everything in tfthlog.txt if you go through steps (1-6) again, but this time change the tesfaith "Siege at Firemoth.esp" command in step 3 to:
    tesfaith -v "Siege at Firemoth.esp"
       and then carry out step 9 again.

    4. Further Notes

    Due to numerous requests asking whether TESfaith could be modified to fix Interior->Exterior door teleport co-ordinates when the landscape has been moved I have modified the program in an internet cafe whilst I'm travelling in Australia using a free C compiler (Cygwin). Although I used TESfaith to process ESPs that I can download from here through mutiple translations and the door co-ordinates appear correctly in the plugin file, I don't have a copy of Morrowind out here so I cannot test this in the game. Should anyone find that the Interior->Exterior Doors don't point to where they should then please email me.

    Additionally I have now modified TESfaith to modify the text of Scripts and Dialog commands if they are affected by cells being moved. Specifically TESfaith will now modify Position, PlaceItem, AITravel, AIFollow and AIEscort commands if they use co-ordinates belonging to cells that are moved. You may need to recompile these scripts in the TES Construction Set and save the plugin again to ensure the changes work - I don't have Morrowind here so I cannot verify whether you need to do this.
    If anyone experiences what they believe to be incorrect modifications to script commands then I'd be very grateful if they could email me the line that TESfaith didn't modify correctly - everything I have tested should work, but that's not to say that Morrowind will think the same. Remember that the '-d' option can be used to tell TESfaith not to modify any scripts if you find problems - you can then modify them yourself in TES CS.

    The ability to add the TESfaith command line arguments to the tfaith.cfg file has been done at the same time as has the ability for TESfaith to only save the cells, land and objects moved or copied - this is ideal for "ripping" land and its objects from another plugin or master.

    Other points to note are the following:
    1. When deleting cells from a ESP or ESM file, the object references that were placed in them are also removed. This will not delete the availability of that type of object from the original file, so if you had a NPC called "Fred" situated in cell (-20,20) and you deleted that cell, then Fred will no longer be associated with (-20,20), but the NPC will still be available in the file; You can still place that NPC elsewhere in the TES Construction Set (TCS) or using script commands in the game.

    2. A plugin (ESP) file is a 'changes' file. Deleting Cells from the ESP will remove the changes: If a cell already exists at the deleted location in the Master file, then the Master file cell will still exist.

    3. Sometimes TESfaith will fail to detect that a cell that requires processing is an external cell because it has not been assigned to a Region. The safest workaround is to assign any cells in your plugin to a region. This is a sensible thing to do anyway, since it allows you to control the weather for that cell.

    4. When using the TA or CA options to move or copy all external cells in a plugin, note that if your plugin contained changes to existing external cells contained in the master file (e.g. you added an object or modified landscape on Vvardenfell) then the change will also be moved which is probably not what you want. Use the TR/CR or TE/ME commands if you want better control.

    5. TESfaith only moves cells, objects associated with those cells and the landscape and updates Interior doors, Scripts and Dialog Script commands that pointed to the moved cells. This should take away the vast majority of work involved in relocating or duplicating all or part of a plugin. Some less used functions such as specifying AITravel or AIFollow values using the drop-down AI box on a NPC in TES CS are not currently modified.

    6. When copying Internal Cells, the name of the new cell must be of equal or smaller size to the original. If you try something larger, TESfaith will warn you of the reason and immediately exit without making any modifications. This was just to make the programming simpler and you can trivially rename the duplicated cell in TCS later. Note that it's relatively easy to copy and paste all the objects from one cell to another (interior or exterior) in TES CS anyway, so you don't have to use TESfaith to do this.

    7. There may well be internal limits to TCS or Morrowind that mean cells of very large offsets may not work. Hypothetically (2^32/8192) = +262144 to -262143 may be stored in the TES3 file and objects will still be addressible. In reality the limit may be far less (try moving cells to far off locations if you're curious about the limits).

    8. The summary at the end of TESfaith will include the total number of landscape records changed. Note that a CELL record (name and objects) and a LAND record (the landscape details) are separate records, so the summary number may appear twice the number you expected under certain circumstances. That's normal!

    5. Acknowledgements

    Although I haven't consulted anyone directly regarding the technical details of moving cells, the information already posted on the Morrowind forums was enough to give me a very good start in tackling this problem.
    So many thanks to Klinn for the first pointing me to a useful thread on moving cells in the first place, JOG for his post regarding the position and format of (x,y) co-ordinates in LAND cells and Jim Adam's Page  for a more detailed structure of the TES3 file.

    This program is provided without warranty, but you're free to distribute it as much as you please (just please remember to include me somewhere! ;)
    I doubt I'll have time to bolt a front-end on to it, though it's possible for someone to write an independent front-end that uses the '-l' option with TESfaith to dump out a list of all the cells contained within a plugin, reads this back in and writes out a rules file with all the user's requested changes and runs TESfaith on those rules ...
     

    Diolch yn Fawr. :-)
     

    Paul Halliday (aka Lightwave)

    Updated: 19-December-2006 (sixth release).


    Fifth release: 15-October-2006.
    Fourth release: 19-February-2004.
    Third release: 21-January-2004.
    Second release: 14-December-2003.
    Original release: 26-September-2003.