Source-first reverse engineering of a mainline Battle for Wesnoth campaign
15 — A New Land
A nonlethal survival scenario ending on the first death, powered by a custom Lua AI that attacks aggressively only when the attacker has zero chance of dying.
After the fleet finally reaches the Great Continent, the refugees land in the middle of an elven–dwarven territorial dispute. The elves accuse dwarven colonists of violating an ancient treaty; Dursil argues that the dwarves have outgrown their northern mines and rejects elven control over southern forest resources.
The arrival of many human ships temporarily unites the continental factions against the refugees. Haldric repeatedly attempts his practiced peace speech, but the situation becomes violent before diplomacy can begin. The first death brings Lady Dionli, who stops the battle, recognizes the newcomers as kin to the earlier Prince of Southbay, orders the dwarves north, and summons Haldric to the Ka’lian.
Dialogue beat
Function
Elven–dwarven treaty dispute
Introduces the continent’s existing political and resource tensions.
Fleet mistaken for invasion
Places the refugees into conflict without making either local people inherently villainous.
Burin’s realization
Reveals that he traveled all the way around the world.
Dionli’s intervention
Ends the battle at the first death and redirects the story toward diplomacy.
Typhon’s departure
Closes the merfolk escort relationship and changes roster access by difficulty.
Fleet sent back west
Shows Haldric continuing to search for Green Isle survivors.
Map description
The 41 × 42 coastal map places the refugee landing among ocean, beaches, grassland, forest, villages, roads, hills, mountains, water channels, and three continental keeps. Glimir and Eowarar command elven forces while Dursil commands dwarves. Their shared team makes them temporary allies against Haldric despite their opening argument.
Map system
Design role
Large coast and visible fleet
Makes the locals’ invasion interpretation understandable.
Three continental recruitment centers
Creates pressure from distinct elven and dwarven rosters.
Elven villages and forest
Supports healers, archers, and woodland fighters.
Dwarven hill and mountain access
Supports guardsmen, fighters, thunderers, and pathfinders.
Objectives and unusual reward model
Success condition
Avoid deaths for as long as possible; the scenario ends when any ordinary unit dies.
Defeat
Death of Haldric, Lady Jessene, or Lord Typhon.
Turn limit
Unlimited while no death occurs.
Carryover
20% of finishing gold.
Bonus
Calculated to equal an early-finish bonus for the number of turns survived.
When the terminating death occurs, the scenario sets the turn limit to the current turn and then adds the current turn again. The resulting total is twice the survived turn count, leaving an equal number of “remaining” turns for Wesnoth’s early-finish calculation.
Design inversion. Ordinary campaigns reward finishing faster. This scenario uses the same engine bonus system to reward surviving longer without a death.
Sides and recruitment
Side
Leader / roster
Gold
Starting villages
1 — Refugees
Haldric and full party
100
Campaign state
2 — Elves
Glimir, Elvish Marshal; fighters, archers, shamans and selected level-2 units
150 / 220 / 300
8
3 — Dwarves
Dursil, Dwarvish Lord; fighters, thunderers, guardsmen and selected level-2 units
150 / 220 / 300
14
4 — Elves
Eowarar, Elvish Champion; fighters, archers and selected level-2 units
150 / 220 / 300
8
Recruitment instructions require at least one prioritized advanced unit before continuing with cheaper base troops. This ensures the three local forces visibly include their distinctive higher-level roles.
Custom Lua AI: aggressive attack without suicide
Each continental side replaces the normal combat, high-XP attack, and poison-spreading candidate actions with ca_aggressive_attack_no_suicide.lua. The scenario’s objective note explicitly tells the player that enemies will not initiate an attack if they risk dying.
The candidate action:
Gets every unit able to attack.
Enumerates possible attacks, including occupied destinations.
Simulates each combat.
Rejects any attack where the attacker has a nonzero chance of death.
Rates the survivors by defender kill chance, expected defender damage, low expected attacker damage, and stronger attacker HP.
Moves and attacks with the highest-rated option.
Rating component
Effect
Defender death chance × 100
Strongly favors possible kills.
Expected defender damage
Rewards useful nonlethal attacks.
Expected attacker damage ÷ 10
Penalizes self-harm.
Attacker HP ÷ 10
Breaks ties toward stronger attackers.
Escalating income
At every new turn, sides 2–4 receive base income equal to $turn_number - 1. The scenario therefore becomes progressively harder even though it has no fixed deadline.
Turn
Continental base income
1
0
5
4
10
9
20
19
This prevents an indefinitely passive strategy and makes every additional deathless turn increasingly valuable.
Landing and first-death event
Phase
Behavior
prestart
Stores and removes Haldric so the landing can be animated.
start
Runs the local-faction dispute, animates the fleet, unstores Haldric, recalls the party, and starts the failed peace attempt.
Turn 3
Jessene comments on the hostile welcome.
Every new turn
Raises all three continental sides’ base income.
First non-protected death
Lady Dionli arrives, stops the battle, redirects Haldric to the Ka’lian, resolves Typhon’s departure, initializes hub variables, converts survival time into a finish bonus, and ends with 20% carryover.
Difficulty-dependent merfolk transition
Difficulty
After Lord Typhon leaves
Easy
Merman Fighter and Merman Hunter remain recruitable.
Normal / Hard
Further merfolk recruitment is disabled; existing merfolk units remain available through the recall roster.
The dialogue reflects this distinction: on harder settings, Typhon says the warriors who already fought beside Haldric wish to remain.
Quest-hub initialization
Before leaving for the Ka’lian, Scenario 15 initializes the complete hub state:
Variable
Initial value
Meaning
num_done
0
Number of Ka’lian quests completed
a_beach
0
Lizard Beach incomplete
cursed_isle
0
Cursed Isle incomplete
the_dragon
0
Dragon quest incomplete
troll_hole
0
Troll Hole incomplete
last_done
"none"
No returning quest to greet yet
Assets and custom content
Resource
Origin
Use
story/trow_story_15-A_New_Land.webp
Campaign
First sight of the Great Continent
Lady Dionli portrait and Autumn Shyde sprite
Campaign
Diplomatic intervention
Familiar portrait and unit
Campaign
Jevyan surveillance
Elvish and dwarvish factions, fleet ships, terrain and music