<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.wesnoth.org/index.php?action=history&amp;feed=atom&amp;title=MakingCampaignInWML2</id>
	<title>MakingCampaignInWML2 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.wesnoth.org/index.php?action=history&amp;feed=atom&amp;title=MakingCampaignInWML2"/>
	<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=MakingCampaignInWML2&amp;action=history"/>
	<updated>2026-05-03T12:05:46Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.16</generator>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=MakingCampaignInWML2&amp;diff=68982&amp;oldid=prev</id>
		<title>Jarom: fixed heading</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=MakingCampaignInWML2&amp;diff=68982&amp;oldid=prev"/>
		<updated>2021-11-25T15:24:29Z</updated>

		<summary type="html">&lt;p&gt;fixed heading&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 15:24, 25 November 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l55&quot; &gt;Line 55:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 55:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This is a new feature, introduced in 1.15 versions, so it's not commonly used. It replaces the default background of the campaign menu when our campaign is selected. Typically uses story/cutscene background images. Note that Wesnoth backgrounds in the story folder have atypical .jpg extension, but it's not necessarily the case for other background images.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This is a new feature, introduced in 1.15 versions, so it's not commonly used. It replaces the default background of the campaign menu when our campaign is selected. Typically uses story/cutscene background images. Note that Wesnoth backgrounds in the story folder have atypical .jpg extension, but it's not necessarily the case for other background images.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;:&lt;/del&gt;=== Note about custom images ===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Note about custom images ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;:Usually you could access an image, e.g. &amp;quot;snow-golem.png&amp;quot; in your add-on's images folder by just writing &amp;quot;snow-golem.png&amp;quot;. But that's because you use [binary_path] to access it. However, our [binary_path] is inside #ifdef, which only loads AFTER we start the campaign, so the game doesn't know about it when we're in campaign selection menu.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;:Usually you could access an image, e.g. &amp;quot;snow-golem.png&amp;quot; in your add-on's images folder by just writing &amp;quot;snow-golem.png&amp;quot;. But that's because you use [binary_path] to access it. However, our [binary_path] is inside #ifdef, which only loads AFTER we start the campaign, so the game doesn't know about it when we're in campaign selection menu.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;:To use custom images in your [campaign] tag you have to use fully qualified names, relative to userdata folder, that is, the same as you used in [binary_path] and [textdomain]. For the afforementioned snow golem image you'd have to write ''data/add-ons/WML_Tutorial/images/snow-golem.png''.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;:To use custom images in your [campaign] tag you have to use fully qualified names, relative to userdata folder, that is, the same as you used in [binary_path] and [textdomain]. For the afforementioned snow golem image you'd have to write ''data/add-ons/WML_Tutorial/images/snow-golem.png''.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l374&quot; &gt;Line 374:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 374:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[/scenario]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[/scenario]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;----&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[MakingCampaignInWML3|Part 3: Improving the first scenario]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[MakingCampaignInWML3|Part 3: Improving the first scenario]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Jarom</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=MakingCampaignInWML2&amp;diff=68981&amp;oldid=prev</id>
		<title>Jarom: Created page with &quot;'''Expanding the campaign definition (and macros)'''  In the previous part of this tutorial we made a minimal working example that could be run and pla...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=MakingCampaignInWML2&amp;diff=68981&amp;oldid=prev"/>
		<updated>2021-11-25T15:09:19Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;#039;&amp;#039;&amp;#039;Expanding the campaign definition (and macros)&amp;#039;&amp;#039;&amp;#039;  In the &lt;a href=&quot;/MakingCampaignInWML&quot; title=&quot;MakingCampaignInWML&quot;&gt;previous part&lt;/a&gt; of this tutorial we made a minimal working example that could be run and pla...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;'''Expanding the campaign definition (and macros)'''&lt;br /&gt;
&lt;br /&gt;
In the [[MakingCampaignInWML|previous part]] of this tutorial we made a minimal working example that could be run and played, but it's far from the usual content of a campaign. If you have ADHD or for some other reason don't want to read all the descriptions, jump to the [[#TL;DR|TL;DR]].&lt;br /&gt;
&lt;br /&gt;
== Textdomain ==&lt;br /&gt;
Let's start by introducing the very common content of add-on's _main.cfg file, that is the textdomain. It allows your campaign to be translated and it's better to do that at the very start than try to add it later, especially since it's mostly unobtrusive and doesn't take much time. First, let's add a [[GettextForWesnothDevelopers#The_textdomain_tag|'''[textdomain]''']] tag, it's typically located before [[CampaignWML|'''[campaign]''']] and looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
[textdomain]&lt;br /&gt;
    name = wesnoth-WML_Tutorial&lt;br /&gt;
    path = data/add-ons/WML_Tutorial/translations&lt;br /&gt;
[/textdomain]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The '''name=''' key is most important. Your textdomain name should start with ''wesnoth-'', and after that it typically uses your add-on's folder name for a good reason - this name will be used as folder name again.&lt;br /&gt;
&lt;br /&gt;
The '''path=''' key contains the path to your translation root relative to the userdata folder, typically it's the same as in ''[binary_path]'' but with ''/translations'' at the end.&lt;br /&gt;
:You don't have to add /translations at the end but you should. Although having your main folder as translation root will flatten your folder structure for translation, which can possibly make access to it faster, it'll be confusing for others, so it's discouraged.&lt;br /&gt;
&lt;br /&gt;
The reference advises to create translations folder now, but it doesn't need to have content for now and actually everything will work even if you don't.&lt;br /&gt;
&lt;br /&gt;
Note that mainline campaigns have different content in this tag because their translations are handled by game core, so don't copy their way.&lt;br /&gt;
&lt;br /&gt;
Now, we're going to add a '''#textdomain''' directive. It's typically the first line of any ''.cfg'' file containing translatable strings. For our example it'll be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
#textdomain wesnoth-WML_Tutorial&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''#texdomain''' is a fixed part, and after a space there should be your textdomain name, exactly the same as in ''name='' key in ''[textdomain]'' tag. You should place the exact same line in your scenario file, but not in your map file. If you have a .cfg file that you're sure that it won't have any translatable strings, you can use '''#wmllint: no translatables''' instead, but if you're not sure, just add the full ''#textdomain'' directive or leave nothing. Don't put any of these in files other than those with .cfg extension.&lt;br /&gt;
&lt;br /&gt;
== Visuals ==&lt;br /&gt;
&lt;br /&gt;
Your campaign entry in the campaigns menu looks very barebones for now. Let's add a little variety.&lt;br /&gt;
First, an icon. It will show on campaigns list and is considered pretty mandatory. It's customary to use an image that's usually displayed on the map, like an item or a unit. In this example we're going to use a book from mainline as an icon:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
    icon = &amp;quot;items/book3.png&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Place this inside your ''[campaign]'' tag. If you're planning to use custom images, see the [[#Note about custom images|note about paths]] below. Note that it's customary to wrap file paths and certain other strings in double quotes, but usually they are not necessary. Don't add the _ (underscore) before though, because this is NOT translatable.&lt;br /&gt;
&lt;br /&gt;
Other images also go inside ''[campaign]'' tag but are much more optional, even mainline campaigns not always use them:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
    image = &amp;quot;portraits/humans/longbowman.png&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will show below the description (we'll add one soon) and it's usually a unit/character portrait. It's optional, but quite common. We're using the portrait of Wesnoth's longbowman as an example.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
    background = &amp;quot;story/grim-altar.jpg&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a new feature, introduced in 1.15 versions, so it's not commonly used. It replaces the default background of the campaign menu when our campaign is selected. Typically uses story/cutscene background images. Note that Wesnoth backgrounds in the story folder have atypical .jpg extension, but it's not necessarily the case for other background images.&lt;br /&gt;
&lt;br /&gt;
:=== Note about custom images ===&lt;br /&gt;
:Usually you could access an image, e.g. &amp;quot;snow-golem.png&amp;quot; in your add-on's images folder by just writing &amp;quot;snow-golem.png&amp;quot;. But that's because you use [binary_path] to access it. However, our [binary_path] is inside #ifdef, which only loads AFTER we start the campaign, so the game doesn't know about it when we're in campaign selection menu.&lt;br /&gt;
:To use custom images in your [campaign] tag you have to use fully qualified names, relative to userdata folder, that is, the same as you used in [binary_path] and [textdomain]. For the afforementioned snow golem image you'd have to write ''data/add-ons/WML_Tutorial/images/snow-golem.png''.&lt;br /&gt;
:There's a trick that can simplify it, but you'll learn it later.&lt;br /&gt;
&lt;br /&gt;
Now, let's move to the '''description'''. In mainline campaigns it's usually splitted into two parts, the actual description and difficulty/length addition, for translation purposes. Don't forget to mark each part as translatable whether you split or not.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
    description = _&amp;quot;Basic, but slowly expanding example for tutorial.&lt;br /&gt;
Great, emotional story not yet guaranteed.&lt;br /&gt;
&lt;br /&gt;
&amp;quot; + _&amp;quot;(Novice? level, 1 scenario.)&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that you mustn't tabulate the description inside quotes in multiline description, as it'll be added to the string and shown in the game. You can use fancy formatting, as described [[InterfaceActionsWML#Formatting|here]].&lt;br /&gt;
:Centering the description&lt;br /&gt;
:There exists a key description_alignment= if you want to center your description like the one in The Sceptre of Fire. It doesn't add the italics though.&lt;br /&gt;
:&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
    description_alignment = center&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
:It won't appear in code examples later.&lt;br /&gt;
&lt;br /&gt;
There's one more purely visual thing, but it only shows in save filenames - the '''abbrev'''. It's recommended to set that. First derive an abbreviation of your campaign from its name. For example, The Rise of Wesnoth is abbreviated TRoW and Under the Burning Suns is UtBS. For this example add-on, we'll use WMLT. Note that abbreviations vary between languages, so this is translatable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
    abbrev = _&amp;quot;WMLT&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:You should, but don't have to avoid clashes in the abbrev= key.&lt;br /&gt;
:It's preferable, but not necessary that it doesn't clash with other add-ons. However, as it only affects save filenames, it's unlikely to cause problems for the game itself - it could at most overwrite saves if for some reason scenario names are the same. It might affect the community though.&lt;br /&gt;
:Example: the abbreviation conflict between Era of Magic and Era of Myths, causing the former to use the abbreviation EoMa. But you don't have to bother about it at this point that much.&lt;br /&gt;
&lt;br /&gt;
== Sorting ==&lt;br /&gt;
There's a default order of campaigns appearing in the menu and ours will probably be last for now. Set your campaign's rank to something bigger than 300, the lower it is, the bigger priority on default sorting it's going to have, if not set it will appear somewhere near the end. Check in [[CampaignWML]] for a detailed explanation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
    rank = 970&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that you can also sort by name (alphabetically) and by time. For the former, set ''start_year='' and ''end_year='' keys, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
    start_year = &amp;quot;10 BW&amp;quot;&lt;br /&gt;
    end_year = &amp;quot;10 YW&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this campaign we're going to use a simpler form that replaces both of them to set our campaign to happen a year after &amp;quot;The Story of Two Brothers&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
    year = &amp;quot;364 YW&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As it was said, it only affects sorting by timeline and nothing else, so if your campaign for some reason isn't placed in the Wesnoth universe or the date is not determined, just omit this key.&lt;br /&gt;
&lt;br /&gt;
== Difficulty ==&lt;br /&gt;
&lt;br /&gt;
Difficulty in campaigns is currently added using '''[difficulty]''' tags. It was different before, so not all add-ons follow this convention. The tag looks as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
    [difficulty]&lt;br /&gt;
        define = EASY&lt;br /&gt;
        image = &amp;quot;units/human-loyalists/bowman.png&amp;quot;&lt;br /&gt;
        label = _&amp;quot;Recruit&amp;quot;&lt;br /&gt;
        description = _&amp;quot;Beginner&amp;quot;&lt;br /&gt;
    [/difficulty]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It should be placed inside the ''[campaign]'' tag, like ''[side]'' in ''[scenario]''. Don't forget about correct indentation.&lt;br /&gt;
&lt;br /&gt;
First key, '''define=''' works similarly to the one in ''[campaign]'' tag, and is also checked with ''#ifdef''. But instead of only loading resources when campaign starts, it will only put certain parts of code in the campaign when it's started with the right difficulty, so it doesn't have effect on the ''[campaign]'' tag itself and will be used in scenarios (or units) instead. Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
#ifdef EASY&lt;br /&gt;
        type = Dark Sorcerer&lt;br /&gt;
#else&lt;br /&gt;
        type = Necromancer&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code if put inside the enemy's ''[side]'' tag will cause their leader to be a Dark Sorcerer if the difficulty is set to ''EASY'', and a Necromancer otherwise. Note that it'll show in examples later.&lt;br /&gt;
&lt;br /&gt;
It's strongly recommended to use a set of: ''EASY, NORMAL, HARD'' if you have three difficulties and add ''NIGHTMARE'' if you have four, because there are some improvements (namely macros) that make use of those.&lt;br /&gt;
&lt;br /&gt;
Second key, '''image=''' should point to an image illustrating the difficulty. It usually follows level progression for a unit or several similar units of different levels. For example, Liberty uses a Peasant (lvl 0) for ''EASY'', Outlaw (lvl 2) for ''NORMAL'' and Fugitive (lvl 3) for ''HARD''. It's purely visual.&lt;br /&gt;
&lt;br /&gt;
Third key, '''label=''' is a translatable string with a flavour text representing the difficulty. It's often the name of the unit on image, but not necessarily.&lt;br /&gt;
&lt;br /&gt;
Fourth key, '''description=''' is also translatable, and it serves as the actual user-visible difficulty name for the ones confused by flavour texts. Note, that you might want to choose from the ones used in mainline and save time on translating and devising a clever descriptive name. Just start the game and look at what was used so far.&lt;br /&gt;
&lt;br /&gt;
Having a single difficulty doesn't really change anything so we'll add two more:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
    [difficulty]&lt;br /&gt;
        define = NORMAL&lt;br /&gt;
        image = &amp;quot;units/human-loyalists/longbowman.png&amp;quot;&lt;br /&gt;
        label = _&amp;quot;Veteran&amp;quot;&lt;br /&gt;
        description = _&amp;quot;Intermediate&amp;quot;&lt;br /&gt;
    [/difficulty]&lt;br /&gt;
    [difficulty]&lt;br /&gt;
        define = HARD&lt;br /&gt;
        image = &amp;quot;units/human-loyalists/masterbowman.png&amp;quot;&lt;br /&gt;
        label = _&amp;quot;Commander&amp;quot;&lt;br /&gt;
        description = _&amp;quot;Hard&amp;quot;&lt;br /&gt;
    [/difficulty]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We'll now use a little trick and append '''~RC(magenta&amp;gt;blue)''' to the images, so their paths will look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
        image = &amp;quot;units/human-loyalists/longbowman.png~RC(magenta&amp;gt;blue)&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It'll cause their images to be coloured like units of default side 2. Again, it's purely visual. See [[ImagePathFunctions#RC: Re-Color function|documentation]] for more.&lt;br /&gt;
&lt;br /&gt;
Note that players can change difficulty mid-campaign by default. To prevent that, you can add '''allow_difficulty_change = no''' to your ''[campaign]'' tag.&lt;br /&gt;
&lt;br /&gt;
== MACROS ==&lt;br /&gt;
&lt;br /&gt;
Now we're going to use another trick. We'll replace those tags with macros. Macro is literally telling the game to put a certain code in a certain place when loading the files. So in our code we're going to replace this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
    [difficulty]&lt;br /&gt;
        define = EASY&lt;br /&gt;
        image = &amp;quot;units/human-loyalists/bowman.png&amp;quot;&lt;br /&gt;
        label = _&amp;quot;Recruit&amp;quot;&lt;br /&gt;
        description = _&amp;quot;Beginner&amp;quot;&lt;br /&gt;
    [/difficulty]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
    {CAMPAIGN_DIFFICULTY EASY &amp;quot;units/human-loyalists/bowman.png~RC(magenta&amp;gt;blue)&amp;quot; _&amp;quot;Recruit&amp;quot; _&amp;quot;Beginner&amp;quot;}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the game will swap it back for us. Note, that the order of values in macros (they are called '''arguments''' in this context), unlike keys, does matter and has to be strictly followed. You also have to watch out for spaces, as anything that's not within () parentheses or &amp;quot;&amp;quot; double quotes and contains a space will count as two separate arguments. If we used the Wesnoth core's syntax for translatables the third argument would have to look like that: ''( _ &amp;quot;Recruit&amp;quot;)''&lt;br /&gt;
&lt;br /&gt;
Macros are great for saving time on typing and space on the screen when developing. You can also make your own macros but we'll do that later. There's a big collection of macros already made in Wesnoth and most are documented in [https://www.wesnoth.org/macro-reference.html the reference], along with the one we just used.&lt;br /&gt;
&lt;br /&gt;
We'll also replace the other two with macros to save space. Usually you'd use a macro from the beginning and never write the tag in full. Note that we treat macros like keys for the purpose of indentation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
    {CAMPAIGN_DIFFICULTY NORMAL &amp;quot;units/human-loyalists/longbowman.png~RC(magenta&amp;gt;blue)&amp;quot; _&amp;quot;Veteran&amp;quot; _&amp;quot;Intermediate&amp;quot;}&lt;br /&gt;
    {CAMPAIGN_DIFFICULTY HARD &amp;quot;units/human-loyalists/masterbowman.png~RC(magenta&amp;gt;blue)&amp;quot; _&amp;quot;Commander&amp;quot; _&amp;quot;Hard&amp;quot;}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
Those will appear when the player finishes the campaign, just before mainline credits. They look like that:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
    [about]&lt;br /&gt;
        title = _&amp;quot;Designers&amp;quot;&lt;br /&gt;
        [entry]&lt;br /&gt;
            name = &amp;quot;John Doe (hisnickname)&amp;quot;&lt;br /&gt;
            comment = &amp;quot;Served as excellent example on how an entry usually looks like&amp;quot;&lt;br /&gt;
        [/entry]&lt;br /&gt;
    [/about]&lt;br /&gt;
    [about]&lt;br /&gt;
        title = _&amp;quot;Programmers&amp;quot;&lt;br /&gt;
        [entry]&lt;br /&gt;
            name = &amp;quot;You&amp;quot;&lt;br /&gt;
            comment = &amp;quot;Assuming you actually did something&amp;quot;&lt;br /&gt;
        [/entry]&lt;br /&gt;
        [entry]&lt;br /&gt;
            name = &amp;quot;John Smith (jhnsmth)&amp;quot;&lt;br /&gt;
        [/entry]&lt;br /&gt;
    [/about]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The '''[about]''' tag describes a section in credits, its '''title=''' key is usually translatable and describes what the people inside did (usually role name), '''[entry]''' describes a single person, its '''name=''' key shouldn't be translatable and does what says on the tin, '''comment=''' is optional, provides an extra insight in their achievements and shouldn't be bothered to be translated.&lt;br /&gt;
&lt;br /&gt;
That's it. You don't even need those at all, but you probably will add them anyway, for fame and future generations, or something.&lt;br /&gt;
&lt;br /&gt;
Alternatively you can use '''end_credits = no''' instead and this will cause the game to display no credits at the end of your campaign, obviously, including mainline credits.&lt;br /&gt;
&lt;br /&gt;
Consult [[CreditsWML]] for more. Or just check any other campaign's credits. It's actually the least important thing for your campaign.&lt;br /&gt;
&lt;br /&gt;
== TL;DR ==&lt;br /&gt;
[[#Troubleshooting|Skip]]&lt;br /&gt;
In this part we added a '''[textdomain]''' tag to ''_main.cfg'' file and '''#textdomain''' definition at the beginning.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
#textdomain wesnoth-WML_Tutorial&lt;br /&gt;
&lt;br /&gt;
[textdomain]&lt;br /&gt;
    name = wesnoth-WML_Tutorial&lt;br /&gt;
    path = data/add-ons/WML_Tutorial/translations&lt;br /&gt;
[/textdomain]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the ''[campaign]'' tag:&lt;br /&gt;
We added an '''icon''' to display next to the campaign's name, and '''abbrev''' for prefixing save filenames.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
    icon = &amp;quot;items/book3.png&amp;quot;&lt;br /&gt;
    abbrev = _&amp;quot;WMLT&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also added the '''description''', along with its optional visuals - '''image''' and '''background'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
    description = _&amp;quot;Basic, but slowly expanding example for tutorial.&lt;br /&gt;
Great, emotional story not yet guaranteed.&lt;br /&gt;
&lt;br /&gt;
&amp;quot; + _&amp;quot;(Novice? level, 1 scenario)&amp;quot;&lt;br /&gt;
    image = &amp;quot;portraits/humans/longbowman.png&amp;quot;&lt;br /&gt;
    background = &amp;quot;story/grim-altar.jpg&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We also added '''rank''' and '''year''' for sorting purposes. Both are optional and almost unnoticeable for the average user. You can replace the latter with '''start_year''' and '''end_year'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
    rank = 970&lt;br /&gt;
    year = &amp;quot;364 YW&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We added three '''difficulties''' using '''macros''' in place of tags and keys:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
    {CAMPAIGN_DIFFICULTY EASY &amp;quot;units/human-loyalists/bowman.png~RC(magenta&amp;gt;blue)&amp;quot; _&amp;quot;Recruit&amp;quot; _&amp;quot;Beginner&amp;quot;}&lt;br /&gt;
    {CAMPAIGN_DIFFICULTY NORMAL &amp;quot;units/human-loyalists/longbowman.png~RC(magenta&amp;gt;blue)&amp;quot; _&amp;quot;Veteran&amp;quot; _&amp;quot;Intermediate&amp;quot;}&lt;br /&gt;
    {CAMPAIGN_DIFFICULTY HARD &amp;quot;units/human-loyalists/masterbowman.png~RC(magenta&amp;gt;blue)&amp;quot; _&amp;quot;Commander&amp;quot; _&amp;quot;Hard&amp;quot;}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Macros are good and [https://www.wesnoth.org/macro-reference.html here's] the list.&lt;br /&gt;
&lt;br /&gt;
We also added '''credits''' but if you're reading the TL;DR you're not worthy to put those yet. Go back after actually making your own campaign.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
Campaign doesn't appear on the list anymore&lt;br /&gt;
:Probably macros are badly written or your tags are not opened/closed properly. Error message shown when running the game might say more.&lt;br /&gt;
Images don't show&lt;br /&gt;
:Assuming your [binary_path] is correct (this was done in the previous part), check your paths and. They should be relative to the game's 'images' folder, or have full path relative to userdata folder. Watch out for typos and extensions.&lt;br /&gt;
Code so far:&lt;br /&gt;
:_main.cfg&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
#textdomain wesnoth-WML_Tutorial&lt;br /&gt;
&lt;br /&gt;
[textdomain]&lt;br /&gt;
    name = wesnoth-WML_Tutorial&lt;br /&gt;
    path = data/add-ons/WML_Tutorial/translations&lt;br /&gt;
[/textdomain]&lt;br /&gt;
&lt;br /&gt;
[campaign]&lt;br /&gt;
    id = WML_Tutorial&lt;br /&gt;
    name = _&amp;quot;WML Tutorial&amp;quot;&lt;br /&gt;
    icon = &amp;quot;items/book3.png&amp;quot;&lt;br /&gt;
    abbrev = _&amp;quot;WMLT&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    description = _&amp;quot;Basic, but slowly expanding example for tutorial.&lt;br /&gt;
Great, emotional story not yet guaranteed.&lt;br /&gt;
&lt;br /&gt;
&amp;quot; + _&amp;quot;(Novice? level, 1 scenario)&amp;quot;&lt;br /&gt;
    image = &amp;quot;portraits/humans/longbowman.png&amp;quot;&lt;br /&gt;
    background = &amp;quot;story/grim-altar.jpg&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    rank = 970&lt;br /&gt;
    year = &amp;quot;364 YW&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    first_scenario = 01_Initial_Scenario&lt;br /&gt;
    define = WML_TUTORIAL&lt;br /&gt;
&lt;br /&gt;
    {CAMPAIGN_DIFFICULTY EASY &amp;quot;units/human-loyalists/bowman.png~RC(magenta&amp;gt;blue)&amp;quot; _&amp;quot;Recruit&amp;quot; _&amp;quot;Beginner&amp;quot;}&lt;br /&gt;
    {CAMPAIGN_DIFFICULTY NORMAL &amp;quot;units/human-loyalists/longbowman.png~RC(magenta&amp;gt;blue)&amp;quot; _&amp;quot;Veteran&amp;quot; _&amp;quot;Intermediate&amp;quot;}&lt;br /&gt;
    {CAMPAIGN_DIFFICULTY HARD &amp;quot;units/human-loyalists/masterbowman.png~RC(magenta&amp;gt;blue)&amp;quot; _&amp;quot;Commander&amp;quot; _&amp;quot;Hard&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
    [about]&lt;br /&gt;
        title = _&amp;quot;Designers&amp;quot;&lt;br /&gt;
        [entry]&lt;br /&gt;
            name = &amp;quot;John Doe (hisnickname)&amp;quot;&lt;br /&gt;
            comment = &amp;quot;Served as excellent example on how an entry usually looks like&amp;quot;&lt;br /&gt;
        [/entry]&lt;br /&gt;
    [/about]&lt;br /&gt;
    [about]&lt;br /&gt;
        title = _&amp;quot;Programmers&amp;quot;&lt;br /&gt;
        [entry]&lt;br /&gt;
            name = &amp;quot;You&amp;quot;&lt;br /&gt;
            comment = &amp;quot;Assuming you actually did something&amp;quot;&lt;br /&gt;
        [/entry]&lt;br /&gt;
        [entry]&lt;br /&gt;
            name = &amp;quot;John Smith (jhnsmth)&amp;quot;&lt;br /&gt;
        [/entry]&lt;br /&gt;
    [/about]&lt;br /&gt;
[/campaign]&lt;br /&gt;
&lt;br /&gt;
#ifdef WML_TUTORIAL&lt;br /&gt;
    [binary_path]&lt;br /&gt;
        path = data/add-ons/WML_Tutorial&lt;br /&gt;
    [/binary_path]&lt;br /&gt;
    {~add-ons/WML_Tutorial/scenarios}&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:scenarios/01_Initial_Scenario.cfg&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=wml&amp;gt;&lt;br /&gt;
#textdomain wesnoth-WML_Tutorial&lt;br /&gt;
[scenario]&lt;br /&gt;
    id = 01_Initial_Scenario&lt;br /&gt;
    name = _&amp;quot;Initial Scenario&amp;quot;&lt;br /&gt;
    map_file = &amp;quot;01_Initial_Scenario.map&amp;quot;&lt;br /&gt;
    [side]&lt;br /&gt;
        side = 1&lt;br /&gt;
        controller = human&lt;br /&gt;
        type = Longbowman&lt;br /&gt;
        recruit = Bowman, Spearman&lt;br /&gt;
    [/side]&lt;br /&gt;
    [side]&lt;br /&gt;
        side = 2&lt;br /&gt;
        controller = ai&lt;br /&gt;
#ifdef EASY&lt;br /&gt;
        type = Dark Sorcerer&lt;br /&gt;
#else&lt;br /&gt;
        type = Necromancer&lt;br /&gt;
#endif&lt;br /&gt;
        recruit = Skeleton Archer, Skeleton&lt;br /&gt;
    [/side]&lt;br /&gt;
[/scenario]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[MakingCampaignInWML3|Part 3: Improving the first scenario]]&lt;/div&gt;</summary>
		<author><name>Jarom</name></author>
		
	</entry>
</feed>