About this mod
Command files to compile scripts with CreationKit PapyrusCompiler.exe
- Permissions and credits
- Changelogs
PREPARE
This assumes the default [ C:\Program Files (x86)\Steam\steamapps\common\Starfield ] is your starfield.exe folder path. If not then you need to replace that text with wherever starfield.exe is on your system in all the following path statements.
(1) Install Starfield CreationKit from Steam.
(2) Check file exists:
C:\Program Files (x86)\Steam\steamapps\common\Starfield\Tools\Papyrus Compiler\PapyrusCompiler.exe
(3) Check file exists:
C:\Program Files (x86)\Steam\steamapps\common\Starfield\Tools\ContentResources.zip
(4) Create Folders:
C:\Program Files (x86)\Steam\steamapps\common\Starfield\Data\Scripts
C:\Program Files (x86)\Steam\steamapps\common\Starfield\Data\Scripts\Source
C:\Program Files (x86)\Steam\steamapps\common\Starfield\Data\Scripts\Source\Base
C:\Program Files (x86)\Steam\steamapps\common\Starfield\Data\Scripts\Source\User
(5) Copy the contents of archive folder:
C:\Program Files (x86)\Steam\steamapps\common\Starfield\Tools\ContentResources.zip\Scripts
to folder:
C:\Program Files (x86)\Steam\steamapps\common\Starfield\Data\Scripts\Source\Base
(6) Extract the command files from this download to:
C:\Program Files (x86)\Steam\steamapps\common\Starfield\Data\Scripts\Source\User
(7) Edit each of the command file :PATHS section to match your actual paths.
(8) Create and edit your own scripts in:
C:\Program Files (x86)\Steam\steamapps\common\Starfield\Data\Scripts\Source\User
If you want to use namespaces (I dont) you will need to invest in that setup yourself.
(9) The compile command files are:
PapyrusCompileDebug.cmd can take a command line filename (e.g. from Notepad++) or prompt to compile a single filename.psc for debug.
PapyrusCompileRelease.cmd can take a command line filename (e.g. from Notepad++) or prompt to compile a single filename.psc for release.
PapyrusCompilePrefixDebug.cmd prompts for file prefix (e.g. SKK_FSNG*) to compile a series of files for debug.
PapyrusCompilePrefixRelease.cmd prompts for file prefix (e.g. SKK_FSNG*) to compile a series of files for release.
COMPILING TEST AND DEBUG CODE
If you have ever, ahem, published scripts with a crap-tonne of test harness and debug code still active just append ;debugdebug to any non production code blocks or lines. They will be detected and reported by the release compiler command files as a handy reminder.
NOTEPAD++ INTEGRATION
If you use Notepad++ to edit scripts, in that application
Menu: Run: Run: [ Program to Run ] "YourSCRIPTPATH\PapyrusCompileDebug.cmd" $(FILE_NAME)
"C:\Program Files (x86)\Steam\steamapps\common\Starfield\Data\Scripts\Source\User\PapyrusCompileDebug.cmd" $(FILE_NAME)
Then [ Save ] a name like Starfield Debug.
Menu: Run: Run: [ Program to Run ] "YourSCRIPTPATH\PapyrusCompileRelease.cmd" $(FILE_NAME)
"C:\Program Files (x86)\Steam\steamapps\common\Starfield\Data\Scripts\Source\User\PapyrusCompileRelease.cmd" $(FILE_NAME)
Then [ Save ] a name like Starfield Release.
SCRIPTSEARCH
Most learning comes from looking at base game scripts to see how functions are used. To help with that try StarfieldScriptSearch.cmd in the download archive. Put anywhere, edit the PATHS section to match your configuration.
Use to find which base game scripts use a particular function, or instances of a function in your scripts.
OTHER OBSERVATIONS
You will of course need to enable loose files to see your new compiled PEX scripts in game before packing them in neat BA2 archives for publishing.
You will undoubtably be wanting to enable the Papyrus Debug.Trace log to see what is happening.
To decompile PEX script files refer to Papyrus decompile and compile command files with Caprica
Should you use Caprica.exe or PapyrusCompiler.exe ? The scripts I compiled with Caprica.exe back in November 2023 are still working totally fine. But Caprica has some unusual behaviours and does not support the GUARD functionality, I have switched all compiling over to the CreationKit PapyrusCompiler.
If you dont know/use the console command [ ReloadScript scriptname ] to hot-reload recompiled scripts during real-time test/remediation give yourself a slap for the many hours of unnecessary game exit & reloads.
If you find this useful, payback by never distributing hacked base game scripts without clearly informing users you are distributing hacked base game scripts. There really is no need (unless you are the Unofficial Community Patch) as they can 99.9% of the time be non-invasively wrapped with sufficient consideration.
KNOWN ISSUES & FAQ
(1) this all works the same for Fallout 4 if you replace the word "starfield" with "fallout 4"
(2) If you are not a Papyrus script developer this is not for you.
(3) If you dont know what your "starfield.exe folder path" is or means this is not for you.