Merge Plugins xEdit Script by matortheeternal
Skyrim » Utilities
Added: 05/07/2013 - 08:24PM
Updated: 17/08/2014 - 06:55PM

2,698 Endorsements

1.65 Latest version

23,087 Unique D/Ls

31,581 Total D/Ls

181,526 Total Views

Uploaded by matortheeternal


Last updated at 18:55, 17 Aug 2014 Uploaded at 20:24, 5 Jul 2013

Have a question? There's a 99% likelihood it's already been asked. The most sureproof way to find the answer that I've already typed out at least a dozen times is to use the search function on the Nexus Mods thread. I'd also recommend you check the FAQ section.


Will <insert mod here> work?
When in doubt, try it out.
If it works - without quirks,
Let us know, our knowledge grow!

If it fails, drink some ales,
Post a report, errors to sort!


Old video available here.


For updates between official releases, please see the GitHub repository.

Version 1.6:
Another update! Why so fast? You might be wondering...

Well, we have found a way to merge mods with Navigational Data intact. YES. FINALLY. You can
now merge your player home mods without fear of NPCs getting stuck in the door! You can even
merge your dungeon, city, IMMERSIVE SETTLEMENTS, etc. mods without fear of getting CTDs! This
is it folks. The update you've all been waiting for. Almost everything merges now. YEP. Almost

This is all thanks to to the user Ablaze. He shared with me how he had found a way to manually
merge mods with NAVM/NAVI records without deleting or otherwise compromising the navmeshes.
And I automated it. And it worked. And there was cheese. LOTS OF CHEESE.

So yeah. Have fun you guys. Just avoid ESPs created or affected by third party tools (SkyRe
patchers, SUM, AutomaticVariants, TESVSnip) like the plague, and your merges should work like
magic! :)

Elaboration on New Features:
Two-pass Copying
This is a new feature introduced in v1.6. This feature can be set in the main UI window with
a checkbox, and is enabled by default. Two-pass copying works by removing all the records
after initially copying them to the merged plugin and then copying them into it again. Weird,
huh? Well, it makes merges work, so I've learned not to question it (you should too). Anywho,
as of v1.6 it can't be used to merge into an existing plugin (you'll find you only have to option
to create a new file when you use it). This is because I don't currently have a reasonable way
of tracking what records were added to the merged file and which were there before merging.
So that's a slight limitation. But it just means you need to spend a little more time merging if
you plan on merging a bunch of Player Home/Dungeon/City mods. If you disable this option I
recommend you use skipnavdata.

Asset Copying
Asset copying is automatic, and functions by looking for assets associated with each plugin you
merge in the following directories:


If a folder matching the name of a plugin file you're merging is found, the script will copy the
contents of that folder into a new folder for your merged plugin. If you chose to renumber
FormIDs, it will also change the filenames of the assets in this directory to reflect the new FormIDs
of the records the assets are associated with. This means you shouldn't get the gray-faced NPC
error anymore, but it may not be 100% foolproof (it is a new feature, after all).

This procedure will fail if TES5Edit isn't installed in it's own folder in your Skyrim directory. This
feature works with Mod Organizer (tested by users, and by myself).

Skipnavdata is an advanced merging option tells the script to delete all NAVM/NAVI records after
merging. My testing has shown that this is a relatively safe procedure, but again, this is a new
feature, so I don't know what will happen in every mod out there.

In the past, attempting to merge mods that added new cells, or modified Worldspace Navmeshes
would lead to CTDs. This caused many mods to be considered wholly "unmergeable". With
skipnavdata, many of these mods can now be merged. There is but one catch: because the
Navmeshes are gone, NPCs will be unable to navigate in the cells/worldspaces added by the
merged mods. You can rectify this if you rebuild the navmeshes for these areas in the CK. But...
most of you won't want to do that.

I tested merging Rayek's End with the Riverwood Hunting Cabin. I was able to enter and exit both
locations, and everything seemed 100% functional to me. However, I should note, I did this on a
new game. Attempting to mess around with cell-adding mods on an existing savegame is probably
going to lead to some weird stuff. To be specific: when trying my merged file on an existing
savegame the door to Rayek's end wouldn't work. I'd walk in, and I wouldn't be teleported to the
cell. I could use the coc command to get in, but the door just plain didn't work. I'm not sure if
this was due to my own bumbling about, or if it you will experience the same thing if you attempt
to merge cell-adding mods that are already present on an existing savegame.

It's been known for awhile that you can merge mod files that don't have scripts in them
using TES5Edit by renumbering the FormIDs and Deep Copying them. However, even though
this is a pretty short and simple process, some users might like it to be even easier.

This script completely automates the mod merging process in TES5Edit. Just select the mods you
want to merge, run the script, type in a name, and presto! Your mods are now in a single clean

The Limitations:
Merging certain mods may not work. As of the v1.6 update a massive number of mods that
were previously unmergeable may merge properly. More information on the v1.6 update
can be found in the v1.6 section.

You cannot merge mods with corrupted data. These are mods that were edited using a tool like
TESVSnip, a SkyProc patcher, or other third party tool which have data which is corrupted and
cannot be copied by TES5Edit. When using Check For Errors this appears in the form of
"Invalid or out of order subrecord" errors. You can attempt to fix this by opening the ESPs in
the CK as the active file at resaving them, but this may not always work. If you merge a file
with corrupted data the resulting merged file will cause CTDs when Skyrim starts.

Before installing and using this script you need TES5Edit 3.0.31 or newer (3.0.31, 3.0.32).
TES5Edit is an alternative editing program to the Creation Kit. While TES5Edit may not have some
of the cool features the creation kit has, it runs faster and allows for the execution of pascal

You can download TES5Edit here.

Once you have downloaded and installed TES5Edit you simply need to copy the contents of the
included "Edit Scripts" folder into TES5Edit's "Edit Scripts" folder. This folder is located in the
directory where TES5Edit.exe is.

1. Extract the BSAs associated with the mods you want to merge.
2. Open TES5Edit and load the mods you want to merge.
OBYRSDI: Use check for errors on files to be merged and fix any dirty edits TES5Edit finds.*
3. Hold control and click on each of the mods you want to merge so they're highlighted. This is no
longer required as of v1.4, but can still be used for fast mod selection.
4. Right on one of the mods and click "Apply Script".
5. Choose Merge Plugins v1.6 from the dropdown menu and click OK.
6. Verify the mods you want to merge are checked, and that no other mods are checked, then click OK.
7. Choose -- CREATE NEW FILE -- and click OK.
8. Enter the name you wish to use for your new file, not including the file extension.
9. After the script is finished, verify the merge worked correctly. Also verify the masters of
the merged ESP don't include the files you merged.
10. Disable the ESPs you merged from your load order and enable the merged ESP you made.

For those of you unfamiliar with how to extract BSAs:
You want to use a program like BSAOpt or FO3's Archive utility to open the BSAs in question, then
extract their contents directly into your data folder, so the folder structure matches that which
already exists in the data folder.

Verifying your Merged ESP:
The merged ESP should not have the files that were merged as masters. The script should
automatically delete these masters, but if you see the merged file has them you can remove them
manually using TES5Edit. To do this, go to the Header record, right click the blank line above a
master entry you wish to remove, and click "Remove". You should also re-open the merged ESP in
TES5Edit after merging and use Check For Errors to make sure everything is functional.

*OBYRSDI: Optional but you really should do it. Check the images section.

Right now there is one user variable you can set to adjust how the script runs. You can find this user
variable at line 30 in the "constants" section.

debug: Set this to true to make the script print more messages to the log when it runs.

Frequently Asked Questions:

Q: SkyRe? AutomaticVariants? SUM?
A: Don't touch plugins that were made or are in any way related to these mods. SkyRe was made
with TESVSnip, and is a giant mess of corrupted data. In addition, all third party patchers will create
corrupted data, which will lead to CTDs if copied in TES5Edit.

Q: Will <insert mod here> work?
A: Check the testing thread. If it's untested then there's only one way to find out... try it!
If things don't work post a report and restore your old ESPs.

Q: What mods don't merge well?
A: Mods with MCMs don't merge well. Mods which have invalid or out of order subrecord
errors will cause CTDs. Other than this, the greater majority of mods merge well.

Q: What are the benefits of merging?
A: Merging reduces ESP clutter allowing for more mods. It also makes your data directory
more manageable, so you no longer have to rip your hair out trying to find that ONE esp which is
causing you problems. It also improves performance, load times, and reduces CTDs. It's basically
the panacea for DMS: Disorganized Modder Syndrome.

Q: Why are faces grey?
A: This shouldn't happen anymore in v1.5. But if it does, you probably have to re-generate
face geometry for NPCs. Open the Creation Kit with your merged plugin as the active file, select
the NPCs in the merged plugin, and press CTRL+ALT+F4.

A: Extract the BSAs of the mods you merged. I talked about this in the "Tutorial" section.

Q: Right clicking isn't doing anything!
A: Wait for the background loader to finish loading the mods.

Q: I'm getting CTDs, why?
A: If a merge is giving you CTDs it usually means that one or more of the files you merged doesn't
like being merged. That is to say, something went wrong. You can try to isolate the problematic file
and not merge it by merging mods one at a time, which I highly recommend for everyone who doesn't
have experience merging plugin files.
OH and, if you didn't CHECK FOR ERRORS (the OBYRSDI step) you may have merged mods with
corrupted data that TES5Edit can't read, resulting in CTDs.

Q: Will this make my game explode?
A: Just make sure you only save the merged ESP and disable the ESPs you merged from your
load order when testing the merged file. If things don't work for some reason restore your old
ESPs and delete the merged file and voila, everything's back to the way it was! No harm done.

Q: Where should I put the merged file in my load order?
A: At the spot where the highest mod you merged was/should be. So if you merge mods at
positions #10, #26, and #100 you want to put the merged ESP at position #10.

Q: Herp derp?
A: Ya hinga dinga durgen!

Q: Copy Intelligently? Copy Records? Copy Groups? What are these things!?
A: Just use copy intelligently. The other two are old merging methods that advanced users
can choose to use if they so wish. You don't need to worry about them.

Q: What is corrupted data and can I fix it?
A: Mods with invalid/out of order subrecords may have corrupted data. Or, at least, data
that TES5Edit can't interpret properly. Opening these mods in the Creation Kit as the active file
and then saving them MAY fix this problem, or it may not. If you merge mods with these errors
the result in Skyrim CTDing when it starts.

Q: My hair's gone?! My armor's gone?! My weapons are gone?! My face is gone?!?! WHAAATTTT?!!!?!
A: When you merge plugins all the records associated with them are being moved to new
FormIDs. That means all save games with references to the items from the mods you merged will
have the items/objects removed. This is just the way the game works, there's nothing I can do
about it. So say you merge your hair mods and you load a save game where you had a hair from
one of those mods. You will be bald. It's no biggie though, just use showracemenu, find the hair,
and save once you've fixed your depilation dilemma. Armors: add them back. Weapons/items: add
them back. Face: uhh... o_o'? Generally speaking, however, it's probably best to start on a new
save after merging hair/object/Leveled List/NPC outfit altering mods.

Q: Should I check for errors before merging?

Q: Should I check for errors after merging?

Q: Can I merge my entire load order into a single ESP?
A: Theoretically, if all those mods didn't have problems with merging, yeah you could . But
as of now there are several types of mods that aren't merging proper quite yet, so this isn't really
realistic. It'd take awhile and if you would have a problem you would have just wasted a lot of time.

Q: Can I merge merged files?
A: Yes, just not during the same run of TES5Edit (save and quit before each new merge).
This shouldn't introduce new problems, just remember to backup so if you merge something bad
you can undo it and keep the merged file you've been working on.

Q: Can I merge ESP patches into their master file?
A: This feature is being worked on, but it's rather complicated. I wouldn't try this unless you
really know what you're doing.

Q: Can I merge a mod's patches together?
A: Yes.

Q: Should I submit user reports?
A: Please do. It takes you all of a few minutes and may be very helpful to other users.

Q: I'm getting 'Overflow while converting variant of type (Int64) into type (Integer)', why?
A: You're opening too many mods in TES5Edit. Open only the mods you want to merge.
(exceed 128 mods in TES5Edit and this will happen when attempting to get formIDs from records in
mods whose load order > 128).

Q: How do I merge into an existing merged plugin in v1.6?
A: Two-pass copying doesn't allow you to merge into an existing plugin in v1.6. To merge
into an existing plugin you either need to disable two-pass copying (this should be fine unless
you're merging mods with cell/worldspace edits ), or create an entirely new merged plugin by
selecting both the existing merged plugin and the plugin(s) you want to merge into it.

Q: What's with the file selection window?
A: If a file isn't in the dropdown list (yes, that's a dropdown list) you can't merge into it.
Choices other than -- CREATE NEW FILE -- will be added to the list if you're not using two-pass
copying and there are files loaded in TES5Edit at higher indexes then the highest index you have
selected. So if you're merging a file at the bottom of the list of loaded plugins in TES5Edit this list
won't have any options other than -- CREATE NEW FILE -- regardless of whether or not you
checked two-pass copying.

Q: I'm unable to select the Merge Plugins script from the Apply Script window/which script do I select?
A: When right click and choose apply script the window that comes up should have a
dropdown menu from which you must select Merge Plugins v1.6. DO NOT USE "Merge plugins",
this is a WIP non-functional script created by Zilav. If you do not see Merge Plugins v1.6 in the
window you're doing one of a few things wrong:
  • You're starting TES5Edit from a shortcut, which is starting it in a directory where it doesn't
  • have access to "Edit Scripts/Merge Plugins v1.6.pas". Try starting TES5Edit directly from the
    executable located in the directory as the Edit scripts folder you installed my Merge Plugins
    script into.
  • You didn't install my Merge Plugins script correctly. See the installation section.
  • Your TES5Edit is out of date (like really out of date). Make sure you have 3.0.31.

Q: Can I remove an esp from a merged plugin?
A: No. ESPs are just big packages of data. A merged plugin is just an esp that has a
combination of the data from all the ESPs you merged. You can't simply remove a piece of this
ESP unless that piece has been pre-defined in some way. This may be a possible future feature via
FormID ranges stored in the merged plugin description.

Q: mteFunctions.pas is included in both AutomationTools and the Merge Plugins script, which should I use?
A: Use the one in the Merge Plugins script. If you really want to be certain you're using
the most up to date version (all versions are backwards compatible) you can grab that from
my GitHub.

Q: When should you renumber FormIDs and when shouldn't you?
A: You should renumber formIDs 99% of the time. The other 1% is when you're merging a file
that serves as a master for other files (this is extremely complicated and I can't really support you
on it, you'll have to figure it out yourself), or when you're merging files that have already had their
FormIDs renumbered by the Merge Plugins or Renumber FormIDs for Multiple Files script to
non-overlapping ranges.

Q: How do I use this with Mod Organizer?
A: It shouldn't matter where TES5Edit is installed if you're using Mod Organizer, as Mod
Organizer will make its virtual data directory available to TES5Edit so asset copying can function
correctly regardless of TES5Edit's starting directory.

Q: TES5Edit has to be in its own folder?
A: That's how I like to organize things. TES5Edit.exe just needs to be installed somewhere
in your Skyrim directory. It could be dropped in some obscure location in your DATA folder, in its
own folder, loose by TESV.exe, etc. So long as it is contained within your Skyrim directory, and
your Skyrim directory ends in the word Skyrim, things should work out fairly well as far as the
Merge Plugins script is concerned.

Q: In previous versions of this script certain plugins didn't merge well. Is this still the case?
A: As of v1.6 a lot of stuff that used to not merge well now merges very well. We're still not
quite at 100%, but things have now reached the point where you should generally assume
everything is mergeable (albeit with some degree of legwork for certain files).

Q: Can mods with MCM menus be merged?
A: My testing has shown that they can be merged, but some of the more heavily scripted
mods with MCM menus may still cause problems. The only way to find out is to try it out.

Q: Can I use SUM/AutomaticVariants/the Reproccer on a merged plugin?
A: Yes. A merged plugin is a plugin just like any other plugin is a plugin. A merged plugin is
just a plugin with data that used to be spread out between multiple plugins.

Q: When do merge plugins cause problems?
A: Merged plugins fail/cause problems when data isn't properly copied to them by TES5Edit
or assets aren't properly made available to them. Merged plugins are plugins just like all other
plugins are plugins.

Q: Can I merge ESM files?
A: If the esm files are used by any other files in your load order you should not merge
them. If they aren't used by any other files in your load order, you can merge them. You could
merge ESMs that are used by other files in your load order if you uncheck Renumber formIDs and
then changed the master references in those files, but that's a bit difficult. Alternatively you
could open the master file and all the files that use it as a master, perform your merge with
renumbering formIDs, and then change the master references, but this is relatively untested.

Q: Can older merged plugins I made continue to work with new versions of TES5Edit/the merge plugins script?
A: Yes. You don't need to re-merge things whenever there is an update to TES5Edit/the
merge plugins script. If the merge is working, it's working.

Q: I'm getting grey faces still... why?
A: You need to extract your BSAs before merging.

Q: I got "Error in unit 'mteFuntions' on line 286..." why?
A: You installed an older version of mteFunctions.pas. Reinstall the latest version of the
merge plugins script and make sure you replace your current mteFunctions.pas with the one in v1.6.

Q: How do merge plugins behave with BOSS?
A: BOSS doesn't know how to place merged plugins in your load order. You have to
manually place them at the highest load order position of the mods you merged.

Q: Is it OK to rename merged plugins after merging?
A: Yes. It shouldn't be required by any masters, so renaming it shouldn't affect anything.

Q: How much can this reduce my load order?
A: I've heard reports of ~70% plugin reduction in load orders (insaneplumber, 357 to 104
plugins). It all depends on the mods you're using.