<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.wesnoth.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dfrf</id>
	<title>The Battle for Wesnoth Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.wesnoth.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dfrf"/>
	<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/Special:Contributions/Dfrf"/>
	<updated>2026-10-24T02:50:52Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=BuildingCampaignsTheCampaignFile&amp;diff=13144</id>
		<title>BuildingCampaignsTheCampaignFile</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=BuildingCampaignsTheCampaignFile&amp;diff=13144"/>
		<updated>2006-12-15T16:16:57Z</updated>

		<summary type="html">&lt;p&gt;Dfrf: /* See Also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Each campaign must contain a WML file which contains a [campaign] tag. In order for the campaign to be translatable, it must also contain a [textdomain] tag, which should precede the [campaign] tag.&lt;br /&gt;
&lt;br /&gt;
This file contains the information the game needs to find the rest of the bits of your campaign scattered in other files and put them together to have a playable campaign.  Much information about this file can be found in the [[CampaignWML]] entry.  What follows is a description of each line of the campaign file and an explanation of what it does.&lt;br /&gt;
&lt;br /&gt;
For our purposes I&#039;ll assume we&#039;ve already created a campaign called simple_campaign with the directory structure outlined in [[BuildingCampaignsDirectoryStructure]].&lt;br /&gt;
&lt;br /&gt;
The first line of the campaign file is the [textdomain] WML tag, which specifies where the game should look for translations to the strings in the campaign. The textdomain tag specifies a name for the textdomain, which is what is used in the [campaign] tag, and in f ex campaign scenarios to connect the strings with translations. The textdomain should be unique, and start with &#039;wesnoth-&#039;, to ensure that it does not conflict with other textdomains that might be specified on a given system. &lt;br /&gt;
The textdomain also specifies a path to the directory where the compiled translation files will be stored. This should be a file inside the campaign directory.&lt;br /&gt;
&lt;br /&gt;
Ex.&lt;br /&gt;
     [textdomain]&lt;br /&gt;
          name=&amp;quot;wesnoth-Simple_Campaign&amp;quot;&lt;br /&gt;
          path=&amp;quot;data/campaigns/simple_campaign/translations&amp;quot;&lt;br /&gt;
     [/textdomain]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then follows the [campaign] WML tag that lets the game know this is a campaign:&lt;br /&gt;
&lt;br /&gt;
     [campaign]&lt;br /&gt;
&lt;br /&gt;
First associate the campaign with the textdomain you have just defined:&lt;br /&gt;
     #textdomain wesnoth-Simple_Campaign&lt;br /&gt;
&lt;br /&gt;
The next group of lines uniquely identifies the campaign:&lt;br /&gt;
&lt;br /&gt;
     name= _ &amp;quot;A Simple Campaign&amp;quot;&lt;br /&gt;
     define= CAMPAIGN_SIMPLE_CAMPAIGN&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[In earlier version, there was also &#039;&#039;id&#039;&#039; which was a unique identifier used for translation, but now has no effect.]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;name&#039;&#039; is the name of your campaign that the user will see.  It must be in quotation marks and be preceded by an underscore to facilitate translation.  &#039;&#039;define&#039;&#039; creates a key that lets the game know when a user has selected to play a scenario from your campaign.  More on it in a bit.  If you are missing any of these your campaign will not work correctly.&lt;br /&gt;
&lt;br /&gt;
The next group gives the user information about your campaign when he selects it from the campaign menu:&lt;br /&gt;
&lt;br /&gt;
     icon=a_wesnoth_icon.png&lt;br /&gt;
     image= simple_campaign_logo.png&lt;br /&gt;
     description= _ &amp;quot;Some text about my campaign!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;icon&#039;&#039; is a reference to any of the standard Wesnoth images.  It will be displayed in the campaign selection menu. When appropriate, it should use [[ImagePathFunctionWML]] to give the icon a team color instead of magenta. &#039;&#039;image&#039;&#039; is an image that will be displayed when a user clicks on the campaign.  &#039;&#039;description&#039;&#039; is a text description that will be shown to the user at the same time as &#039;&#039;image&#039;&#039;.  Note that none of these three are strictly necessary, but they do make your campaign look nice and professional.&lt;br /&gt;
&lt;br /&gt;
     difficulties=EASY,NORMAL,HARD&lt;br /&gt;
     difficulty_descriptions={MENU_IMG_TXT2 *&amp;amp;units/human-loyalists/peasant.png?TC(1,magenta) _&amp;quot;Civilian&amp;quot; _&amp;quot;(trivial)&amp;quot;} +&lt;br /&gt;
     &amp;quot;;&amp;quot; + {MENU_IMG_TXT2 units/human-loyalists/spearman.png?TC(1,magenta) _&amp;quot;Soldier&amp;quot; _&amp;quot;(simple)&amp;quot;} +&lt;br /&gt;
     &amp;quot;;&amp;quot; + {MENU_IMG_TXT2 units/human-loyalists/pikeman.png?TC(1,magenta) _&amp;quot;Veteran&amp;quot; _&amp;quot;(easy)&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;difficulties&#039;&#039; creates three definitions for three different difficulty levels.  For more information on difficulty levels and balancing see [[BuildingCampaignsBalancing]].&lt;br /&gt;
&lt;br /&gt;
     first_scenario=the_first_scenario&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;first_scenario&#039;&#039; is a reference to the scenario &#039;&#039;id&#039;&#039; of the scenario that you intend to be loaded and played first.&lt;br /&gt;
This line is essential.  Note that while　you are debugging and testing your campaign, it&#039;s often useful to change this line to the scenario you&#039;re working on so　you don&#039;t have to play through all&lt;br /&gt;
the scenarios that come before it.  (You could also just play through your campaign saving at each level.)&lt;br /&gt;
&lt;br /&gt;
     [/campaign]&lt;br /&gt;
&lt;br /&gt;
That&#039;s all that needs to be in the [campaign] tag, so we can close it here.&lt;br /&gt;
&lt;br /&gt;
There&#039;s more we want to do, though:  we&#039;ve　got to tell Wesnoth where our various&lt;br /&gt;
additional files are located (i.e. our maps, scenarios, units, images, and sounds).&lt;br /&gt;
&lt;br /&gt;
You should put everything not in the [campaign] tag inside&lt;br /&gt;
  #ifdef CAMPAIGN_SIMPLE_CAMPAIGN&lt;br /&gt;
  ...&lt;br /&gt;
  #endif&lt;br /&gt;
so that your custom macros, WML code, and inclusion of files do not affect other campaigns and slow the game down.  The only exception to this is the [binary_path] tag specifying the path to custom images in your campaign, but you should only put this outside the #ifdef if you need custom images for the campaign selection menu and the difficulty selection menu.  Otherwise even this belongs inside the #ifdef.&lt;br /&gt;
&lt;br /&gt;
A fairly minimal #ifdef section might just contain a link to your scenarios.&lt;br /&gt;
&lt;br /&gt;
 #ifdef CAMPAIGN_SIMPLE_CAMPAIGN&lt;br /&gt;
 &lt;br /&gt;
 {@campaigns/simple_campaign/scenarios}&lt;br /&gt;
 &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
The {@campaigns/simple_campaign/scenarios} line just looks in your campaign&#039;s &amp;quot;scenarios&amp;quot; directory and parses any .cfg files it finds there (see [[BuildingScenarios]] for information on making your scenario files). If you have any other .cfg files (macros, custom terrains, etc.), you can link them in a similar way. If you want to use custom units however, you will have to link them from inside a [+units] tag (using the &amp;quot;+&amp;quot; adds them to wesnoth&#039;s stored units - this is important) like so:&lt;br /&gt;
&lt;br /&gt;
 [+units]&lt;br /&gt;
 {@campaigns/simple_campaign/units}&lt;br /&gt;
 [/units]&lt;br /&gt;
&lt;br /&gt;
== Next: ==&lt;br /&gt;
* [[BuildingCampaignsThePBLFile]]&lt;br /&gt;
&lt;br /&gt;
[http://www.example.com link title]&lt;br /&gt;
----&lt;br /&gt;
--[[User:Dfrf|Dfrf]] 17:16, 15 December 2006 (CET)== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[BuildingCampaignsDirectoryStructure]]&lt;br /&gt;
* [[BuildingCampaigns]]&lt;br /&gt;
yyy&#039;&#039;Italic text&#039;&#039;&#039;&#039;&#039;Bold text&#039;&#039;&#039;[[Link title]]&lt;/div&gt;</summary>
		<author><name>Dfrf</name></author>
	</entry>
</feed>