Guides/09

Papyrus and Creation Kit tools

Compile Papyrus scripts, check the scripts of a plugin and run the installed Creation Kit tools.

esx has no Papyrus compiler of its own. esx ck compile runs the compiler of your installed Creation Kit. The commands that read a compiled script (a PEX file) need no Creation Kit.

Check the tools

esx ck doctor
esx ck setup

ck doctor checks the files of the game and the Creation Kit, and starts no program. ck setup prepares the tool state. On Windows, esx runs the tools directly. On Linux, it runs them through Proton in a prefix that esx owns. That prefix is not the prefix of the game. esx downloads nothing. When it does not find the game, give the folder:

esx --game-path '/path/to/Fallout 4' ck doctor

Compile

esx ck compile papyrus/MyQuest.psc -I papyrus -o build/Data/Scripts
esx ck compile papyrus --all -o build/Data/Scripts --release --final

--all compiles each source in a folder. -I adds an import folder, and you can repeat it. Your import folders come before the sources of the game. esx checks each compiled file before it publishes it. --overwrite replaces files that exist. A job stops after 300 seconds, and --timeout SECONDS changes that limit.

The compiler makes a PEX file. It does not attach the script to a record. You do that with the VMAD data of the record, as you edit any other field.

In a project folder, esx build compiles the papyrus/ folder. See Project and build.

Read a compiled script

esx papyrus inspect MyQuest.pex

The report has the objects of the file with their parent, structs, properties and function signatures. esx does not decompile the code.

Check the scripts of a plugin

esx plugin check-scripts MyQuest.esp --fail-on-issues

This command compares the script data of each record with the compiled scripts. It checks the script names, the property names, the property types and the names of the fragment functions. It reads the compiled script that wins in the loose files and the archives, and it follows parent scripts. Give --archive FILE for scripts in an archive that the load order does not name. With --fail-on-issues, the exit code is 7 when it finds a problem. The command does not run a script, so it cannot tell if a quest works.

Startup quests

A quest that starts with the game needs a SEQ file. plugin seq writes it:

esx plugin seq MyQuest.esp -o Seq/MyQuest.seq --dry-run
esx plugin seq MyQuest.esp -o Seq/MyQuest.seq

Always give -o. Without it, the file goes into the Seq folder of the game Data folder.

esx build does not write this file. In a project folder, make the plugin first, write the file into the assets, then build:

esx build --until records
esx plugin seq build/records/MyQuest.esp -o assets/Seq/MyQuest.seq
esx build
esx loadorder check-info-links MyQuest.esp

Each dialogue response can name the response before it. This command finds links that form a cycle and links to a response that is missing or deleted. The exit code is 7 when it finds a problem.

Other tools

Command Use
esx ck archive pack, esx ck archive extract Run Archive2. esx archive pack does the same work with no Creation Kit.
esx ck plugin export, esx ck plugin build Change a plugin into Spriggit JSON files and back, to keep a plugin in Git. They need Spriggit.Json.Fallout4 0.41.0, which you give with --spriggit.
esx ck anim-info Make animation data with the Creation Kit, to compare it with a behavior build. A behavior build does not need it.

esx has no command for FaceGen, navmesh, lip files, precombines or previs. Do those tasks in the Creation Kit.