Guides/02

Plugins

Inspect, check, clean and compare plugin files.

A plugin is an .esp, .esm or .esl file. Each command in this section works on a whole file.

Inspect

esx plugin info MyMod.esp
esx plugin records MyMod.esp --sig WEAP --new-only
esx plugin groups MyMod.esp

Use --with Other.esp to load more plugins with the target. Use --no-masters to inspect a plugin when its masters are missing.

Save rules

A command that changes a plugin saves it in one of two ways. Without -o, the save replaces the plugin and makes the backup <name>.backup.<time> beside it. With -o FILE, the save writes FILE and does not change the plugin.

Three rules protect files. Each one gives an error with a reason in error.details.reason, and the command writes nothing.

Reason Condition What to do
OUTPUT_EXISTS -o names a file that exists and is not the plugin that the command loaded. Give --overwrite, or give a different path.
GAME_FOLDER_WRITE The file to write is in a game folder. A game folder has Fallout4.exe or Fallout4VR.exe, or is a Data folder with Fallout4.esm. Each folder in it counts. Give -o with a path outside the game folder, or give --allow-game-folder.
PLUGIN_DAMAGED The plugin has a structure fault, which the read commands show as the warning E_STRUCTURE. A save writes only the part before the fault. Get a good copy of the plugin. No option turns this rule off.
esx record set MyMod.esp edid:MyGun FULL 'My Gun' -o build/MyMod.esp
esx record set MyMod.esp edid:MyGun FULL 'My Gun' -o build/MyMod.esp --overwrite
esx plugin masters sort "$DATA/MyMod.esp" -o build/Sorted.esp
esx plugin masters sort "$DATA/MyMod.esp" --allow-game-folder

--allow-game-folder is a global option. The rule GAME_FOLDER_WRITE applies to each command that writes a file: a plugin, a SEQ file, an archive, a NIF file, a material and the others. plugin seq and plugin create write into the Data folder when they get no -o, so in a game folder they need -o or --allow-game-folder. esx build never writes into a game folder.

A save also stops with a FORMAT error when the file header of the plugin has a subrecord that the header definition does not have.

Check and clean

plugin check finds unresolved FormIDs, wrong reference types, unknown enum values and decoding errors. Add --fail-on-issues to return exit code 7 when it finds a problem.

esx plugin check MyMod.esp --fail-on-issues

plugin clean does the same work as Quick Auto Clean in xEdit. It removes records that are identical to the master. It also undeletes and disables deleted references. Without --apply, it only reports.

esx plugin clean MyMod.esp
esx plugin clean MyMod.esp --apply

Conflicts and differences

esx plugin conflicts MyMod.esp --only-conflicts
esx record conflicts MyMod.esp edid:MyWeapon
esx plugin diff Old.esp New.esp

plugin diff compares two versions of a plugin. It lists added, removed and changed records with the changed fields.

Masters

esx plugin masters list MyMod.esp
esx plugin masters add MyMod.esp DLCRobot.esm
esx plugin masters clean MyMod.esp
esx plugin masters sort MyMod.esp

esx rewrites FormIDs when you add a master.

Light plugins

esx plugin esl-check MyMod.esp
esx plugin compact-esl MyMod.esp --set-flag
esx plugin next-formid MyMod.esp

esl-check tells you if the plugin can have the ESL flag. compact-esl renumbers new records into the light plugin range.

Do not renumber the records of a released plugin. Saves and patches refer to the old IDs.

Header flags

esx plugin set-flags MyMod.esp --esm true --dry-run
esx plugin set-flags MyMod.esp --light true
esx plugin set-flags MyMod.esp --localized false -o Inline.esp

Each flag takes true or false. --light true checks that the new records are in the light plugin range, and it does not renumber them. --localized moves the text as strings localize and strings delocalize do.

Merged patch

esx loadorder merged-patch A.esp B.esp -o Patch.esp

The patch merges leveled lists, container items, faction relations and keywords.

Merge plugins

esx plugin merge A.esp B.esp -o Combined.esp --dry-run
esx plugin merge A.esp B.esp -o Combined.esp

Give the plugins in load order. For a record that more than one plugin has, the last plugin wins. esx gives a new ID to records that collide and updates the references to them. The merge stops on a partial form and on a navmesh record. It does not rename asset files or change the text of a script, so check the files that have the name of an old plugin.

Cells with precombined data

esx plugin check-precombines MyMod.esp --fail-on-issues

The game keeps combined meshes and visibility data for many cells. A change to an object in such a cell can make that data wrong. This command lists the cells that your plugin changes in this way. It does not make new data. The Creation Kit does that.