Quick Start: Your First Custom NPC Mod
Building on the base modding rules in the official repository dragonpan2/probably-stolen-modding (README.md and ModdingGuide.md), this guide walks you through creating a buildable, scanner-compliant custom NPC mod that requires zero assembly references to CustomNPCFramework.dll and zero extra security capabilities.
1. Folder Structure
Inside the game installation folder (next to Probably Stolen.exe), Modding/ holds source projects and Mods/ holds runtime mod folders:
Probably Stolen/
├── Probably Stolen.exe
├── dev.txt # Optional empty file: enables F8 Debug Console and F9 Dev Menu
├── Mods/
│ ├── MyCustomNPCPack/
│ │ ├── MyCustomNPCPack.dll
│ │ ├── manifest.xml
│ │ ├── preview.png
│ │ └── Textures/
│ │ └── my_npc.png
│ ├── MyCustomNPCPack.vdf
│ └── MyCustomNPCPack.bat
└── Modding/
└── MyCustomNPCPack/
├── MyCustomNPCPack.csproj
├── NpcFrameworkSdk.cs
├── MyCustomNPCPackMod.cs
└── manifest.xml2. Project File (.csproj)
Target netstandard2.1 and reference the game assemblies with <Private>false</Private> so they are never copied into your mod output folder:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<AssemblyName>MyCustomNPCPack</AssemblyName>
<RootNamespace>MyCustomNPCPack</RootNamespace>
<LangVersion>latest</LangVersion>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
<ManagedDir Condition="'$(ManagedDir)' == ''">$(MSBuildProjectDirectory)/../../Probably Stolen_Data/Managed</ManagedDir>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>$(ManagedDir)/Assembly-CSharp.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine">
<HintPath>$(ManagedDir)/UnityEngine.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>$(ManagedDir)/UnityEngine.CoreModule.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="0Harmony">
<HintPath>$(ManagedDir)/0Harmony.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>
</Project>3. Mandatory manifest.xml
Follow the official <Manifest> schema with <GameVersions>, <Prerequisites>, <Assemblies>, and an empty <Capabilities /> element:
<?xml version="1.0" encoding="utf-8"?>
<Manifest>
<ID>my_custom_npc_pack</ID>
<Name>我的自定义NPC扩展包 / My Custom NPC Pack</Name>
<Author>YourName</Author>
<ModVersion>1.0.0</ModVersion>
<Description>Custom NPC and storyline add-on built on Custom NPC Framework.</Description>
<GameVersions>
<Version>0.46</Version>
</GameVersions>
<Prerequisites>
<Mod>CustomNPCFramework</Mod>
</Prerequisites>
<Assemblies>
<Assembly>MyCustomNPCPack.dll</Assembly>
</Assemblies>
<Capabilities />
</Manifest>4. Implementing IMod and Registering an NPC
Copy NpcFrameworkSdk.cs into your project folder, then implement IMod using ModLog:
using System;
using UnityEngine;
namespace MyCustomNPCPack
{
public class MyCustomNPCPackMod : IMod
{
private ModLog _log;
public void Init(ModManifest manifest)
{
_log = new ModLog(manifest);
RegisterAllNpcs();
_log.Log("Initialized.");
}
public void OnEnable()
{
RegisterAllNpcs();
_log?.Log("Enabled.");
}
public void OnDisable() { }
private static string T(string zh, string en) => NpcFrameworkSdk.T(zh, en);
private static void RegisterAllNpcs()
{
NpcFrameworkSdk.RegisterNpc(
id: "back_alley_doc",
displayNameGetter: () => T("暗巷黑医", "Back-Alley Ripperdoc"),
spawnPhase: 2,
priority: 55,
minDay: 2,
cooldownDays: 3,
spawnChancePercent: 40,
oncePerSave: false,
canSpawnPredicate: () => true,
clientFactory: CreateBackAlleyDoc);
}
private static StoreClient CreateBackAlleyDoc()
{
var sc = new StoreClient
{
identifier = "back_alley_doc",
displayName = T("暗巷黑医", "Back-Alley Doc"),
spriteName = SpriteDict.GetRandomMedSpriteName(),
clientFaction = "FACTION_BLACK_MARKET",
clientIntent = StoreClient.ClientIntent.BUY,
buyPriceModifier = 35,
CanExposeChem = true,
staysAfterFailedBargain = true
};
sc.SetBudget(420);
sc.clientBuyingTagList.Add("MEDICAL");
sc.clientBuyingIdList.Add("blood_bag");
sc.clientBuyingIdList.Add("blue_blood_bag");
sc.AddCheck("CHECK_EXPIRED");
sc.mainDialogue
.SetText(sc.displayName, T("嘘……我诊所今晚有台急诊义体移植手术。", "Keep your voice down. Got an emergency implant surgery tonight."))
.NextDialogue()
.SetText(sc.displayName, T("你这儿有未过期的血袋或紫色针剂吗?我出高价收。", "Got any unexpired blood bags or purple injectors? Paying top credit."));
sc.placeRightItemWhenSellingToDialogue = new Dialogue()
.SetText(sc.displayName, T("保存得很完好,正是手术急需的批次。", "Clean seal. Exactly what I need for the operating table."));
sc.acceptDealDialogue = new Dialogue()
.SetText(sc.displayName, T("谢了,这笔药能救回一条命。", "Thanks. These supplies will save a life tonight."))
.SetEndAction(() => NpcFrameworkSdk.AddSaveInt("doc_deals", 1, 0));
sc.interogationDialogue = new Dialogue()
.SetText(sc.displayName, T("下层区医院早就断供了,不去黑市淘药,伤员只能等死。", "Lower Levels clinics ran dry months ago."));
sc.glasseDialogue = new Dialogue()
.SetText("PLAYER", T("(他的白大褂袖口藏着精密手术刀,双手稳得没有一丝颤抖。)", "(Surgical scalpels are tucked inside his cuffs; his hands are impossibly steady.)"));
sc.CompleteClientCreation(false);
return sc;
}
}
}