Difference between revisions of "BuildingCampaignsTheCampaignFile"
m (→Next:: Cleaned up the bottom of the page, some bad code was put in.) |
(Added description of abbrev key.) |
||
Line 26: | Line 26: | ||
name= _ "A Simple Campaign" | name= _ "A Simple Campaign" | ||
+ | abbrev=ASC | ||
define=CAMPAIGN_SIMPLE_CAMPAIGN | define=CAMPAIGN_SIMPLE_CAMPAIGN | ||
− | |||
[In earlier version, there was also ''id'' which was a unique identifier used for translation, but now has no effect.] | [In earlier version, there was also ''id'' which was a unique identifier used for translation, but now has no effect.] | ||
− | ''name'' 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. ''define'' 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 | + | ''name'' 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. |
+ | ''abbrev'' defines a campaign abbreviation that will be used as a prefix for the names of save files from that campaign (in 1.3.12 and later). ''define'' 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 the ''name'' or ''define'' keys of these your campaign will not work correctly; ''abbrev'' is optioal but recommended. | ||
The next group gives the user information about your campaign when he selects it from the campaign menu: | The next group gives the user information about your campaign when he selects it from the campaign menu: |
Revision as of 05:33, 23 November 2007
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.
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.
For our purposes I'll assume we've already created a campaign called simple_campaign with the directory structure outlined in BuildingCampaignsDirectoryStructure.
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 'wesnoth-', to ensure that it does not conflict with other textdomains that might be specified on a given system. 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.
Ex.
[textdomain] name="wesnoth-Simple_Campaign" path="data/campaigns/simple_campaign/translations" [/textdomain]
Then follows the [campaign] WML tag that lets the game know this is a campaign:
[campaign]
First associate the campaign with the textdomain you have just defined:
#textdomain wesnoth-Simple_Campaign
The next group of lines uniquely identifies the campaign:
name= _ "A Simple Campaign" abbrev=ASC define=CAMPAIGN_SIMPLE_CAMPAIGN
[In earlier version, there was also id which was a unique identifier used for translation, but now has no effect.]
name 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. abbrev defines a campaign abbreviation that will be used as a prefix for the names of save files from that campaign (in 1.3.12 and later). define 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 the name or define keys of these your campaign will not work correctly; abbrev is optioal but recommended.
The next group gives the user information about your campaign when he selects it from the campaign menu:
icon=a_wesnoth_icon.png image= simple_campaign_logo.png description= _ "Some text about my campaign!"
icon 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. image is an image that will be displayed when a user clicks on the campaign. description is a text description that will be shown to the user at the same time as image. Note that none of these three are strictly necessary, but they do make your campaign look nice and professional.
difficulties=EASY,NORMAL,HARD difficulty_descriptions={MENU_IMG_TXT2 *&units/human-loyalists/peasant.png~TC(1,magenta) _"Civilian" _"(trivial)"} + ";" + {MENU_IMG_TXT2 units/human-loyalists/spearman.png~TC(1,magenta) _"Soldier" _"(simple)"} + ";" + {MENU_IMG_TXT2 units/human-loyalists/pikeman.png~TC(1,magenta) _"Veteran" _"(easy)"}
difficulties creates three definitions for three different difficulty levels. For more information on difficulty levels and balancing see BuildingCampaignsBalancing.
first_scenario=the_first_scenario
first_scenario is a reference to the scenario id of the scenario that you intend to be loaded and played first. This line is essential. Note that while you are debugging and testing your campaign, it's often useful to change this line to the scenario you're working on so you don't have to play through all the scenarios that come before it. (You could also just play through your campaign saving at each level.)
[/campaign]
That's all that needs to be in the [campaign] tag, so we can close it here.
There's more we want to do, though: we've got to tell Wesnoth where our various additional files are located (i.e. our maps, scenarios, units, images, and sounds).
You should put everything not in the [campaign] tag inside
#ifdef CAMPAIGN_SIMPLE_CAMPAIGN ... #endif
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.
A fairly minimal #ifdef section might just contain a link to your scenarios.
#ifdef CAMPAIGN_SIMPLE_CAMPAIGN {@campaigns/simple_campaign/scenarios} #endif
The {@campaigns/simple_campaign/scenarios} line just looks in your campaign's "scenarios" 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 "+" adds them to wesnoth's stored units - this is important) like so:
[+units] {@campaigns/simple_campaign/units} [/units]