Skip to content

Recipes

Start from the result you want. The main recipes now have their own short pages with minimal code → expected result → common failure → evidence boundary → deep reference.

HOW
Practical

Practical recipes

Start from the result. A recipe gives the smallest path, expected result, common failure, and only then sends you into full API reference.

task → recipe → evidence
Showing 12 of 12
MOD
NEW · BeginnerVerified · WBML structure
Build a first minimal NML mod

`mod.json` + `Main.cs` + one Player.log line. No game mechanics until the skeleton proves it loaded.

Open step-by-step recipe →
SAVE
NEW · BeginnerVerified · WBML-0001/0003
Save a number on a kingdom

Write an `int`, read a fallback, and understand exactly what survived save/load and restart.

Open step-by-step recipe →
PARTY
MID · IntermediateVerified · WBML-0003
Store data on a specific party

Typed party data, stable party ID, missing-party fallback, and inactive/reactivate lifecycle.

Open step-by-step recipe →
EVENT
MID · IntermediateVerified · WBML-0004
Subscribe to a political event

Minimal subscription, payload, unsubscribe, and the rule: do not guess event fields.

Open step-by-step recipe →
ACT
MID · IntermediateVerified · WBML-0005
Create an action with a condition

Register an action, check `CanExecute`, run the handler, and avoid the same-ID replacement trap.

Open step-by-step recipe →
LOG
NEW · BeginnerVerified · browser-local
Read Player.log

Start with versions and the error signature, then jump to the relevant troubleshooting guide — without uploading the file.

Open step-by-step recipe →
UI
MID · IntermediateCase study · TerraForge
Clone vanilla UI more safely

Why an active clone crashed in `Awake()` and how to separate visual structure from unsafe MonoBehaviours.

Open step-by-step recipe →
WORLD
MID · IntermediateVerified · TerraForge probe
Change WorldTile height

Write to verified terrain-height storage and avoid the old `health` mistake.

Open step-by-step recipe →
TAG
NEW · BeginnerVerified · WBML-0001/0003
Choose shared vs private tags

Decide when a tag should be visible to other mods and when it should belong only to your addon.

Open step-by-step recipe →
LOOP
MID · IntermediateVerified · Political World case
Break recursive initialization

A real StackOverflow case: getter and setter call each other during first initialization.

Open step-by-step recipe →
POLL
MID · IntermediateCase study · architecture guide
Move from polling to events

When an event is better than continuously scanning kingdoms and how that simplifies an addon.

Open step-by-step recipe →
DIAG
MID · IntermediateObserved · PW diagnostics
Read Political World diagnostics

Separate validation, callback errors, warnings, and the observed diagnostics-bookkeeping mismatch.

Open step-by-step recipe →
  1. Pick the closest task even if your wording is different.
  2. Make the minimal version work before adding architecture.
  3. Read the expected result and common-failure section.
  4. Follow the full API/case-study link only when you need the deeper contract.
  5. If your runtime disagrees, capture Player.log and treat it as a compatibility question rather than silently guessing.