From The Battle for Wesnoth Wiki

I've waited forever to update the unit WML part of the wiki, and I will now use this time to contribute to the wiki.

Unit WML Part One.

This is a basic unit file.

To begin we will put the following lines of code into our favorite text editor and then edit

(I'll do this instead of breaking it up into small pieces. Get rid of the numbers behind the code!)

 1. #textdomain wesnoth-MAE # (The eras initials, MAE stand for My Awesome Era)
 2. [unit_type]
 3.     id=ERA-name-of-unit
 4.     name= _ "Name of unit"
 5.     race=name of race
 6.     image="path/to/image.png"
 7.     profile="path/to/portrait.png"
 8.     ellipse="misc/ellipse" # (We'll use the default one for now)
10.    hitpoints=1000000
11.    movement_type=smallfoot  # (we'll get to this later but for now use smallfoot)
12.    movement=6 # (quite obvious)
13.    experience=26
14.    level=0
15.    alignment=neutral
16.    advances_to=unit name # (always separate choices with a comma)
17.    # undead_variation= # (use mounted if it's a horse unit)
18.    cost=8
19.    usage= # (fighter,mixedfighter,healer etc...)
20.    description= _ "A small description of the unit."
21.    die_sound=diesound.ogg # (look at mainline unit files for an example)
22.    [portrait]
23.        size=400
24.        side="left"
25.        mirror="false"
26.        image="path/to/portrait.png"
27.     [/portrait]
28.     [attack]
29.        name=spear
30.        description=_ "spear"
31.        type=pierce
32.        range=melee
33.        damage=4
34.        number=2
35.     [/attack]
36. [/unit_type]

For imformation on how to add this to an era go to:

(For text editors: Notepad is the default for Windows, Textedit is the Default for Macs).

And there's still more to come!

This page was last edited on 29 October 2010, at 17:37.