Skip to content

Inside Raid the Village

Raid the Village is the demo’s example of a scheme that asks the game’s own code. You send riders into a village of another clan, and the code that knows the map says which village, keeps its smoke and moves its prosperity. The scheme has 70 nodes, four Run Code nodes, one Get From Code node and one For Each Actor node that reads a method. Read it with Code methods open.

  • You want to see how a scheme and a C# method share work.
  • You want to see which parts of the demo’s map code a scheme can reach.
  • You want to know what the answer No Answer is for.

All six are in Game/Map/Interactions/MapPlace.cs, a static class MapPlace, and carry [IntrigueMethod].

Signature Used by What it does
bool? HasRaidPlace(Actor conspirator, Actor target) A requirement, A village within reach True when the target holds a province outside your realm and next to it, or anywhere when the two clans are at war. No answer without a map.
bool? TakeMapPlace(IntrigueCall call) Run Code, take, the first node Hands the place to the scheme: it reads the String variable Place, takes the province the player right-clicked when it fits, else picks one, and writes the number into Province and the name into ProvinceName. It also fills PlaceName, PlaceProsperity and PlaceUnrest. False when no province fits.
Actor CastellanOf(IntrigueCall call) Get From Code, keeper Who keeps the castle in Province: a household knight, captain, banner-lord or knight of the holding clan, the one with the most Arms. Never the clan’s head or you.
bool MarkSmoke(IntrigueCall call) Run Code, smoke Puts the modifier Smoke over the province on the head of the clan that holds it: +5 Strain for 90 days. The map draws it as smoke.
bool? ShiftPlace(IntrigueCall call) Run Code, shift and tollApply Adds the scheme’s ProsperityShift and UnrestShift to the province, each kept within 0 to 100.
List<Actor> NeighbourLords(IntrigueCall call) For Each Actor, pool From a method in code, neighbours The heads of the other clans whose land borders Province: not your realm and not the province’s own holder.

Sources: MapPlace.cs lines 91, 136, 241, 183, 167 and 305. Every method that writes does so only on the host, and only through variables and modifiers. The method comments say rows that ask whether a place exists read a click made on this machine, so they are for starting requirements.

Start
Run Code
Calls TakeMapPlace
True
False
No Answer
Show Announcement
To Conspirator, if a player
Nowhere to go
Fail Scheme
Result: Failure (ends when its flows end)
Set Objective
Ride into {scheme.ProvinceName} and come back with its harvest.
Get Role Holder
Who is Banner-Lord of Conspirator's clan → Captain
Found
Vacant
Show Dialogue
TOConspirator
Riders at dusk
Forty riders wait in the dusk below the ridge, and beyond it lies {scheme.ProvinceName}.
Take the grain, and burn what you cannot carry.
Take the grain. Leave the roofs standing.
Ride in under a flag and demand a toll instead.
Call off the ride.
Set Variable
Scheme: Burned = True
Play Sound
sfx_world_march
Only if Conspirator is a player
Wait
Wait 10 days
Chance
25% chance
Success
Failure
Get From Code
Actor from CastellanOf → Keeper
Found
Not Found
  • Start, output Start, goes to Run Code.
  • Run Code, output True, goes to Set Objective.
  • Run Code, output False, goes to Show Announcement.
  • Run Code, output No Answer, goes to Set Objective.
  • Show Announcement goes to Fail Scheme.
  • Set Objective goes to Get Role Holder.
  • Get Role Holder, output Found, goes to Show Dialogue.
  • Get Role Holder, output Vacant, goes to Show Dialogue.
  • Show Dialogue, output Take the grain, and burn what you cannot carry., goes to Set Variable.
  • Show Dialogue, output Take the grain. Leave the roofs standing., goes to Play Sound.
  • Set Variable goes to Play Sound.
  • Play Sound goes to Wait.
  • Wait goes to Chance.
  • Chance, output Success, goes to Get From Code.
The start of Raid the Village, drawn from 33-raid-the-village.json. The Chance node after the ride leads on to the ford; only its Success output continues into the keeper. The announcement's text line is left off its card.

The first node, take, runs TakeMapPlace with For set to the Conspirator and Against to the Target. Its three outputs matter. True goes on to the objective. False means no village fits, so a Show Announcement says Nowhere to go and the scheme fails. No Answer also goes on to the objective: it comes when there is no map, when the scheme lacks the variables, or when this machine is not the host (MapPlace.cs, line 138), and the scheme carries on without a place. See Run Code.

The String variable Place has the default Raid. That is how MapPlace knows which kind of place this scheme wants. Twelve map schemes of the demo call TakeMapPlace, each with its own default for Place: Raid (this scheme and Burn the Fields), Castle, Port, Abbey, Forest, Famine, Own, OwnCastle and Restless.

Fourteen variables hold the scheme’s state: the strings and numbers the code writes (Place, Province, ProvinceName, PlaceName, PlaceProsperity, PlaceUnrest, ProsperityShift, UnrestShift), three Bool flags (Burned, Spared, Toll) and three actors (Captain, Keeper, Neighbour).

You choose in a dialogue: burn what you cannot carry, take the grain only, ride in under a flag and ask a toll (this needs Cunning 5), or call it off. Then the riders wait 10 days. With a 25% chance the village has a keeper. CastellanOf finds who, and a second dialogue asks whether to charge through, toss 20 marks across the ford, or turn back. If you charge, a roll of 50% with a bonus from your Arms decides it. On a win the keeper is wounded and shamed, and you ride on. On a loss you are wounded and the raid is repelled.

After that comes a roll on the formula Raid Odds. A failure turns the raid back: your clan’s Muster falls by 50, its Host Losses rise by 50, and the target remembers Burned my villages at Strength 40. The scheme fails. A success may meet, one time in three, an old woman at the well who remembers the last raid; you may take one cart and spare the roofs.

Set Variable
Clan of Conspirator: Treasury + 80
Set Variable
Scheme: ProsperityShift = -25
Set Variable
Scheme: UnrestShift = 25
Run Code
Calls MarkSmoke
True
False
No Answer
Play Sound
sfx_world_village_burning
Only if Conspirator is a player
Run Code
Calls ShiftPlace
True
False
No Answer
Add Memory
Target remembers Burned my villages about Conspirator
Add Modifier
For Each Actor
Each
Done
Add Memory
  • Set Variable goes to Set Variable.
  • Set Variable goes to Set Variable.
  • Set Variable goes to Run Code.
  • Run Code, output True, goes to Play Sound.
  • Run Code, output False, goes to Play Sound.
  • Run Code, output No Answer, goes to Play Sound.
  • Play Sound goes to Run Code.
  • Run Code, output True, goes to Add Memory.
  • Run Code, output False, goes to Add Memory.
  • Run Code, output No Answer, goes to Add Memory.
  • Add Memory goes to Add Modifier.
  • Add Modifier goes to For Each Actor.
  • For Each Actor, output Each, goes to Add Memory.
The end of a burning raid, drawn from 33-raid-the-village.json. The steps before it are not drawn.

A burned village pays 80 into your clan’s Treasury. The scheme then sets the two shift variables, ProsperityShift to −25 and UnrestShift to 25. It does not touch the map itself. It calls MarkSmoke, then ShiftPlace, which reads those variables and changes the province. An unburned village pays 60 when its Prosperity is 60 or more and 40 when it is less, with smaller shifts. A spared village pays 20.

Then the target remembers Burned my villages about you, and you carry the modifier Raider (Esteem −5) for 360 days. The flow now splits in two. In one, a Has Trait check on you (Lumen-Sworn or Even-Handed) adds 10 to your Strain. In the other, a loop over NeighbourLords keeps the lords with the trait Lumen-Sworn and gives each the same memory at Strength 50.

The target is told with a flag announcement, Smoke over {scheme.ProvinceName}, shown if a player plays them. The scheme writes a line in that clan’s chronicle, and succeeds. An End node tells you Home with the harvest or An empty road home.

The scheme draws no map. It keeps the numbers in variables, and the code reads and writes them. The names Province and Place are the contract between the two. That is also why the same nodes work for twelve schemes, and why this scheme goes on through No Answer when there is no map.

Code methods explains the attribute, the return kinds and ReadsOnlyIntrigues. The demo’s own code lists the other methods of the demo. The nodes: Run Code, Get From Code and For Each Actor. The next scheme is Natural Death.