CampaignWML Tutorial
From Wesnoth
Contents |
1) What is a campaign, anyway?
Read the Create section. It is a relatively accurate reference for all your WML needs, and you will probably need to reference to it often throughout this tutorial. It can also be located be clicking the 'create', in the link banner at the top of the page. For examples, it is often best to look at a mainline campaign. Oh, BTW, this is a tutorial for Wesnoth 1.4.0, and you will need to download the add-on 'The Era of Myths' Delta 1.
2) The World At Your Command
The first step to creating a campaign is having a good idea of what you want to happen. Then, it is time to create the world. To do this, start the map editor ('editor.exe' on windows). I advise that you play around with the map editor, get a feel for it's capabilities if you have not already. Now, build the map for the first campaign (out of 4 or so) to take place on. Put in 4 player starts, by using the flag tool. In this scenario, player 1 will be you, player 2 will be your ally, players 3 and 4 will be against you. Remember, save your map often. For now, you can save in the default folder, Wesnoth\userdata\editor\maps.
3) Configure Your World
Create a new RTF text file in the folder Wesnoth\userdata\data\campaigns called 'devlings.cfg'. It MUST be an RTF file with the proper extension, or Wesnoth will not recognize it. Create a new folder called 'devlings'.
4) The First Scenario
Paste the following code into devlings.cfg. It will tell the Battle For Wesnoth that there is a campaign here, and that this is how the campaign is set up.
[campaign]
id=devlings_campaign
name= _ "<173,56,34>Devlings!"
define=dvl_cmpn
icon=../userdata/data/campaigns/Era_of_Myths/images/devlings/sneak.png
#image=portraits\Other\silver_mage.png
description= _ "Devlings are the warriors of the underworld. They usually inhabit caves just big enough for them to fit through, and there are tribes who have not encountered any other race for generations. Sometimes, geological activity forces these mysterious, egotistical creatures to the surface."
difficulties=EASY,NORMAL,HARD difficulty_descriptions={MENU_IMG_TXT2 "../userdata/data/campaigns/Era_of_Myths/images/devlings/sneak.png~RC(magenta>red)" _"Easy" _""} + ";*" + {MENU_IMG_TXT2 "../userdata/data/campaigns/Era_of_Myths/images/devlings/cursers.png~RC(magenta>red)" _"Medium" _""} + ";" + {MENU_IMG_TXT2 "../userdata/data/campaigns/Era_of_Myths/images/devlings/nailers.png~RC(magenta>red)" _"Hard" _""}
[/campaign]
Tip: Turn on 'word wrap' in your text editor for easy editing!
Let's run Wesnoth. If you have done everything correctly so far, you should see a brown entry in the campaign menu that says "Devlings!" When you click on it, you should get a menu with three options, and a picture of a devling to the left of each option. If you cannot see the pictures, make sure you have the dependencies in step one installed.
The name= _ "<173,56,34>Devlings!" is a translatable string, as marked by the _ before the ". The stuff in the < > is a colour code, which colours the Devlings! text reddish. (This works for almost all displayable strings, including unit names.) define=dvl_cmpn will keep our paths from mucking up other campaigns later. Each campaign needs a unique define=. Icon=<image path> is telling Wesnoth where the icon for the campaign menu entery is. image=<image path> would display an image in the description box, but there are no relevant images for devlings, so we shall leave it commented out. Almost any line of code that starts with a # is ignored, so you can make comments in your code, or quickly remove an offending segment. description= _ "<description text>" is what is displayed in the description box, above the image= image. In the long difficulties=..., the long path names define images, in this case, three different devlings. The ~RC(magenta>red) code at the end of the image invokes Wesnoth's Team colouring, which changes all the magenta pixels to, here, red pixels. Devlings are not team coloured, so this is only for reference and fowards compatibility, in case they ever do get team colouring. Easy, medium, and hard text in the difficulties=... can be changed to more fancy descriptors. The empty strings (_"") behind the main descriptors can be filled for an auxillary description.
Resources
Some Important Links:
- esr's design and plot tutorial: http://catb.org/~esr/wesnoth/campaign-design-howto.html
- Another tutorial: BuildingCampaigns
- General WML reference: Create
