Get setup for working on scripts and scripting events for TES V: Skyrim and Fallout 4 by Bethesda Game Studios using Creation Kit and Notepad++. For scripting the Creation Kit uses “Papyrus” scripting system, and you’ll need to setup for working with the “Papyrus Compiler.” Instead of working on scripts within the Creation Kit, you may find it preferable to work an external editor like Notepad++. Sublime and Visual Studio Code also support “Papyrus” syntax highlighting. Many scripts for Skyrim may also work for Fallout 4. Review the differences on this Creation Kit wiki article.

Resources:

Familiarity with using the command prompt, archive utilities, batch files, and some scripting or programming experience is assumed. The following example is for Skyrim.

Source files and compiler setup

You’ll need the game’s Papyrus source files (extension psc) and the “Papyrus Compiler” found with Creation Kit. (And the game, of course.) You may want to backup your game’s data files in case something gets overwritten, or a mod plugin stops working correctly.

If you haven’t yet, install Creation Kit which can be found in Steam by selecting Library and Tools in the drop-down. Find “Skyrim Creation Kit” and install. In the instructions below, if you need help finding your game folder, in Steam right-click the game, select properties, view “Local Files” tab and click “Browse Local Files” button.

Script source files

The Papyrus source psc files are found in skyrim\Data\scripts\source folder. Before continuing, backup any existing source files. I also keep a clean copy of my entire Skyrim data with favorite mods on another drive for safe keeping.

Most of the source files are inside an archive, Scripts.rar found in skyrim\Data folder. If it is not there, you may need to go in Steam and refresh Skyrim Creation Kit (properties -> Local Files -> verify …).

Extract the source files from Scripts.rar into ..\skyrim\Data\scripts\source folder.

Update the compiler batch file

The compiler and batch files are located in ..\skyrim\Papyrus Compiler\ folder. Edit the ScriptCompile.bat file with correct pathing for your system, for the executable, for sources (-i), and output (-o) directories. The output folder is just one above the source. Here is an example for my system:

ScriptCompile.bat
"C:\Program Files (x86)\Steam\steamapps\common\skyrim\Papyrus Compiler\PapyrusCompiler.exe" %1 -f="TESV_Papyrus_Flags.flg" -i="C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\scripts\source" -o="C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\scripts"
pause

Update for Fallout 4:

This is what I use for the FO4 Papyrus compiler batch file. Replace the drive and folder for your system.

ScriptCompile.bat
set base=H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\source\Base
set baseFragPack=H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\source\Base\Fragments\Packages
set baseFragPerk=H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\source\Base\Fragments\Perks
set baseFragQst=H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\source\Base\Fragments\Quests
set baseFragScn=H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\source\Base\Fragments\Scenes
set baseFragTerm=H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\source\Base\Fragments\Terminals
set baseFragTpIn=H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\source\Base\Fragments\TopicInfos
set baseHard=H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\source\Base\Hardcore
set baseHardFragQst=H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\source\Base\Hardcore\Fragments\Quests
set DLC1=H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\source\DLC01\DLC01
set DLC1FragPack=H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\source\DLC01\DLC01\Fragments\Packages
set DLC1FragQst=H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\source\DLC01\DLC01\Fragments\Quests
set DLC1FragScn=H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\source\DLC01\DLC01\Fragments\Scenes
set DLC1FragTerm=H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\source\DLC01\DLC01\Fragments\Terminals
set DLC1FragTpIn=H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\source\DLC01\DLC01\Fragments\TopicInfos
set DLC4=H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\source\DLC04\DLC04
set UserScripts=H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\source\User
set LooseScripts=H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\source
set AllScripts=%~2;%base%;%baseFragPack%;%baseFragPerk%;%baseFragQst%;%baseFragScn%;%baseFragTerm%;%baseFragTpIn%;%baseHard%;%baseHardFragQst%;%DLC1%;%DLC1FragPack%;%DLC1FragQst%;%DLC1FragScn%;%DLC1FragTerm%;%DLC1FragTpIn%;%DLC4%;%UserScripts%;%LooseScripts%
"H:\SteamLibrary\steamapps\common\Fallout 4\Papyrus Compiler\PapyrusCompiler.exe" %1 -f="Institute_Papyrus_Flags.flg" -i="%AllScripts%" -o="H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts"
pause

Test compile

Try the following simple script to ensure everything is setup correctly.

HelloWorldScript.psc
Scriptname HelloWorldScript extends ObjectReference
{My first script!}
Event OnActivate(ObjectReference akActionRef)
Debug.MessageBox("Hello, World?")
endEvent

External editor setup

Notepad++

Besides editing script files, you may also launch the compiler directly from Notepad++. Very handy. For details on setting up with syntax highlighting, see www.creationkit.com/index.php?title=Notepad%2B%2B_Setup for details. I’ll go over just the basics here.

To launch compiler from Notepad++, add a new run-shortcut menu item.

  1. Start Notepad++.
  2. Select Run (F5).
  3. Paste the command below, updated with correct path for your system, into the box and save:
Run-shortcut
"C:\Program Files (x86)\Steam\steamapps\common\skyrim\Papyrus Compiler\ScriptCompile.bat" "$(FILE_NAME)" "$(CURRENT_DIRECTORY)"

For syntax highlighting, copy-paste the XML contents from the Notepad++ Setup article into a file and import under Language -> Define Your Language.

Load the test script above to ensure everything is working.

CkScriptNotepadpp

Visual Studio Code

VS Code works on Windows, OS X, or Linux with syntax highlighting for many languages and debug options for some.

  1. Install VS Code if needed.
  2. Launch VS Code.
  3. Press F1 and in the box type, “ext install papyrus” which reveals a list.
  4. Select a Papyrus extension (v0.0.1 by Andrew at this time of writing).

CkScriptVSCode