Custom NPC Framework
This documentation covers the complete technical specification for the Custom NPC Framework and its two companion example mods (RestoredUnusedNPCs and CyberpunkMercV) for Probably Stolen (Steam AppID 4348910).

One-Click Prompt for AI Coding Agents
If you want an AI assistant (such as Claude Code, Cursor, Windsurf, Cline, or OpenChamber) to design, write, compile, or package a new Probably Stolen custom NPC mod for you, copy and send the following prompt directly to your AI Agent:
Copy and send this prompt to your AI Agent
markdown
Please read the following two sets of technical documentation for Probably Stolen modding first:
1. Official Probably Stolen Modding Guide (project layout, mandatory manifest.xml <Assemblies> and <Capabilities /> tags, IMod lifecycle, ModLog, custom items/sounds/localization asset loading, ModHook events, and ModScanner rules):
- Quick Start: https://raw.githubusercontent.com/dragonpan2/probably-stolen-modding/main/README.md
- Advanced Modding Guide: https://raw.githubusercontent.com/dragonpan2/probably-stolen-modding/main/ModdingGuide.md
- API Changes: https://raw.githubusercontent.com/dragonpan2/probably-stolen-modding/main/APIChanges.md
2. Custom NPC Framework Complete Specification (6-step AI Agent workflow, full NpcFrameworkSdk.cs source code, all 18 Customer Subsystems, vanilla item/tag/sprite dictionaries, and full code breakdowns of both example mods):
- Workflow Guide: https://customnpc.netlify.app/en/guide/agent-workflow
- Single-File Full Context: https://customnpc.netlify.app/llms-full.txt
After reading, do not write code blindly. Walk me through the [6-Step Interactive Requirement Checklist] in the guide to confirm:
1. Mod metadata (Mod ID, display name, author) and whether the mod also needs custom items (GameItem), custom sounds, or loot table edits;
2. The new NPC identity, faction (clientFaction), and portrait source (built-in SpriteDict pool vs. custom 288x211 PNG in Textures/);
3. Spawn phase (spawnPhase), day window, cooldown days, and spawn probability;
4. Core trade intent (regular BUY, regular SELL, Wholesale lot, BarterOffer, multi-day Procurement contract, or Custom GunOrder);
5. Multi-day storyline state machine (cnpcf_ save keys) and branching outcomes;
6. World integrations (7-digit holophone contact, handwritten note, store terminal request bounty StoreRequest, next-day newspaper headline TriggerNews, interrogation/smart-glasses scan dialogue, wanted arrest cutscene, afterhour events).
Once confirmed, generate the complete C# project source code (including the zero-reference NpcFrameworkSdk.cs), manifest.xml, and Steam Workshop .vdf/.bat upload scripts, then compile and package the mod.Machine-Readable Endpoints for LLMs
- Lightweight Directory Index:
https://customnpc.netlify.app/llms.txt - Single-File Full Specification:
https://customnpc.netlify.app/llms-full.txt
Project Matrix
| Mod Name | Core Source Files | Code Size | Feature Coverage |
|---|---|---|---|
CustomNPCFramework | CustomNPCFrameworkMod.csNpcFrameworkRegistry.csNpcSaveStore.csNpcPhoneRegistry.csNpcFullFeatureKit.csNpcTraitModels.cs | ~1,820 lines | • AppDomain double-buffered pending queues + live delegate bridge• Daily 5-phase customer generation scheduler ( VeryEarly..VeryLate)• 7-step eligibility filter (day window, cooldown, once-per-save, arrest blacklist, spawn rate multiplier) • Developer debug summon with two-stage clientStack[0] front-insertion• cnpcf_-namespaced per-save key/value storyline state machine• Automatic registration of Textures/*.png into SpriteDict (Point filter + 100 PPU)• Complete Customer Subsystems toolkit (handnotes, request board, procurement, gun orders, news, afterhour, holophone) |
RestoredUnusedNPCs | RestoredUnusedNPCsMod.csNpcFrameworkSdk.cs | ~850 lines | • Restores 11 unused vanilla customers found in StoreClientListTrailer• Billy's 4-act cross-day storyline (begging for food with BarterOffer → rookie guard buying gear → Medbay theft wholesale → Internal Affairs investigation with snitch/cover endings)• 7 special-mechanic customers (Greytide Scavenger, Blood Cultist, Revolutionary Agitator, Withdrawal Addict with realtime scale reaction, Lower Levels Chemist, Underground Arms Dealer, Armed Militiaman) • Auto-stage dispatcher billy and OnDismiss stage-skip protection |
CyberpunkMercV | CyberpunkMercVMod.csNpcFrameworkSdk.cs | ~850 lines | • 5-stage narrative state machine for V from Cyberpunk 2077 (v_stage 0..5)• Act 1 Relic biochip 68% overwrite seeking neural blockers + Johnny Silverhand optics scan Easter egg • Act 2 Arasaka/Pastel convoy ambush firearm preparation • Act 3 corporate vault heist 30%-off wholesale loot + custom arrest cutscene • Act 4 Corporate Spec-Ops investigation (cover for V to unlock 4-part reward loop / betray for 300 credits) • 4-part reward loop: unlocks 2077077 holophone + delivers V's Encrypted Note + posts 450-credit request bounty + triggers next-day newspaper headline• 3-frame Relic visual glitch: v_normal / v_glitch / v_glitch2 scanline slice displacement and cyan/crimson flash |
Documentation Navigation Across 6 Subdirectories
1. Getting Started & AI Agent Guide (/en/guide/)
- AI Agent Interactive Workflow
- Quick Start: Your First Custom NPC Mod
- Customer Sprite Dimensions & Outline Spec
2. Core Architecture (/en/architecture/)
- Zero-Reference AppDomain Bridge & Hooks
- 5-Phase Customer Generation & Debug Priority
- Save State Store & Mod Configuration
- Dynamic Texture Injection & Sprite Fallbacks
3. Customer Subsystems (/en/subsystems/, 18 Dedicated Guides)
- 01. Regular Buying & Wishlists (BUY)
- 02. Regular Selling & Item Offers (SELL)
- 03. Wholesale Lot Trading (Wholesale)
- 04. Barter & Begging (BarterOffer)
- 05. Bargaining, Impatience & Perfume
- 06. Contraband, Retail Markup & Labels
- 07. Item Defect Inspection Checks
- 08. Counterfeit Expose & Chemical Grade
- 09. Realtime Scale, Counter & Showcase Hooks
- 10. Multi-Day Procurement Contracts
- 11. Custom Gunsmith Orders (GunOrder)
- 12. Handwritten Notes & Paper Documents
- 13. Store Terminal Request Board
- 14. Holophone Contacts & Dial-to-Summon
- 15. Interrogation, Smart Glasses & Bubbles
- 16. Wanted Bounties, Arrest & Security
- 17. Morning Newspaper Headlines
- 18. Afterhour Events & Nightly Hooks
4. API Reference (/en/api/)
- NpcFrameworkSdk Complete Reference
- ApplyClientProfile 46-Field Dictionary
- Vanilla StoreClient & Dialogue Classes
5. Example Projects Breakdown (/en/examples/)
- RestoredUnusedNPCs: Billy 4-Act Storyline
- RestoredUnusedNPCs: 7 Special Customers
- CyberpunkMercV: 5-Stage Storyline & State Machine
- CyberpunkMercV: Rewards Loop & Relic Glitch