From The Battle for Wesnoth Wiki
Revision as of 15:49, 3 March 2014 by Vultraz (talk | contribs) (Created page with "In order to create custom content for Wesnoth, you need to set up a folder in <i>userdata</i>/data/add-ons/. If you have not found your userdata directory yet, read EditingW...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

In order to create custom content for Wesnoth, you need to set up a folder in userdata/data/add-ons/. If you have not found your userdata directory yet, read EditingWesnoth and come back here. This page will explain the basic directory structure of an add-on and where stuff goes.

Several pages on this wiki will assume you have done so and refer to relative paths in such.

The Main File

For this example, we will assume your are creating an add-on called Valen.

  • Create the empty directory userdata/data/add-ons/Valen.
  • Create a file called _main.cfg inside the Valen folder.

The _main.cfg file will instruct the game on how to load your content. This example simply shows a very simple example of the file.

#textdomain wesnoth-valen



There are many other things you can put in your _main.cfg, such as a [campaign] tag if you're creating a campaign and want it to appear in the campaign list, or even nothing if you're distributing a resource pack. The important thing to remember is that this file is the "glue" that holds custom content together. The game looks at this file, and only this file, and follows the instructions within for loading whatever code you have created.

Note: Only code must be included from this file. You do not need to include resources such as sounds, images, or music. Those may be referred to simply by path as long as [binary_path] is set up.

The Directory Structure

What to create next depend on what type of content you are creating. For example, campaigns or map packs will have scenarios and maps directories, while a music pack would have only music. Here we will assume you are creating a campaign or single-scenario add-on.

Create the following directories:

  • userdata/data/add-ons/Valen/scenarios
  • userdata/data/add-ons/Valen/maps

All map files used in scenarios go in maps (see BuildingMaps. All configuration (‘.cfg’) files for scenarios go in scenarios (see BuildingScenarios).

If you have additional custom content such as custom images or units, create the respective following:

  • userdata/data/add-ons/Valen/macros
  • userdata/data/add-ons/Valen/units
  • userdata/data/add-ons/Valen/images
  • userdata/data/add-ons/Valen/sounds
  • userdata/data/add-ons/Valen/music

It is also a good idea, if you set up a textdomain, to create this directory, even if it remains empty. Failure to do so generates a warning internally.

  • userdata/data/add-ons/Valen/translations

See also