Part 1: For modders · 8 sections · page built 2026-12-05 00:35 UTC
Follow the tutorial mod Second Wind from an empty project to a checked build that is ready for PC and for a Creations upload. sf-mod-build makes the project and builds it, BuildKit writes the plugin, and sf-mod-check, sf-papyrus-ref and sf-cut-check check the result.
Richard is modding
- Try Richard's mods at Creations and Nexus Mods.
- Need help with Richard's mods? Visit Help Richard Help You.
What's new
- 2026-12-03. The page now has a Richard is modding panel that links to Richard's mods at Creations and Nexus Mods, and to Help Richard Help You.
- 2026-11-29. This page has a new look, the same as the other Richard Presents pages, with a menu that lights the section you are reading, a short summary at the top and this What's new box.
- 1Make the project from the starter template.
- 2Write the script and the builder.
- 3Build it with one command.
- 4Run the checks, including the Creations ones.
- 5Write the test plan and play-test it.
What you need
- sf-mod-build 0.7.2 and its starter template, BuildKit (the template pins BuildKit 0.6.2, and the build restores it from NuGet, with Mutagen 0.54.4), sf-mod-check 0.30.0, sf-papyrus-ref 0.2.4, sf-cut-check 0.2.1 and sf-test-plan 0.5.1. Install them and put their folders on PATH as in Getting started.
- Starfield on Steam with the Creation Kit (CK) installed from Steam. sf-mod-build uses the CK's Papyrus compiler, Archive2 and
ContentResources.zip. The CK exists only on Steam, so you build on Steam. A mod built against Steam's Data folder also works on Game Pass. - The .NET 9 SDK and Python 3.10 or newer (for sf-test-plan; sf-papyrus-ref needs 3.9 or newer).
- The tutorial's source, if you want to follow along exactly. It is in the folder
examples/PMTTutorialSecondWind/of this guide's repository (https://github.com/taosecurity/starfield-pmt-guide). ItsWALKTHROUGH.mdrecords every command and its real output from 2026-11-24. - Nothing to back up yet: the build writes only inside your project folder and never in the game folder.
The tutorial mod
Second Wind (PMTTutorialSecondWind) is a small mechanics mod. When an enemy hits you while your health is below 25 percent in combat, you regenerate 10 Health a second for 10 seconds, and the HUD says "Second wind!". It can happen once every 120 seconds. Version 0.1.0 passed its in-game test on 2026-11-24.
- Records, all the mod's own: a quest that starts with the game and runs one script, a magic effect and a spell that restore Health, a HUD message, and a "Show Debug Messages (PC only)" switch in the mod's own Gameplay Options group (off by default). It changes no vanilla record.
- Script:
PTSW:SecondWindQuestScriptregisters for hit events on the player, then checks combat, health and a 120-second cooldown timer. It logs withDebug.Traceand the prefix[PTSW]. - Console-ready text: what the player must see is a Message record shown with
Message.Show(), which works on Xbox and PlayStation.Debug.Notificationappears only behind the debug switch, as PC-only troubleshooting.
Steps
1. Make the project
In the folder where you keep your mods, make the project from the starter template with your own prefix, then check your setup. doctor is read-only. It finds the game, the CK tools, .NET and sf-mod-check, and it prints the INI lines to add for Papyrus logging.
dotnet new sfmod -n PMTTutorialSecondWind --prefix PTSW --mod-author "PMT Guide"
cd PMTTutorialSecondWind
sf-mod-build doctorRESULT: OK, ready to build (with 3 WARNINGS: see above)The warnings in the tutorial run were setup advice for playing and for the CK, not build problems. The starter project builds unchanged on the first try. The 0.7.2 template pins BuildKit 0.6.2 and Mutagen 0.54.4 in Builder\*.csproj, so you don't need to edit that file. sf-mod-build's release notes for version 0.7.0 (2026-12-01) name the BuildKit pin, and the starter mod builds with no code change.
2. Look up every name before you write it
Before you write a Papyrus call, look it up. sf-papyrus-ref answers offline and gives the call's flags (for example DebugOnly, which means consoles ignore it). Run build-local once to add signatures from your own CK sources.
sf-papyrus-ref build-local
sf-papyrus-ref lookup ScriptObject.RegisterForHitEventThe launcher sf-papyrus-ref works from any folder once the tool's folder is on PATH. From inside the tool's folder, python -I sf_papyrus_ref.py is the same command.
The mod also points at two vanilla records, the Health actor value and the EitherHand equip type, and changes neither. sf-mod-check's find looks a record up by Editor ID or FormID in your load order and prints its FormKey, type, the plugin that defines it and the plugin that wins it. It only reads.
sf-mod-check find Health
sf-mod-check find EitherHandWith sf-mod-check 0.16.1, find Health prints Health [0002D4:Starfield.esm] AVIF "Health" and find EitherHand prints EitherHand [013F44:Starfield.esm] EQUP. The builder finds the same records with BuildKit's GameData.Get<T>(editorId).
To list records by a value instead of by name, use find --type with --where "<field> <op> <value>" (sf-mod-check 0.27.0, released 2026-11-27). The operators are =, !=, ~ (contains), has and exists, and several --where filters must all match. A field name that doesn't exist is refused, and the message lists the fields of that record type. --editorid-match <regex> lists records by EditorID.
sf-mod-check find --type NPC_ --where "Flags has Unique"
sf-mod-check find --type MISC --editorid-match "^MyMod_"To see what a vanilla cell holds, or what stands near a point, use sf-mod-check cell <cell> (give the cell's EditorID, FormKey or FormID; with --plugin, use the EditorID or FormKey) or sf-mod-check cell --near <worldspace> <x> <y> <radius>. Each object shows its base record, position, flags, enable parent and the plugins that placed and changed it, and the persistent ones are marked as anchors a quest alias or a MoveTo can use.
3. Write the script and the builder
Replace the starter script with Scripts\Source\PTSW\SecondWindQuestScript.psc and replace Builder\Program.cs. Both are in the tutorial folder. Keep the starter's Log() function, which writes Debug.Trace lines with the mod's prefix. The builder keeps the starter's quest and debug switch and adds the magic effect, the spell, the HUD message (Messages.Hud) and the script's properties. BuildKit's FixEffects write option fills the spell's effect data the way the CK does.
Then turn on the Xbox archives: in sfmod.json, change "xbox": false, to "xbox": true,.
4. Build
validate shows what a build would use, including the runs: lines. build then compiles the script, runs the builder, packs the BA2 archives, writes the zip and runs sf-mod-check's release check, stopping at the first failure.
sf-mod-build validate
sf-mod-build buildRESULT: OK, built C:\Mods\PMTTutorialSecondWind\PMTTutorialSecondWind-0.1.0.zipWith "xbox": true, the build also writes the Creations set into creations-out: the plugin, PMTTutorialSecondWind - Main.ba2 and PMTTutorialSecondWind - Main_xbox.ba2. Since 0.4.2, build shows the result of BuildKit's gap check (gap check: RESULT: ...) without extra options. Add --verbose to see the builder's other lines, such as what FixEffects changed. Since sf-mod-build 0.7.0, a build with "xbox": true also writes <plugin> - Main_ps.ba2 in creations-out, a copy of the PC Main archive for PlayStation 5. PS5 reads PC-format files except audio, and there is no _ps Textures archive, so a mod with voice files still needs a PS5 audio test. Each zip also comes with a <zip>.files.sha256 file in sha256sum format, and since version 0.7.0 the zip's entry times follow the mod's last git commit (the newest file going in when there is no git) instead of a fixed date in 2000, so the same files from the same commit give the same zip bytes. Release a mod shows verify, which compares a zip with another zip, a folder or the game's Data folder.
sf-mod-build build --verbose5. Check the plugin
check tests structure, links, conditions and assets. gap looks for data Mutagen loses when it writes a plugin, which matters for every plugin written from code.
sf-mod-check check dist\PMTTutorialSecondWind.esm
sf-mod-check gap dist\PMTTutorialSecondWind.esmRESULT: OK, 0 errors, 0 warnings (PMTTutorialSecondWind.esm: 6 records, 8 links; 4.8 s)
RESULT: OK (0 errors, 0 warnings)These lines come from sf-mod-check 0.16.1 on the tutorial's 0.1.0 plugin, run on 2026-11-24. The time varies from run to run. A plugin made from the unchanged starter has 3 records and 2 links, so expect smaller counts until you add your own records.
6. Check the scripts for consoles
check --creations reports calls that do nothing on Xbox and PlayStation. In 0.2.4, Debug.Trace, Debug.Notification and Debug.MessageBox are warnings, and any other DebugOnly call is an error. A run with only warnings exits 0, so the starter's debug pattern passes without --allow.
sf-papyrus-ref check Scripts --creationsOn Second Wind's script, 0.2.4 reports 0 errors and 2 warnings (the Debug.Trace and the Debug.Notification behind the debug switch) and exits 0. Both are PC-only logging by design.
7. Run the Creations release check on creations-out
Run the Creations profile on the creations-out folder, not on the zip. The zip is the PC download for Vortex and Mod Organizer 2 (MO2), so it has no Xbox archive, and the profile warns about that. The build writes creations-out only when sfmod.json has "xbox": true (step 3). Without it, the command stops with RESULT: CANNOT CHECK (creations-out: no such file) and exit 2.
sf-mod-check release creations-out --profile creationsNOTE [creations-xbox] creations-out: Xbox archive present: PMTTutorialSecondWind - Main_xbox.ba2.
RESULT: OK (0 problems, 0 to review, 0 warnings)The not-a-zip NOTE on this run is expected: the zip-only rules don't apply to a folder. sf-mod-build 0.7.2 doesn't run this check itself. A build with "xbox": true ends with a note that says so and prints this command with the full path of your creations-out folder.
8. Check that the game can reach every record
scan --plugin reports records your mod adds but nothing uses. The first run scans the official files and takes two to three minutes. Later runs take seconds.
sf-cut-check scan --plugin dist\PMTTutorialSecondWind.esm --out C:\Scratch\cutcheck-swRESULT: PMTTutorialSecondWind.esm adds 6 records, and the game reaches all of them. None is reached only through a recipe, research project or condition check. None is reached only from test cells.9. Write the test plan
Start a plan and replace the starter steps with your own:
sf-test-plan new PMTTutorialSecondWind.testplan.md --mod PMTTutorialSecondWindUnder each step that the mod's log can prove, add a log: <id> line, for example log: second-wind. rules writes one rule for each of those ids, so run it only after you add them. On the starter plan, which has no log: lines, it prints 0 log ids on 0 steps, writes no file, and the next two commands then stop with exit 2 because the rule file doesn't exist. Then make the rule file, edit each rule's pattern to match the real log line (for example \[PTSW\] for a bracketed prefix), because rules only guesses, and check and build the plan with it:
sf-test-plan rules PMTTutorialSecondWind.testplan.md --prefix PTSW --plugin PMTTutorialSecondWind.esm
sf-test-plan check PMTTutorialSecondWind.testplan.md --rules PMTTutorialSecondWind.logrules.json
sf-test-plan build PMTTutorialSecondWind.testplan.md --rules PMTTutorialSecondWind.logrules.jsonThe tutorial's plan has 4 groups, 9 checks and 5 smoke steps. On it, rules reports 4 log ids on 6 steps. rules never replaces an existing rule file unless you add --force. Testing, collecting the logs and reading them are on Test and debug a mod.
Reading the results
- sf-mod-build. Every command ends with a
RESULT:line. Exit 0 is OK, 1 means the build or the check failed, and 2 means bad input or setup. - sf-mod-check.
checkexits 0 with no errors, 1 with errors and 2 when it can't check.releaseexits 0 for OK, 1 for FAIL and 2 when it can't check. A WARNING doesn't fail a release, but read it: on the PC zip, thecreations-xboxWARNING just means you checked the wrong set. - sf-papyrus-ref.
checkexits 0 when it found no errors (warnings are fine) and 1 when it found an error.lookupexits 0 when the name is found and 1 when it isn't, and then suggests near matches. The Papyrus compiler is still the final judge. - sf-cut-check. Since version 0.2.1, the RESULT line also names how many dead records the run left out (placed references, cells, keywords and other structure records, which
--all-typesadds) and says "all of its content records" when it did. Exit 0 means every record is reached. Exit 1 means some record is Orphaned or Unreferenced, which means nothing in the plugins uses it. A record that only your script fetches can look unused, because scripts aren't read.
What "console-ready" means here
- Player-facing text is a Message record shown with
Message.Show(). Debug.Traceand on-screen debug lines are PC-only troubleshooting, behind a switch that is off by default."xbox": truemakes the_xboxarchive increations-out.sf-mod-check release creations-out --profile creationspasses, andsf-papyrus-ref check Scripts --creationsexits 0.
When PMT isn't enough
PMT runs on a PC. It doesn't test on a console, and it never uploads. The Creation Kit does the Creations upload, and you test the console build on the console by hand.
sf-mod-build is tested on PC (Steam) and Xbox. PS5 is not tested, and that is a known limit. PMT makes and checks the Xbox archives, and sf-mod-check's creations profile applies the rules that hold on every platform. Since sf-mod-build 0.7.0, a build with "xbox": true also writes <plugin> - Main_ps.ba2 in creations-out, a copy of the PC Main archive for PlayStation 5. PS5 reads PC-format files except audio, and there is no _ps Textures archive, so a mod with voice files still needs a PS5 audio test. For PlayStation, follow what the Creation Kit asks for during its upload.
Art and sound must already be in game formats: textures as .dds and sounds as .wem. sf-mod-build doesn't convert them, with one exception: since version 0.6.0, its voice step makes the .wem voice files and .ffxanim lip files of new dialogue lines from your WAVs, with no Creation Kit window (see Build a quest mod). Those are PC files. A PC .wem is silent on consoles, and the voice section is refused with "xbox": true. The Creation Kit converts the other assets, and console (Xbox) voice audio is still made in the Creation Kit.
Never compile with -release. It strips every Debug call, so your log goes silent. sf-mod-build never uses it.
For CK and xEdit authors
Make the same records in the CK: a start-game-enabled quest with the script attached, the magic effect and spell, the Message, and a Gameplay Options switch. Then run steps 5 to 9 on the CK's plugin and your compiled scripts. Skip gap, which is for plugins written with Mutagen. For the Creations check, point release --profile creations at the folder that holds the plugin and the archives you will upload.
For code builders
Start from dotnet new sfmod, keep the template's BuildKit 0.6.2 and Mutagen 0.54.4 pins (move the BuildKit pin only when a release's notes say it is safe), and commit ids.lock.json with the builder so your FormIDs stay the same between builds. Use Messages.Hud for player text and GameplayOptions.Debug for the switch. A magic effect has no BuildKit helper yet, so the tutorial's Program.cs builds it with plain Mutagen. It copies the shape of the game's own restore-health effects: Value Modifier, Fire and Forget, Self, No Area. Two BuildKit details to know when you update the pin. Since BuildKit 0.6.2, the description of an on/off option such as the debug switch ends with DISABLE: Default value of this option. or ENABLE: ..., the two values the game shows, where earlier builds wrote OFF or ON. A mod rebuilt with 0.6.2 differs from its 0.6.1 build in those description lines, so don't take that difference for a regression. Since BuildKit 0.6.3, new GameData(dataDir, extraDirs) throws DirectoryNotFoundException for an extra folder that doesn't exist, where 0.6.2 skipped it quietly, so pass an optional folder only when it exists (for example extraDirs.Where(Directory.Exists)).