<?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=Coffee</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=Coffee"/>
	<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/Special:Contributions/Coffee"/>
	<updated>2026-04-29T10:54:24Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.16</generator>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=53122</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=53122"/>
		<updated>2014-02-15T22:52:04Z</updated>

		<summary type="html">&lt;p&gt;Coffee: introduction to psuedo code change&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine.&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        '''start_time'''=-200&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause before attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-prepare-bow.png:25&lt;br /&gt;
        [/frame]&lt;br /&gt;
        #now the time is synchronized with the missile frame for the arrow&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-fire-bow[1~3].png:50&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause after attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        '''sound_start_time'''=-150&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
Note: that the arrow hits the target at time=0. Defense hit sounds are typically played at time=-25, slightly before the arrow hits the centre of the hex (the unit would feel it slightly before). It is the same idea for sword swishes and such, that 'hit' the outside of the unit before they hit the centre of the hex.&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
see below for more information.&lt;br /&gt;
&lt;br /&gt;
==== Progressive string square bracket expansion syntax ====&lt;br /&gt;
&lt;br /&gt;
The square bracket syntax for progressive strings is a syntactic shortcut that, for convenience, works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 (if you include leading zeros, the digits will be padded throughout that square bracket expansion to match)&lt;br /&gt;
 halo=halo[001~100].png  is equivalent to  halo=halo001.png,halo002.png,...,halo099.png,halo100.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 image=image[1~2]-ex[4~5].png:[100,200]  is equivalent to  image=image1-ex4.png:100,image2-ex5:200.png&lt;br /&gt;
 image=image[1~4].png:[10,20*3]          is equivalent to  image1.png:10,image2.png:20,image3.png:20,image4.png:20&lt;br /&gt;
 image=image[1~3].png:50,other.png:40    is equivalent to  image1.png:50,image2.png:50,image3.png:50,other.png:40&lt;br /&gt;
&lt;br /&gt;
Each set of square brackets (‘[’ and ‘]’) contains a comma-separated list — an '''''expansion list''''' — of which each element can be:&lt;br /&gt;
&lt;br /&gt;
* a '''plain string''' — e.g., “abc” or “123”;&lt;br /&gt;
* a '''range''', expressed as two radix-10 integers, separated by a tilde — e.g., “1~5”; or&lt;br /&gt;
* a '''repetition''', notated as a string and a radix-10 integer, separated by an asterisk — e.g., “a*3”.&lt;br /&gt;
&lt;br /&gt;
Ranges can not only be from a lesser number to a greater number (e.g., “1~5”), but can also be '''backward''' — from a greater number to a lesser number (e.g., “5~1”).&lt;br /&gt;
&lt;br /&gt;
===== Range expansion =====&lt;br /&gt;
&lt;br /&gt;
Each '''range''' ''&amp;lt;var&amp;gt;x&amp;lt;/var&amp;gt;~&amp;lt;var&amp;gt;y&amp;lt;/var&amp;gt;'' is expanded within its expansion list to a comma-separated list of radix-10 integers (which are plain strings), starting from the first endpoint &amp;lt;var&amp;gt;x&amp;lt;/var&amp;gt; and ending at the second endpoint &amp;lt;var&amp;gt;y&amp;lt;/var&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If '''&amp;lt;var&amp;gt;x&amp;lt;/var&amp;gt; &amp;lt; &amp;lt;var&amp;gt;y&amp;lt;/var&amp;gt;''', then the numbers in this list increase by increments of 1; if '''&amp;lt;var&amp;gt;x&amp;lt;/var&amp;gt; &amp;gt; &amp;lt;var&amp;gt;y&amp;lt;/var&amp;gt;''', then the numbers in this list decrease by decrements of 1. E.g., “1~3” would become “1,2,3”, and “3~1” would become “3,2,1”.&lt;br /&gt;
&lt;br /&gt;
If '''&amp;lt;var&amp;gt;x&amp;lt;/var&amp;gt; = &amp;lt;var&amp;gt;y&amp;lt;/var&amp;gt;''', then this list has only one element, which is &amp;lt;var&amp;gt;x&amp;lt;/var&amp;gt; (and is also &amp;lt;var&amp;gt;y&amp;lt;/var&amp;gt;, of course). E.g., “2~2” would becomes “2”.&lt;br /&gt;
&lt;br /&gt;
If either &amp;lt;var&amp;gt;x&amp;lt;/var&amp;gt; or &amp;lt;var&amp;gt;y&amp;lt;/var&amp;gt; (or both) are padded with '''leading zeros''', then each number in the resultant list will be padded with leading zeros such that it is expressed in at least &amp;lt;var&amp;gt;z&amp;lt;/var&amp;gt;+1 digits, where &amp;lt;var&amp;gt;z&amp;lt;/var&amp;gt; is the quantity of leading zeros with which one or both endpoints are padded. E.g.,&lt;br /&gt;
* “07~11” would become “07,08,09,10,11”,&lt;br /&gt;
* “098~100” would become “98,99,100”,&lt;br /&gt;
* “003~1” (or “3~001”) would become “003,002,001”, and&lt;br /&gt;
* “0098~100” would become “098,099,100” (although poor form), and&lt;br /&gt;
* “01~100” would become “01,02,...,10,11,...,999,100”.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If both endpoints are padded with leading zeros, they should both be padded with the same quantity of leading zeros.&lt;br /&gt;
&lt;br /&gt;
===== Repetition expansion =====&lt;br /&gt;
&lt;br /&gt;
Each '''repetition''' ''&amp;lt;var&amp;gt;s&amp;lt;/var&amp;gt;*&amp;lt;var&amp;gt;n&amp;lt;/var&amp;gt;'' is expanded within its expansion list to a comma-separated list with &amp;lt;var&amp;gt;n&amp;lt;/var&amp;gt; elements, each of which is the string &amp;lt;var&amp;gt;s&amp;lt;/var&amp;gt;. E.g., “abc*3” would become “abc,abc,abc”.&lt;br /&gt;
&lt;br /&gt;
===== Square bracket expansion =====&lt;br /&gt;
&lt;br /&gt;
A single '''progressive string value''' may contain multiple '''square-bracketed expansion lists''', which must all be of the same length in elements (after range and repetition expansion). This length shall be referred to as &amp;lt;var&amp;gt;L&amp;lt;/var&amp;gt; for the remainder of this section.&lt;br /&gt;
&lt;br /&gt;
When a progressive string that contains expansion lists is processed to expand its expansion lists, it is transformed into a comma-separated list with &amp;lt;var&amp;gt;L&amp;lt;/var&amp;gt; elements.&lt;br /&gt;
&lt;br /&gt;
For each integer &amp;lt;var&amp;gt;n&amp;lt;/var&amp;gt; from 1 to &amp;lt;var&amp;gt;L&amp;lt;/var&amp;gt;, the &amp;lt;var&amp;gt;n&amp;lt;/var&amp;gt;-th element of this list shall be a copy of the progressive string, with each expansion list it contains replaced with that expansion list’s &amp;lt;var&amp;gt;n&amp;lt;/var&amp;gt;-th element (after range and repetition expansion).&lt;br /&gt;
&lt;br /&gt;
When a progressive string that contains expansion lists is processed it is transformed at each bracket pair into a comma-separated list, which is generated as follows (in pseudo code):&lt;br /&gt;
 for each comma separated string entry&lt;br /&gt;
 	for all square brackets entries at once&lt;br /&gt;
 		expand outwards such that S[A~B]T expands to SAT, ..., SBT preserving any leading zeros&lt;br /&gt;
 		expand outwards such that S[A,B]T expands to SAT, SBT&lt;br /&gt;
 		expand outwards such that S[A*N]T expands to SAT, ..., SAT (n times)&lt;br /&gt;
 		and any combination of above separated by commas executed sequentially&lt;br /&gt;
 	next&lt;br /&gt;
 next&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
Note that xxx_ parameters (e.g. missile_offset) are shortcuts to access parameters from outside of their corresponding frame and have no effect inside of them.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 200ms in each hex. so you typically want to have an offset of ''0~1:200,0~1:200,0~1:200,0~1:200,0~1:200'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:200,0.6~0:200&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, and from 1.11.7+ you can nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
A macro exists under macros/sound-util.cfg called SOUND:HIT_AND_MISS to simplify this type of animation, which is equivalent to:&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [frame]&lt;br /&gt;
        image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
    [/frame]&lt;br /&gt;
    {SOUND:HIT_AND_MISS axe.ogg {SOUND_LIST:MISS} -100}&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=53121</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=53121"/>
		<updated>2014-02-15T22:43:02Z</updated>

		<summary type="html">&lt;p&gt;Coffee: square bracket headers down one level&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine.&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        '''start_time'''=-200&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause before attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-prepare-bow.png:25&lt;br /&gt;
        [/frame]&lt;br /&gt;
        #now the time is synchronized with the missile frame for the arrow&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-fire-bow[1~3].png:50&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause after attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        '''sound_start_time'''=-150&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
Note: that the arrow hits the target at time=0. Defense hit sounds are typically played at time=-25, slightly before the arrow hits the centre of the hex (the unit would feel it slightly before). It is the same idea for sword swishes and such, that 'hit' the outside of the unit before they hit the centre of the hex.&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
see below for more information.&lt;br /&gt;
&lt;br /&gt;
==== Progressive string square bracket expansion syntax ====&lt;br /&gt;
&lt;br /&gt;
The square bracket syntax for progressive strings is a syntactic shortcut that, for convenience, works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 (if you include leading zeros, the digits will be padded throughout that square bracket expansion to match)&lt;br /&gt;
 halo=halo[001~100].png  is equivalent to  halo=halo001.png,halo002.png,...,halo099.png,halo100.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 image=image[1~2]-ex[4~5].png:[100,200]  is equivalent to  image=image1-ex4.png:100,image2-ex5:200.png&lt;br /&gt;
 image=image[1~4].png:[10,20*3]          is equivalent to  image1.png:10,image2.png:20,image3.png:20,image4.png:20&lt;br /&gt;
 image=image[1~3].png:50,other.png:40    is equivalent to  image1.png:50,image2.png:50,image3.png:50,other.png:40&lt;br /&gt;
&lt;br /&gt;
Each set of square brackets (‘[’ and ‘]’) contains a comma-separated list — an '''''expansion list''''' — of which each element can be:&lt;br /&gt;
&lt;br /&gt;
* a '''plain string''' — e.g., “abc” or “123”;&lt;br /&gt;
* a '''range''', expressed as two radix-10 integers, separated by a tilde — e.g., “1~5”; or&lt;br /&gt;
* a '''repetition''', notated as a string and a radix-10 integer, separated by an asterisk — e.g., “a*3”.&lt;br /&gt;
&lt;br /&gt;
Ranges can not only be from a lesser number to a greater number (e.g., “1~5”), but can also be '''backward''' — from a greater number to a lesser number (e.g., “5~1”).&lt;br /&gt;
&lt;br /&gt;
===== Range expansion =====&lt;br /&gt;
&lt;br /&gt;
Each '''range''' ''&amp;lt;var&amp;gt;x&amp;lt;/var&amp;gt;~&amp;lt;var&amp;gt;y&amp;lt;/var&amp;gt;'' is expanded within its expansion list to a comma-separated list of radix-10 integers (which are plain strings), starting from the first endpoint &amp;lt;var&amp;gt;x&amp;lt;/var&amp;gt; and ending at the second endpoint &amp;lt;var&amp;gt;y&amp;lt;/var&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If '''&amp;lt;var&amp;gt;x&amp;lt;/var&amp;gt; &amp;lt; &amp;lt;var&amp;gt;y&amp;lt;/var&amp;gt;''', then the numbers in this list increase by increments of 1; if '''&amp;lt;var&amp;gt;x&amp;lt;/var&amp;gt; &amp;gt; &amp;lt;var&amp;gt;y&amp;lt;/var&amp;gt;''', then the numbers in this list decrease by decrements of 1. E.g., “1~3” would become “1,2,3”, and “3~1” would become “3,2,1”.&lt;br /&gt;
&lt;br /&gt;
If '''&amp;lt;var&amp;gt;x&amp;lt;/var&amp;gt; = &amp;lt;var&amp;gt;y&amp;lt;/var&amp;gt;''', then this list has only one element, which is &amp;lt;var&amp;gt;x&amp;lt;/var&amp;gt; (and is also &amp;lt;var&amp;gt;y&amp;lt;/var&amp;gt;, of course). E.g., “2~2” would becomes “2”.&lt;br /&gt;
&lt;br /&gt;
If either &amp;lt;var&amp;gt;x&amp;lt;/var&amp;gt; or &amp;lt;var&amp;gt;y&amp;lt;/var&amp;gt; (or both) are padded with '''leading zeros''', then each number in the resultant list will be padded with leading zeros such that it is expressed in at least &amp;lt;var&amp;gt;z&amp;lt;/var&amp;gt;+1 digits, where &amp;lt;var&amp;gt;z&amp;lt;/var&amp;gt; is the quantity of leading zeros with which one or both endpoints are padded. E.g.,&lt;br /&gt;
* “07~11” would become “07,08,09,10,11”,&lt;br /&gt;
* “098~100” would become “98,99,100”,&lt;br /&gt;
* “003~1” (or “3~001”) would become “003,002,001”, and&lt;br /&gt;
* “0098~100” would become “098,099,100” (although poor form), and&lt;br /&gt;
* “01~100” would become “01,02,...,10,11,...,999,100”.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If both endpoints are padded with leading zeros, they should both be padded with the same quantity of leading zeros.&lt;br /&gt;
&lt;br /&gt;
===== Repetition expansion =====&lt;br /&gt;
&lt;br /&gt;
Each '''repetition''' ''&amp;lt;var&amp;gt;s&amp;lt;/var&amp;gt;*&amp;lt;var&amp;gt;n&amp;lt;/var&amp;gt;'' is expanded within its expansion list to a comma-separated list with &amp;lt;var&amp;gt;n&amp;lt;/var&amp;gt; elements, each of which is the string &amp;lt;var&amp;gt;s&amp;lt;/var&amp;gt;. E.g., “abc*3” would become “abc,abc,abc”.&lt;br /&gt;
&lt;br /&gt;
===== Square bracket expansion =====&lt;br /&gt;
&lt;br /&gt;
A single '''progressive string value''' may contain multiple '''square-bracketed expansion lists''', which must all be of the same length in elements (after range and repetition expansion). This length shall be referred to as &amp;lt;var&amp;gt;L&amp;lt;/var&amp;gt; for the remainder of this section.&lt;br /&gt;
&lt;br /&gt;
When a progressive string that contains expansion lists is processed to expand its expansion lists, it is transformed into a comma-separated list with &amp;lt;var&amp;gt;L&amp;lt;/var&amp;gt; elements.&lt;br /&gt;
&lt;br /&gt;
For each integer &amp;lt;var&amp;gt;n&amp;lt;/var&amp;gt; from 1 to &amp;lt;var&amp;gt;L&amp;lt;/var&amp;gt;, the &amp;lt;var&amp;gt;n&amp;lt;/var&amp;gt;-th element of this list shall be a copy of the progressive string, with each expansion list it contains replaced with that expansion list’s &amp;lt;var&amp;gt;n&amp;lt;/var&amp;gt;-th element (after range and repetition expansion).&lt;br /&gt;
&lt;br /&gt;
When a progressive string that contains expansion lists is processed to expand its expansion lists, it is transformed into a comma-separated list, which is generated as follows (in pseudo code):&lt;br /&gt;
 for each comma separated string entry&lt;br /&gt;
 	for all square brackets entries at once&lt;br /&gt;
 		expand outwards such that S[A~B]T expands to SAT, ..., SBT preserving any leading zeros&lt;br /&gt;
 		expand outwards such that S[A,B]T expands to SAT, SBT&lt;br /&gt;
 		expand outwards such that S[A*N]T expands to SAT, ..., SAT (n times)&lt;br /&gt;
 		and any combination of above separated by commas executed sequentially&lt;br /&gt;
 	next&lt;br /&gt;
 next&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
Note that xxx_ parameters (e.g. missile_offset) are shortcuts to access parameters from outside of their corresponding frame and have no effect inside of them.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 200ms in each hex. so you typically want to have an offset of ''0~1:200,0~1:200,0~1:200,0~1:200,0~1:200'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:200,0.6~0:200&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, and from 1.11.7+ you can nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
A macro exists under macros/sound-util.cfg called SOUND:HIT_AND_MISS to simplify this type of animation, which is equivalent to:&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [frame]&lt;br /&gt;
        image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
    [/frame]&lt;br /&gt;
    {SOUND:HIT_AND_MISS axe.ogg {SOUND_LIST:MISS} -100}&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=53120</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=53120"/>
		<updated>2014-02-15T22:37:09Z</updated>

		<summary type="html">&lt;p&gt;Coffee: AI0867 updated documentation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine.&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        '''start_time'''=-200&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause before attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-prepare-bow.png:25&lt;br /&gt;
        [/frame]&lt;br /&gt;
        #now the time is synchronized with the missile frame for the arrow&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-fire-bow[1~3].png:50&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause after attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        '''sound_start_time'''=-150&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
Note: that the arrow hits the target at time=0. Defense hit sounds are typically played at time=-25, slightly before the arrow hits the centre of the hex (the unit would feel it slightly before). It is the same idea for sword swishes and such, that 'hit' the outside of the unit before they hit the centre of the hex.&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
see below for more information.&lt;br /&gt;
&lt;br /&gt;
==== Progressive string square bracket expansion syntax ====&lt;br /&gt;
&lt;br /&gt;
The square bracket syntax for progressive strings is a syntactic shortcut that, for convenience, works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 (if you include leading zeros, the digits will be padded throughout that square bracket expansion to match)&lt;br /&gt;
 halo=halo[001~100].png  is equivalent to  halo=halo001.png,halo002.png,...,halo099.png,halo100.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 image=image[1~2]-ex[4~5].png:[100,200]  is equivalent to  image=image1-ex4.png:100,image2-ex5:200.png&lt;br /&gt;
 image=image[1~4].png:[10,20*3]          is equivalent to  image1.png:10,image2.png:20,image3.png:20,image4.png:20&lt;br /&gt;
 image=image[1~3].png:50,other.png:40    is equivalent to  image1.png:50,image2.png:50,image3.png:50,other.png:40&lt;br /&gt;
&lt;br /&gt;
Each set of square brackets (‘[’ and ‘]’) contains a comma-separated list — an '''''expansion list''''' — of which each element can be:&lt;br /&gt;
&lt;br /&gt;
* a '''plain string''' — e.g., “abc” or “123”;&lt;br /&gt;
* a '''range''', expressed as two radix-10 integers, separated by a tilde — e.g., “1~5”; or&lt;br /&gt;
* a '''repetition''', notated as a string and a radix-10 integer, separated by an asterisk — e.g., “a*3”.&lt;br /&gt;
&lt;br /&gt;
Ranges can not only be from a lesser number to a greater number (e.g., “1~5”), but can also be '''backward''' — from a greater number to a lesser number (e.g., “5~1”).&lt;br /&gt;
&lt;br /&gt;
==== Range expansion ====&lt;br /&gt;
&lt;br /&gt;
Each '''range''' ''&amp;lt;var&amp;gt;x&amp;lt;/var&amp;gt;~&amp;lt;var&amp;gt;y&amp;lt;/var&amp;gt;'' is expanded within its expansion list to a comma-separated list of radix-10 integers (which are plain strings), starting from the first endpoint &amp;lt;var&amp;gt;x&amp;lt;/var&amp;gt; and ending at the second endpoint &amp;lt;var&amp;gt;y&amp;lt;/var&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If '''&amp;lt;var&amp;gt;x&amp;lt;/var&amp;gt; &amp;lt; &amp;lt;var&amp;gt;y&amp;lt;/var&amp;gt;''', then the numbers in this list increase by increments of 1; if '''&amp;lt;var&amp;gt;x&amp;lt;/var&amp;gt; &amp;gt; &amp;lt;var&amp;gt;y&amp;lt;/var&amp;gt;''', then the numbers in this list decrease by decrements of 1. E.g., “1~3” would become “1,2,3”, and “3~1” would become “3,2,1”.&lt;br /&gt;
&lt;br /&gt;
If '''&amp;lt;var&amp;gt;x&amp;lt;/var&amp;gt; = &amp;lt;var&amp;gt;y&amp;lt;/var&amp;gt;''', then this list has only one element, which is &amp;lt;var&amp;gt;x&amp;lt;/var&amp;gt; (and is also &amp;lt;var&amp;gt;y&amp;lt;/var&amp;gt;, of course). E.g., “2~2” would becomes “2”.&lt;br /&gt;
&lt;br /&gt;
If either &amp;lt;var&amp;gt;x&amp;lt;/var&amp;gt; or &amp;lt;var&amp;gt;y&amp;lt;/var&amp;gt; (or both) are padded with '''leading zeros''', then each number in the resultant list will be padded with leading zeros such that it is expressed in at least &amp;lt;var&amp;gt;z&amp;lt;/var&amp;gt;+1 digits, where &amp;lt;var&amp;gt;z&amp;lt;/var&amp;gt; is the quantity of leading zeros with which one or both endpoints are padded. E.g.,&lt;br /&gt;
* “07~11” would become “07,08,09,10,11”,&lt;br /&gt;
* “098~100” would become “98,99,100”,&lt;br /&gt;
* “003~1” (or “3~001”) would become “003,002,001”, and&lt;br /&gt;
* “0098~100” would become “098,099,100” (although poor form), and&lt;br /&gt;
* “01~100” would become “01,02,...,10,11,...,999,100”.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If both endpoints are padded with leading zeros, they should both be padded with the same quantity of leading zeros.&lt;br /&gt;
&lt;br /&gt;
==== Repetition expansion ====&lt;br /&gt;
&lt;br /&gt;
Each '''repetition''' ''&amp;lt;var&amp;gt;s&amp;lt;/var&amp;gt;*&amp;lt;var&amp;gt;n&amp;lt;/var&amp;gt;'' is expanded within its expansion list to a comma-separated list with &amp;lt;var&amp;gt;n&amp;lt;/var&amp;gt; elements, each of which is the string &amp;lt;var&amp;gt;s&amp;lt;/var&amp;gt;. E.g., “abc*3” would become “abc,abc,abc”.&lt;br /&gt;
&lt;br /&gt;
==== Square bracket expansion ====&lt;br /&gt;
&lt;br /&gt;
A single '''progressive string value''' may contain multiple '''square-bracketed expansion lists''', which must all be of the same length in elements (after range and repetition expansion). This length shall be referred to as &amp;lt;var&amp;gt;L&amp;lt;/var&amp;gt; for the remainder of this section.&lt;br /&gt;
&lt;br /&gt;
When a progressive string that contains expansion lists is processed to expand its expansion lists, it is transformed into a comma-separated list with &amp;lt;var&amp;gt;L&amp;lt;/var&amp;gt; elements.&lt;br /&gt;
&lt;br /&gt;
For each integer &amp;lt;var&amp;gt;n&amp;lt;/var&amp;gt; from 1 to &amp;lt;var&amp;gt;L&amp;lt;/var&amp;gt;, the &amp;lt;var&amp;gt;n&amp;lt;/var&amp;gt;-th element of this list shall be a copy of the progressive string, with each expansion list it contains replaced with that expansion list’s &amp;lt;var&amp;gt;n&amp;lt;/var&amp;gt;-th element (after range and repetition expansion).&lt;br /&gt;
&lt;br /&gt;
When a progressive string that contains expansion lists is processed to expand its expansion lists, it is transformed into a comma-separated list, which is generated as follows (in pseudo code):&lt;br /&gt;
 for each comma separated string entry&lt;br /&gt;
 	for all square brackets entries at once&lt;br /&gt;
 		expand outwards such that S[A~B]T expands to SAT, ..., SBT preserving any leading zeros&lt;br /&gt;
 		expand outwards such that S[A,B]T expands to SAT, SBT&lt;br /&gt;
 		expand outwards such that S[A*N]T expands to SAT, ..., SAT (n times)&lt;br /&gt;
 		and any combination of above separated by commas executed sequentially&lt;br /&gt;
 	next&lt;br /&gt;
 next&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
Note that xxx_ parameters (e.g. missile_offset) are shortcuts to access parameters from outside of their corresponding frame and have no effect inside of them.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 200ms in each hex. so you typically want to have an offset of ''0~1:200,0~1:200,0~1:200,0~1:200,0~1:200'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:200,0.6~0:200&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, and from 1.11.7+ you can nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
A macro exists under macros/sound-util.cfg called SOUND:HIT_AND_MISS to simplify this type of animation, which is equivalent to:&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [frame]&lt;br /&gt;
        image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
    [/frame]&lt;br /&gt;
    {SOUND:HIT_AND_MISS axe.ogg {SOUND_LIST:MISS} -100}&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=53001</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=53001"/>
		<updated>2014-02-08T02:48:36Z</updated>

		<summary type="html">&lt;p&gt;Coffee: Add pseduo code&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine.&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        '''start_time'''=-200&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause before attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-prepare-bow.png:25&lt;br /&gt;
        [/frame]&lt;br /&gt;
        #now the time is synchronized with the missile frame for the arrow&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-fire-bow[1~3].png:50&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause after attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        '''sound_start_time'''=-150&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
Note: that the arrow hits the target at time=0. Defense hit sounds are typically played at time=-25, slightly before the arrow hits the centre of the hex (the unit would feel it slightly before). It is the same idea for sword swishes and such, that 'hit' the outside of the unit before they hit the centre of the hex.&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
see below for more information.&lt;br /&gt;
&lt;br /&gt;
==== Progressive string square bracket expansion syntax ====&lt;br /&gt;
&lt;br /&gt;
The square bracket syntax for progressive strings is a syntactic shortcut that, for convenience, works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 (if you include leading zeros, the digits will be padded throughout that square bracket expansion to match)&lt;br /&gt;
 halo=halo[001~100].png  is equivalent to  halo=halo001.png,halo002.png,...,halo099.png,halo100.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 image=image[1~2]-ex[4~5].png:[100,200]  is equivalent to  image=image1-ex4.png:100,image2-ex5:200.png&lt;br /&gt;
 image=image[1~4].png:[10,20*3]          is equivalent to  image1.png:10,image2.png:20,image3.png:20,image4.png:20&lt;br /&gt;
 image=image[1~3].png:50,other.png:40    is equivalent to  image1.png:50,image2.png:50,image3.png:50,other.png:40&lt;br /&gt;
&lt;br /&gt;
All bracketed lists in the same progressive string within comma separation must have the same length (after ranges are expanded), and the result is a series of that many images.&lt;br /&gt;
&lt;br /&gt;
Each set of square brackets (‘[’ and ‘]’) contains a comma-separated list — an '''''expansion list''''' — of which each element can be:&lt;br /&gt;
&lt;br /&gt;
# a plain '''string''' — e.g., “abc” or “123”;&lt;br /&gt;
# a '''range''', expressed as two radix-10 integers, separated by a tilde — e.g., “1~5”; or&lt;br /&gt;
# a '''range''', where zero padding is preserved, otherwise as above — e.g., “01~10”; or&lt;br /&gt;
# a '''repetition''', notated as a string and a radix-10 integer, separated by an asterisk — e.g., “a*3”.&lt;br /&gt;
&lt;br /&gt;
'''Ranges''' can not only be from a lesser number to a greater number (e.g., “1~5”), but can also be backward — from a greater number to a lesser number (e.g., “5~1”).&lt;br /&gt;
&lt;br /&gt;
A single progressive string value may contain multiple expansion lists, which must all be of the same length in elements.&lt;br /&gt;
&lt;br /&gt;
When a progressive string that contains expansion lists is processed to expand its expansion lists, it is transformed into a comma-separated list, which is generated as follows (in pseudo code):&lt;br /&gt;
 for each comma separated string entry&lt;br /&gt;
 	for all square brackets entries at once&lt;br /&gt;
 		expand outwards such that S[A~B]T expands to SAT, ..., SBT preserving any leading zeros&lt;br /&gt;
 		expand outwards such that S[A,B]T expands to SAT, SBT&lt;br /&gt;
 		expand outwards such that S[A*N]T expands to SAT, ..., SAT (n times)&lt;br /&gt;
 		and any combination of above separated by commas executed sequentially&lt;br /&gt;
 	next&lt;br /&gt;
 next&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 200ms in each hex. so you typically want to have an offset of ''0~1:200,0~1:200,0~1:200,0~1:200,0~1:200'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:200,0.6~0:200&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, and from 1.11.7+ you can nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
A macro exists under macros/sound-util.cfg called SOUND:HIT_AND_MISS to simplify this type of animation, which is equivalent to:&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [frame]&lt;br /&gt;
        image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
    [/frame]&lt;br /&gt;
    {SOUND:HIT_AND_MISS axe.ogg {SOUND_LIST:MISS} -100}&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=53000</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=53000"/>
		<updated>2014-02-08T02:39:20Z</updated>

		<summary type="html">&lt;p&gt;Coffee: /* Progressive string square bracket expansion syntax */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine.&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        '''start_time'''=-200&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause before attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-prepare-bow.png:25&lt;br /&gt;
        [/frame]&lt;br /&gt;
        #now the time is synchronized with the missile frame for the arrow&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-fire-bow[1~3].png:50&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause after attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        '''sound_start_time'''=-150&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
Note: that the arrow hits the target at time=0. Defense hit sounds are typically played at time=-25, slightly before the arrow hits the centre of the hex (the unit would feel it slightly before). It is the same idea for sword swishes and such, that 'hit' the outside of the unit before they hit the centre of the hex.&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
see below for more information.&lt;br /&gt;
&lt;br /&gt;
==== Progressive string square bracket expansion syntax ====&lt;br /&gt;
&lt;br /&gt;
The square bracket syntax for progressive strings is a syntactic shortcut that, for convenience, works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 (if you include leading zeros, the digits will be padded throughout that square bracket expansion to match)&lt;br /&gt;
 halo=halo[001~100].png  is equivalent to  halo=halo001.png,halo002.png,...,halo099.png,halo100.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 image=image[1~2]-ex[4~5].png:[100,200]  is equivalent to  image=image1-ex4.png:100,image2-ex5:200.png&lt;br /&gt;
 image=image[1~4].png:[10,20*3]          is equivalent to  image1.png:10,image2.png:20,image3.png:20,image4.png:20&lt;br /&gt;
 image=image[1~3].png:50,other.png:40    is equivalent to  image1.png:50,image2.png:50,image3.png:50,other.png:40&lt;br /&gt;
&lt;br /&gt;
All bracketed lists in the same progressive string within comma separation must have the same length (after ranges are expanded), and the result is a series of that many images.&lt;br /&gt;
&lt;br /&gt;
Each set of square brackets (‘[’ and ‘]’) contains a comma-separated list — an '''''expansion list''''' — of which each element can be:&lt;br /&gt;
&lt;br /&gt;
# a plain '''string''' — e.g., “abc” or “123”;&lt;br /&gt;
# a '''range''', expressed as two radix-10 integers, separated by a tilde — e.g., “1~5”; or&lt;br /&gt;
# a '''range''', where zero padding is preserved, otherwise as above — e.g., “01~10”; or&lt;br /&gt;
# a '''repetition''', notated as a string and a radix-10 integer, separated by an asterisk — e.g., “a*3”.&lt;br /&gt;
&lt;br /&gt;
'''Ranges''' can not only be from a lesser number to a greater number (e.g., “1~5”), but can also be backward — from a greater number to a lesser number (e.g., “5~1”).&lt;br /&gt;
&lt;br /&gt;
A single progressive string value may contain multiple expansion lists, which must all be of the same length in elements.&lt;br /&gt;
&lt;br /&gt;
When a progressive string that contains expansion lists is processed to expand its expansion lists, it is transformed into a comma-separated list, which is generated as follows:&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 200ms in each hex. so you typically want to have an offset of ''0~1:200,0~1:200,0~1:200,0~1:200,0~1:200'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:200,0.6~0:200&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, and from 1.11.7+ you can nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
A macro exists under macros/sound-util.cfg called SOUND:HIT_AND_MISS to simplify this type of animation, which is equivalent to:&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [frame]&lt;br /&gt;
        image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
    [/frame]&lt;br /&gt;
    {SOUND:HIT_AND_MISS axe.ogg {SOUND_LIST:MISS} -100}&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52999</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52999"/>
		<updated>2014-02-08T02:38:07Z</updated>

		<summary type="html">&lt;p&gt;Coffee: Separate square bracket expansion into new subtopic&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine.&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        '''start_time'''=-200&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause before attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-prepare-bow.png:25&lt;br /&gt;
        [/frame]&lt;br /&gt;
        #now the time is synchronized with the missile frame for the arrow&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-fire-bow[1~3].png:50&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause after attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        '''sound_start_time'''=-150&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
Note: that the arrow hits the target at time=0. Defense hit sounds are typically played at time=-25, slightly before the arrow hits the centre of the hex (the unit would feel it slightly before). It is the same idea for sword swishes and such, that 'hit' the outside of the unit before they hit the centre of the hex.&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
see below for more information.&lt;br /&gt;
&lt;br /&gt;
==== Progressive string square bracket expansion syntax ====&lt;br /&gt;
&lt;br /&gt;
The square bracket syntax for progressive strings is a syntactic shortcut that, for convenience, works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 (if you include leading zeros, the digits will be padded throughout that square bracket expansion to match)&lt;br /&gt;
 halo=halo[001~100].png  is equivalent to  halo=halo001.png,halo002.png,...,halo099.png,halo100.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 image=image[1~2]-ex[4~5].png:[100,200]  is equivalent to  image=image1-ex4.png:100,image2-ex5:200.png&lt;br /&gt;
 image=image[1~4].png:[10,20*3]          is equivalent to  image1.png:10,image2.png:20,image3.png:20,image4.png:20&lt;br /&gt;
 image=image[1~3].png:50,other.png:40    is equivalent to  image1.png:50,image2.png:50,image3.png:50,other.png:40&lt;br /&gt;
&lt;br /&gt;
All bracketed lists in the same progressive string must have the same length (after ranges are expanded), and the result is a series of that many images.&lt;br /&gt;
&lt;br /&gt;
Each set of square brackets (‘[’ and ‘]’) contains a comma-separated list — an '''''expansion list''''' — of which each element can be:&lt;br /&gt;
&lt;br /&gt;
# a plain '''string''' — e.g., “abc” or “123”;&lt;br /&gt;
# a '''range''', expressed as two radix-10 integers, separated by a tilde — e.g., “1~5”; or&lt;br /&gt;
# a '''range''', where zero padding is preserved, otherwise as above — e.g., “01~10”; or&lt;br /&gt;
# a '''repetition''', notated as a string and a radix-10 integer, separated by an asterisk — e.g., “a*3”.&lt;br /&gt;
&lt;br /&gt;
'''Ranges''' can not only be from a lesser number to a greater number (e.g., “1~5”), but can also be backward — from a greater number to a lesser number (e.g., “5~1”).&lt;br /&gt;
&lt;br /&gt;
A single progressive string value may contain multiple expansion lists, which must all be of the same length in elements.&lt;br /&gt;
&lt;br /&gt;
When a progressive string that contains expansion lists is processed to expand its expansion lists, it is transformed into a comma-separated list, which is generated as follows:&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 200ms in each hex. so you typically want to have an offset of ''0~1:200,0~1:200,0~1:200,0~1:200,0~1:200'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:200,0.6~0:200&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, and from 1.11.7+ you can nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
A macro exists under macros/sound-util.cfg called SOUND:HIT_AND_MISS to simplify this type of animation, which is equivalent to:&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [frame]&lt;br /&gt;
        image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
    [/frame]&lt;br /&gt;
    {SOUND:HIT_AND_MISS axe.ogg {SOUND_LIST:MISS} -100}&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=SoC_People_to_bug_on_IRC&amp;diff=52997</id>
		<title>SoC People to bug on IRC</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=SoC_People_to_bug_on_IRC&amp;diff=52997"/>
		<updated>2014-02-08T02:05:26Z</updated>

		<summary type="html">&lt;p&gt;Coffee: Add mention of Boucman to animation code&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{SoC2014}}&lt;br /&gt;
&lt;br /&gt;
== People to bug on IRC ==&lt;br /&gt;
We have prepared a list of people with their &amp;quot;area of competence&amp;quot;. This is to give you an idea on which areas those people can be of help for you. Of course you should always just ask in the IRC chan, but those are the most likely ones to answer questions in the respective area. And here is the list:&lt;br /&gt;
&lt;br /&gt;
=== Coffee ===&lt;br /&gt;
Involved mostly in the animation coding and minor bugfixes, Coffee can help with coding questions surrounding unit animations. Boucman is also a good source for animation code, although currently an inactive developer.&lt;br /&gt;
&lt;br /&gt;
=== Crab_ ===&lt;br /&gt;
iurii chernyi (Crab) has joined the team in 2009. He restructured Wesnoth AI as part of GSoC-2009, and is an expert on all aspects of current Wesnoth AI codebase. So, he's the person to ask about anything in '''src/ai'''. He also knows much about campaign units/leaders persistence.&lt;br /&gt;
&lt;br /&gt;
=== happygrue/Wintermute === &lt;br /&gt;
&lt;br /&gt;
Has been involved with multiplayer balance and testing for a number of years.  Currently working on balancing the default+khalifate era, but interested in, and often available for, testing various aspects game play or mechanics.  A good person to bug about getting feedback from the multiplayer community about any relevant issue.&lt;br /&gt;
&lt;br /&gt;
=== loonycyborg ===&lt;br /&gt;
Maintainer of Wesnoth's SCons build system and windows packager. Might also help out with other buildsystems.&lt;br /&gt;
&lt;br /&gt;
=== mattsc ===&lt;br /&gt;
&lt;br /&gt;
Has no computer science background and doesn't really know much about how coding should be done, but has been fiddling with Wesnoth AI behavior for a while now, accumulating some empirical experience along the way.  He might be able to help with questions on AI behavior and, to a lesser extent, on AI functionality.&lt;br /&gt;
&lt;br /&gt;
=== Mordante ===&lt;br /&gt;
Many of the possible projects involve the code for which he is an area expert. Also, many of the possible projects currently listed on the ideas page require GUI parts to work. Mordante is currently busy rewriting the old gui engine, he will be our expert there as well as already being our area expert for the terrain engine. He also has limited experience with boost asio.&lt;br /&gt;
&lt;br /&gt;
=== Nils Kneuper (Ivanovic) ===&lt;br /&gt;
He is doing nothing special, he just does some &amp;quot;administrative work&amp;quot; like packaging fresh tarballs when it is time for them and works on setting up any kind of deadlines and timetables related to releasing. He has administrative powers in most areas, no matter if website, forum or IRC. Beside this he uploads translation updates, tries to communicate with the translation teams when it is required and translates a little bit himself every now and then. But in general he is not a real expert in anything, just has a look at things that come up and redirects people to the correct contacts.&lt;br /&gt;
&lt;br /&gt;
=== Noy ===&lt;br /&gt;
Noy is an oddity among developers; he's got no coding skills whatsoever and possesses a limited understanding of computers, which is illustrated by his difficulty operating a Mac. Instead, Noy makes his contribution in gameplay and multiplayer design, drawing upon his background in social sciences research, military strategy and playing games online, to understand the effects of development on the playing community behavior. Along with Soliton, Noy is a useful conduit to discuss any issues in this area.&lt;br /&gt;
&lt;br /&gt;
=== shadowm ===&lt;br /&gt;
He has been around since late 2007, and has worked in many areas of the game, including WML event commands handling, image path functions, and the add-ons client code. As an add-on content developer, he also knows a lot about the WML language itself (preprocessor, syntax) and the functionality available in single-player campaigns.&lt;br /&gt;
&lt;br /&gt;
=== Soliton ===&lt;br /&gt;
He knows our MP server setup best. Beside this he has already done a lot of work on the MP server himself. So he probably has most knowledge about it and, being one of our MP-developers, might provide important help from the perspective of the MP player community and what is needed there.&lt;br /&gt;
&lt;br /&gt;
=== vultraz ===&lt;br /&gt;
He can assist with questions related to the Lua GUI2 bindings and their usage.&lt;br /&gt;
&lt;br /&gt;
=== zookeeper ===&lt;br /&gt;
Has been around for a long time and has at least a passing familiarity with most things outside the engine code, music and Lua. Maintains a large part of the mainline campaigns and knows the WML language well. Can be contacted when it comes to anything related to WML, gameplay and scenario design, or the mainline content in general.&lt;br /&gt;
&lt;br /&gt;
== Inactive people ==&lt;br /&gt;
&lt;br /&gt;
These people are currently not actively participating in development and are likely not available to help. You can always try, of course. They may also not be entirely up-to-date regarding their areas of expertise anymore.&lt;br /&gt;
&lt;br /&gt;
=== boucman ===&lt;br /&gt;
As our &amp;quot;patch monkey&amp;quot; he accustomed to critiquing patches of every kind. Beside this, he knows many areas of the game due to working on applying patches. He is particularly used to answering question from new coders, and doesn't mind explaining trivial stuff. He was the one who started the &amp;quot;two patches, you're in&amp;quot; policy and the ReferenceWML part of the project.&lt;br /&gt;
&lt;br /&gt;
=== Dave alias Sirp ===&lt;br /&gt;
Sirp started Wesnoth and is our lead developer. He is currently our C++ expert and is also the one that is working on the new Formula AI. Any questions regarding the formula AI should be directed to him.&lt;br /&gt;
&lt;br /&gt;
=== Dragonking ===&lt;br /&gt;
&lt;br /&gt;
He is one of our best Wesnoth players, and understands the various strategies well. He has also programmed much of the Wesnoth Formula AI system and understands it well.&lt;br /&gt;
&lt;br /&gt;
=== Eric S. Raymond (ESR) ===&lt;br /&gt;
ESR is our project toolsmith; he has written several tools that semi-automate various aspects of WML maintenance.  While most of our developers/designers concentrate on either the C++ core or WML but not both, he has a balanced understanding of both levels and may be helpful in helping students develop a grasp of the overall architecture.  Finally, he did the last overhaul of the Wesnoth UI and understands UI design principles; he is well-equipped to guide students working in that area.&lt;br /&gt;
&lt;br /&gt;
=== Gabriel Morin (gabba) ===&lt;br /&gt;
&lt;br /&gt;
gabba joined the team in 2010 where he participated in GSoC, and is the conceptor and maintainer of Wesnoth's planning system, codenamed &amp;quot;Whiteboard&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== ilor ===&lt;br /&gt;
2008 GSoC student, worked on and maintains the new map editor in Wesnoth 1.5/1.6/1.7. Has some fairly recent experience with getting &amp;quot;in&amp;quot; the Wesnoth codebase.&lt;br /&gt;
&lt;br /&gt;
=== Karol Nowak (grzywacz) ===&lt;br /&gt;
Two years he participated at GSoC as a student, so he will understand the situation of GSoC students. Beside this he is our top expert on Wesnoth for embedded devices as he worked on the gp2x support.&lt;br /&gt;
&lt;br /&gt;
=== Sapient ===&lt;br /&gt;
This developer started working on the GUI and widgets, but recently he focused more on improving the internal mechanics of the WML engine such as variable look-ups and filtering. Sapient is not as active anymore but he does come one IRC in the evenings (U.S.A.). He has touched-up many areas of the code in small ways over time, thus he has a good general knowledge of the C++ code and also has worked a little on some python maintenance scripts. &lt;br /&gt;
&lt;br /&gt;
=== YogiHH ===&lt;br /&gt;
Since he is the developer who know most about building under Windows, he will probably be really helpful. Either if the student comes from the Windows side, or to help test resulting work to make sure that it does work on Windows and, for the case that it does not, to show them where problems are.&lt;br /&gt;
YogiHH also knows quite a bit about the game engine and everything that has to do with replays and savegames.&lt;br /&gt;
&lt;br /&gt;
=== Mythological or Rhuvaen ===&lt;br /&gt;
As our leading WML experts those are to be contacted when it comes to anything related WML problems since they know this stuff best. They do maintain most of the campaigns and improve them whenever they have a good idea for changes.&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=SoC_People_to_bug_on_IRC&amp;diff=52996</id>
		<title>SoC People to bug on IRC</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=SoC_People_to_bug_on_IRC&amp;diff=52996"/>
		<updated>2014-02-08T01:55:54Z</updated>

		<summary type="html">&lt;p&gt;Coffee: Add myself to list (Coffee)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{SoC2014}}&lt;br /&gt;
&lt;br /&gt;
== People to bug on IRC ==&lt;br /&gt;
We have prepared a list of people with their &amp;quot;area of competence&amp;quot;. This is to give you an idea on which areas those people can be of help for you. Of course you should always just ask in the IRC chan, but those are the most likely ones to answer questions in the respective area. And here is the list:&lt;br /&gt;
&lt;br /&gt;
=== Coffee ===&lt;br /&gt;
Involved mostly in the animation coding and minor bugfixes, Coffee can help with coding questions surrounding unit animations.&lt;br /&gt;
&lt;br /&gt;
=== Crab_ ===&lt;br /&gt;
iurii chernyi (Crab) has joined the team in 2009. He restructured Wesnoth AI as part of GSoC-2009, and is an expert on all aspects of current Wesnoth AI codebase. So, he's the person to ask about anything in '''src/ai'''. He also knows much about campaign units/leaders persistence.&lt;br /&gt;
&lt;br /&gt;
=== happygrue/Wintermute === &lt;br /&gt;
&lt;br /&gt;
Has been involved with multiplayer balance and testing for a number of years.  Currently working on balancing the default+khalifate era, but interested in, and often available for, testing various aspects game play or mechanics.  A good person to bug about getting feedback from the multiplayer community about any relevant issue.&lt;br /&gt;
&lt;br /&gt;
=== loonycyborg ===&lt;br /&gt;
Maintainer of Wesnoth's SCons build system and windows packager. Might also help out with other buildsystems.&lt;br /&gt;
&lt;br /&gt;
=== mattsc ===&lt;br /&gt;
&lt;br /&gt;
Has no computer science background and doesn't really know much about how coding should be done, but has been fiddling with Wesnoth AI behavior for a while now, accumulating some empirical experience along the way.  He might be able to help with questions on AI behavior and, to a lesser extent, on AI functionality.&lt;br /&gt;
&lt;br /&gt;
=== Mordante ===&lt;br /&gt;
Many of the possible projects involve the code for which he is an area expert. Also, many of the possible projects currently listed on the ideas page require GUI parts to work. Mordante is currently busy rewriting the old gui engine, he will be our expert there as well as already being our area expert for the terrain engine. He also has limited experience with boost asio.&lt;br /&gt;
&lt;br /&gt;
=== Nils Kneuper (Ivanovic) ===&lt;br /&gt;
He is doing nothing special, he just does some &amp;quot;administrative work&amp;quot; like packaging fresh tarballs when it is time for them and works on setting up any kind of deadlines and timetables related to releasing. He has administrative powers in most areas, no matter if website, forum or IRC. Beside this he uploads translation updates, tries to communicate with the translation teams when it is required and translates a little bit himself every now and then. But in general he is not a real expert in anything, just has a look at things that come up and redirects people to the correct contacts.&lt;br /&gt;
&lt;br /&gt;
=== Noy ===&lt;br /&gt;
Noy is an oddity among developers; he's got no coding skills whatsoever and possesses a limited understanding of computers, which is illustrated by his difficulty operating a Mac. Instead, Noy makes his contribution in gameplay and multiplayer design, drawing upon his background in social sciences research, military strategy and playing games online, to understand the effects of development on the playing community behavior. Along with Soliton, Noy is a useful conduit to discuss any issues in this area.&lt;br /&gt;
&lt;br /&gt;
=== shadowm ===&lt;br /&gt;
He has been around since late 2007, and has worked in many areas of the game, including WML event commands handling, image path functions, and the add-ons client code. As an add-on content developer, he also knows a lot about the WML language itself (preprocessor, syntax) and the functionality available in single-player campaigns.&lt;br /&gt;
&lt;br /&gt;
=== Soliton ===&lt;br /&gt;
He knows our MP server setup best. Beside this he has already done a lot of work on the MP server himself. So he probably has most knowledge about it and, being one of our MP-developers, might provide important help from the perspective of the MP player community and what is needed there.&lt;br /&gt;
&lt;br /&gt;
=== vultraz ===&lt;br /&gt;
He can assist with questions related to the Lua GUI2 bindings and their usage.&lt;br /&gt;
&lt;br /&gt;
=== zookeeper ===&lt;br /&gt;
Has been around for a long time and has at least a passing familiarity with most things outside the engine code, music and Lua. Maintains a large part of the mainline campaigns and knows the WML language well. Can be contacted when it comes to anything related to WML, gameplay and scenario design, or the mainline content in general.&lt;br /&gt;
&lt;br /&gt;
== Inactive people ==&lt;br /&gt;
&lt;br /&gt;
These people are currently not actively participating in development and are likely not available to help. You can always try, of course. They may also not be entirely up-to-date regarding their areas of expertise anymore.&lt;br /&gt;
&lt;br /&gt;
=== boucman ===&lt;br /&gt;
As our &amp;quot;patch monkey&amp;quot; he accustomed to critiquing patches of every kind. Beside this, he knows many areas of the game due to working on applying patches. He is particularly used to answering question from new coders, and doesn't mind explaining trivial stuff. He was the one who started the &amp;quot;two patches, you're in&amp;quot; policy and the ReferenceWML part of the project.&lt;br /&gt;
&lt;br /&gt;
=== Dave alias Sirp ===&lt;br /&gt;
Sirp started Wesnoth and is our lead developer. He is currently our C++ expert and is also the one that is working on the new Formula AI. Any questions regarding the formula AI should be directed to him.&lt;br /&gt;
&lt;br /&gt;
=== Dragonking ===&lt;br /&gt;
&lt;br /&gt;
He is one of our best Wesnoth players, and understands the various strategies well. He has also programmed much of the Wesnoth Formula AI system and understands it well.&lt;br /&gt;
&lt;br /&gt;
=== Eric S. Raymond (ESR) ===&lt;br /&gt;
ESR is our project toolsmith; he has written several tools that semi-automate various aspects of WML maintenance.  While most of our developers/designers concentrate on either the C++ core or WML but not both, he has a balanced understanding of both levels and may be helpful in helping students develop a grasp of the overall architecture.  Finally, he did the last overhaul of the Wesnoth UI and understands UI design principles; he is well-equipped to guide students working in that area.&lt;br /&gt;
&lt;br /&gt;
=== Gabriel Morin (gabba) ===&lt;br /&gt;
&lt;br /&gt;
gabba joined the team in 2010 where he participated in GSoC, and is the conceptor and maintainer of Wesnoth's planning system, codenamed &amp;quot;Whiteboard&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== ilor ===&lt;br /&gt;
2008 GSoC student, worked on and maintains the new map editor in Wesnoth 1.5/1.6/1.7. Has some fairly recent experience with getting &amp;quot;in&amp;quot; the Wesnoth codebase.&lt;br /&gt;
&lt;br /&gt;
=== Karol Nowak (grzywacz) ===&lt;br /&gt;
Two years he participated at GSoC as a student, so he will understand the situation of GSoC students. Beside this he is our top expert on Wesnoth for embedded devices as he worked on the gp2x support.&lt;br /&gt;
&lt;br /&gt;
=== Sapient ===&lt;br /&gt;
This developer started working on the GUI and widgets, but recently he focused more on improving the internal mechanics of the WML engine such as variable look-ups and filtering. Sapient is not as active anymore but he does come one IRC in the evenings (U.S.A.). He has touched-up many areas of the code in small ways over time, thus he has a good general knowledge of the C++ code and also has worked a little on some python maintenance scripts. &lt;br /&gt;
&lt;br /&gt;
=== YogiHH ===&lt;br /&gt;
Since he is the developer who know most about building under Windows, he will probably be really helpful. Either if the student comes from the Windows side, or to help test resulting work to make sure that it does work on Windows and, for the case that it does not, to show them where problems are.&lt;br /&gt;
YogiHH also knows quite a bit about the game engine and everything that has to do with replays and savegames.&lt;br /&gt;
&lt;br /&gt;
=== Mythological or Rhuvaen ===&lt;br /&gt;
As our leading WML experts those are to be contacted when it comes to anything related WML problems since they know this stuff best. They do maintain most of the campaigns and improve them whenever they have a good idea for changes.&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52995</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52995"/>
		<updated>2014-02-08T01:48:11Z</updated>

		<summary type="html">&lt;p&gt;Coffee: /* Progressive parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine.&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        '''start_time'''=-200&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause before attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-prepare-bow.png:25&lt;br /&gt;
        [/frame]&lt;br /&gt;
        #now the time is synchronized with the missile frame for the arrow&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-fire-bow[1~3].png:50&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause after attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        '''sound_start_time'''=-150&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
Note: that the arrow hits the target at time=0. Defense hit sounds are typically played at time=-25, slightly before the arrow hits the centre of the hex (the unit would feel it slightly before). It is the same idea for sword swishes and such, that 'hit' the outside of the unit before they hit the centre of the hex.&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
for convenience, the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 (if you include leading zeros, the digits will be padded throughout that square bracket expansion to match)&lt;br /&gt;
 halo=halo[001~100].png  is equivalent to  halo=halo001.png,halo002.png,...,halo099.png,halo100.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 image=image[1~2]-ex[4~5].png:[100,200]  is equivalent to  image=image1-ex4.png:100,image2-ex5:200.png&lt;br /&gt;
 image=image[1~4].png:[10,20*3]          is equivalent to  image1.png:10,image2.png:20,image3.png:20,image4.png:20&lt;br /&gt;
 image=image[1~3].png:50,other.png:40    is equivalent to  image1.png:50,image2.png:50,image3.png:50,other.png:40&lt;br /&gt;
&lt;br /&gt;
Or more formally:&lt;br /&gt;
Each set of square brackets must contain a list, either defined by a range (e.g. [1~4] becomes a list of four, with increments of one, and this works in reverse also from 4~1) or a comma-separated list which can contain any strings (e.g. [1,a,2]). All bracketed lists in the same progressive string must have the same length (after ranges are expanded), and the result is a series of that many images.&lt;br /&gt;
A bracketed range where the first element has leading zeroes will be padded to that length throughout. If so, the number specifying the end of the range must have the same number of digits. An asterisk will make n copies of what precedes it in an expansion for [string*N] (which is equivalent to [string,...,string] N times.&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 200ms in each hex. so you typically want to have an offset of ''0~1:200,0~1:200,0~1:200,0~1:200,0~1:200'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:200,0.6~0:200&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, and from 1.11.7+ you can nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
A macro exists under macros/sound-util.cfg called SOUND:HIT_AND_MISS to simplify this type of animation, which is equivalent to:&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [frame]&lt;br /&gt;
        image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
    [/frame]&lt;br /&gt;
    {SOUND:HIT_AND_MISS axe.ogg {SOUND_LIST:MISS} -100}&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52994</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52994"/>
		<updated>2014-02-08T01:30:49Z</updated>

		<summary type="html">&lt;p&gt;Coffee: /* Progressive parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine.&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        '''start_time'''=-200&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause before attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-prepare-bow.png:25&lt;br /&gt;
        [/frame]&lt;br /&gt;
        #now the time is synchronized with the missile frame for the arrow&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-fire-bow[1~3].png:50&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause after attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        '''sound_start_time'''=-150&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
Note: that the arrow hits the target at time=0. Defense hit sounds are typically played at time=-25, slightly before the arrow hits the centre of the hex (the unit would feel it slightly before). It is the same idea for sword swishes and such, that 'hit' the outside of the unit before they hit the centre of the hex.&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
for convenience, the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 (if you include leading zeros, the digits will be padded throughout that square bracket expansion to match)&lt;br /&gt;
 halo=halo[001~100].png  is equivalent to  halo=halo001.png,halo002.png,...,halo099.png,halo100.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 image=image[1~2]-ex[4~5].png:[100,200]  is equivalent to  image=image1-ex4.png:100,image2-ex5:200.png&lt;br /&gt;
 image=image[1~4].png:[10,20*3]          is equivalent to  image1.png:10,image2.png:20,image3.png:20,image4.png:20&lt;br /&gt;
 image=image[1~3].png:50,other.png:40    is equivalent to  image1.png:50,image2.png:50,image3.png:50,other.png:40&lt;br /&gt;
&lt;br /&gt;
Or more formally:&lt;br /&gt;
Each set of square brackets must contain a list, either defined by a range (e.g. [1~4] becomes a list of four, with increments of one, and this works in reverse also from 4~1) or a comma-separated list which can contain any strings (e.g. [1,a,2]). All bracketed lists in the same progressive string must have the same length (after ranges are expanded), and the result is a series of that many images.&lt;br /&gt;
A bracketed range where the first element has leading zeroes will be padded to that length throughout. If so, the number specifying the end of the range must have the same number of digits. An asterisk will make n copies of what precedes it in an expansion for [string*N] (which is equivalent to [string1,...stringN].&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 200ms in each hex. so you typically want to have an offset of ''0~1:200,0~1:200,0~1:200,0~1:200,0~1:200'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:200,0.6~0:200&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, and from 1.11.7+ you can nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
A macro exists under macros/sound-util.cfg called SOUND:HIT_AND_MISS to simplify this type of animation, which is equivalent to:&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [frame]&lt;br /&gt;
        image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
    [/frame]&lt;br /&gt;
    {SOUND:HIT_AND_MISS axe.ogg {SOUND_LIST:MISS} -100}&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52993</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52993"/>
		<updated>2014-02-08T01:29:22Z</updated>

		<summary type="html">&lt;p&gt;Coffee: /* Progressive parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine.&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        '''start_time'''=-200&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause before attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-prepare-bow.png:25&lt;br /&gt;
        [/frame]&lt;br /&gt;
        #now the time is synchronized with the missile frame for the arrow&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-fire-bow[1~3].png:50&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause after attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        '''sound_start_time'''=-150&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
Note: that the arrow hits the target at time=0. Defense hit sounds are typically played at time=-25, slightly before the arrow hits the centre of the hex (the unit would feel it slightly before). It is the same idea for sword swishes and such, that 'hit' the outside of the unit before they hit the centre of the hex.&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
for convenience, the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 (if you include leading zeros, the digits will be padded throughout that square bracket expansion to match)&lt;br /&gt;
 halo=halo[001~100].png  is equivalent to  halo=halo001.png,halo002.png,...,halo099.png,halo100.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 image=image[1~2]-ex[4~5].png:[100,200]  is equivalent to  image=image1-ex4.png:100,image2-ex5:200.png&lt;br /&gt;
 image=image[1~4].png:[10,20*3]          is equivalent to  image1.png:10,image2.png:20,image3.png:20,image4.png:20&lt;br /&gt;
 image=image[1~3].png:50,other.png:40    is equivalent to  image1.png:50,image2.png:50,image3.png:50,other.png:40&lt;br /&gt;
&lt;br /&gt;
Or more formally:&lt;br /&gt;
Each set of square brackets must contain a list, either defined by a range (e.g. [1~4] becomes a list of four, with increments of one, and this works in reverse also from 4~1) or a comma-separated list which can contain any strings (e.g. [1,a,2]). All bracketed lists in the same progressive string must have the same length (after ranges are expanded), and the result is a series of that many images.&lt;br /&gt;
A bracketed range where the first element has leading zeroes will be padded to that length throughout. If so, the number specifying the end of the range must have the same number of digits. An asterisk will make n copies of what precedes it in an expansion for [string*n].&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 200ms in each hex. so you typically want to have an offset of ''0~1:200,0~1:200,0~1:200,0~1:200,0~1:200'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:200,0.6~0:200&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, and from 1.11.7+ you can nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
A macro exists under macros/sound-util.cfg called SOUND:HIT_AND_MISS to simplify this type of animation, which is equivalent to:&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [frame]&lt;br /&gt;
        image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
    [/frame]&lt;br /&gt;
    {SOUND:HIT_AND_MISS axe.ogg {SOUND_LIST:MISS} -100}&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52992</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52992"/>
		<updated>2014-02-08T01:26:37Z</updated>

		<summary type="html">&lt;p&gt;Coffee: Formal description of square bracket syntax&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine.&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        '''start_time'''=-200&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause before attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-prepare-bow.png:25&lt;br /&gt;
        [/frame]&lt;br /&gt;
        #now the time is synchronized with the missile frame for the arrow&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-fire-bow[1~3].png:50&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause after attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        '''sound_start_time'''=-150&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
Note: that the arrow hits the target at time=0. Defense hit sounds are typically played at time=-25, slightly before the arrow hits the centre of the hex (the unit would feel it slightly before). It is the same idea for sword swishes and such, that 'hit' the outside of the unit before they hit the centre of the hex.&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
for convenience, the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 (if you include leading zeros, the digits will be padded throughout that square bracket expansion to match)&lt;br /&gt;
 halo=halo[001~100].png  is equivalent to  halo=halo001.png,halo002.png,...,halo099.png,halo100.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 image=image[1~2]-ex[4~5].png:[100,200]  is equivalent to  image=image1-ex4.png:100,image2-ex5:200.png&lt;br /&gt;
 image=image[1~4].png:[10,20*3]          is equivalent to  image1.png:10,image2.png:20,image3.png:20,image4.png:20&lt;br /&gt;
 image=image[1~3].png:50,other.png:40    is equivalent to  image1.png:50,image2.png:50,image3.png:50,other.png:40&lt;br /&gt;
&lt;br /&gt;
Or more formally:&lt;br /&gt;
Each set of square brackets must contain a list, either defined by a range (e.g. [1~4] becomes a list of four, with increments of one, and this works in reverse also from 4~1) or a comma-separated list which can contain any strings (e.g. [1,a,2]). All bracketed lists in the same progressive string must have the same length (after ranges are expanded), and the result is a series of that many images.&lt;br /&gt;
A bracketed range where the first element has leading zeroes will be padded to that length throughout. If so, the number specifying the end of the range must have the same number of digits.&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 200ms in each hex. so you typically want to have an offset of ''0~1:200,0~1:200,0~1:200,0~1:200,0~1:200'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:200,0.6~0:200&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, and from 1.11.7+ you can nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
A macro exists under macros/sound-util.cfg called SOUND:HIT_AND_MISS to simplify this type of animation, which is equivalent to:&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [frame]&lt;br /&gt;
        image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
    [/frame]&lt;br /&gt;
    {SOUND:HIT_AND_MISS axe.ogg {SOUND_LIST:MISS} -100}&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52991</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52991"/>
		<updated>2014-02-08T01:19:08Z</updated>

		<summary type="html">&lt;p&gt;Coffee: /* Progressive parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine.&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        '''start_time'''=-200&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause before attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-prepare-bow.png:25&lt;br /&gt;
        [/frame]&lt;br /&gt;
        #now the time is synchronized with the missile frame for the arrow&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-fire-bow[1~3].png:50&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause after attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        '''sound_start_time'''=-150&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
Note: that the arrow hits the target at time=0. Defense hit sounds are typically played at time=-25, slightly before the arrow hits the centre of the hex (the unit would feel it slightly before). It is the same idea for sword swishes and such, that 'hit' the outside of the unit before they hit the centre of the hex.&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
for convenience, the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 (if you include leading zeros, the digits will be padded throughout that square bracket expansion to match)&lt;br /&gt;
 halo=halo[001~100].png  is equivalent to  halo=halo001.png,halo002.png,...,halo099.png,halo100.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 image=image[1~2]-ex[4~5].png:[100,200]  is equivalent to  image=image1-ex4.png:100,image2-ex5:200.png&lt;br /&gt;
 image=image[1~4].png:[10,20*3]          is equivalent to  image1.png:10,image2.png:20,image3.png:20,image4.png:20&lt;br /&gt;
 image=image[1~3].png:50,other.png:40    is equivalent to  image1.png:50,image2.png:50,image3.png:50,other.png:40&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 200ms in each hex. so you typically want to have an offset of ''0~1:200,0~1:200,0~1:200,0~1:200,0~1:200'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:200,0.6~0:200&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, and from 1.11.7+ you can nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
A macro exists under macros/sound-util.cfg called SOUND:HIT_AND_MISS to simplify this type of animation, which is equivalent to:&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [frame]&lt;br /&gt;
        image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
    [/frame]&lt;br /&gt;
    {SOUND:HIT_AND_MISS axe.ogg {SOUND_LIST:MISS} -100}&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52990</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52990"/>
		<updated>2014-02-08T01:16:49Z</updated>

		<summary type="html">&lt;p&gt;Coffee: /* The content of a frame */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine.&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        '''start_time'''=-200&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause before attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-prepare-bow.png:25&lt;br /&gt;
        [/frame]&lt;br /&gt;
        #now the time is synchronized with the missile frame for the arrow&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-fire-bow[1~3].png:50&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause after attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        '''sound_start_time'''=-150&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
Note: that the arrow hits the target at time=0. Defense hit sounds are typically played at time=-25, slightly before the arrow hits the centre of the hex (the unit would feel it slightly before). It is the same idea for sword swishes and such, that 'hit' the outside of the unit before they hit the centre of the hex.&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
for convenience, the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 (if you include leading zeros, the digits will be padded throughout the expansion to match)&lt;br /&gt;
 halo=halo[001~100].png  is equivalent to  halo=halo001.png,halo002.png,...,halo099.png,halo100.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 image=image[1~2]-ex[4~5].png:[100,200]  is equivalent to  image=image1-ex4.png:100,image2-ex5:200.png&lt;br /&gt;
 image=image[1~4].png:[10,20*3]          is equivalent to  image1.png:10,image2.png:20,image3.png:20,image4.png:20&lt;br /&gt;
 image=image[1~3].png:50,other.png:40    is equivalent to  image1.png:50,image2.png:50,image3.png:50,other.png:40&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 200ms in each hex. so you typically want to have an offset of ''0~1:200,0~1:200,0~1:200,0~1:200,0~1:200'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:200,0.6~0:200&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, and from 1.11.7+ you can nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
A macro exists under macros/sound-util.cfg called SOUND:HIT_AND_MISS to simplify this type of animation, which is equivalent to:&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [frame]&lt;br /&gt;
        image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
    [/frame]&lt;br /&gt;
    {SOUND:HIT_AND_MISS axe.ogg {SOUND_LIST:MISS} -100}&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52989</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52989"/>
		<updated>2014-02-08T01:16:13Z</updated>

		<summary type="html">&lt;p&gt;Coffee: Extra examples and note about leading zero expansions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine.&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        '''start_time'''=-200&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause before attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-prepare-bow.png:25&lt;br /&gt;
        [/frame]&lt;br /&gt;
        #now the time is synchronized with the missile frame for the arrow&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-fire-bow[1~3].png:50&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause after attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        '''sound_start_time'''=-150&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
Note: that the arrow hits the target at time=0. Defense hit sounds are typically played at time=-25, slightly before the arrow hits the centre of the hex (the unit would feel it slightly before). It is the same idea for sword swishes and such, that 'hit' the outside of the unit before they hit the centre of the hex.&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
for convenience, the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
(if you include leading zeros, the digits will be padded throughout the expansion to match)&lt;br /&gt;
 halo=halo[001~100].png  is equivalent to  halo=halo001.png,halo002.png,...,halo099.png,halo100.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 image=image[1~2]-ex[4~5].png:[100,200]  is equivalent to  image=image1-ex4.png:100,image2-ex5:200.png&lt;br /&gt;
 image=image[1~4].png:[10,20*3]          is equivalent to  image1.png:10,image2.png:20,image3.png:20,image4.png:20&lt;br /&gt;
 image=image[1~3].png:50,other.png:40    is equivalent to  image1.png:50,image2.png:50,image3.png:50,other.png:40&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 200ms in each hex. so you typically want to have an offset of ''0~1:200,0~1:200,0~1:200,0~1:200,0~1:200'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:200,0.6~0:200&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, and from 1.11.7+ you can nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
A macro exists under macros/sound-util.cfg called SOUND:HIT_AND_MISS to simplify this type of animation, which is equivalent to:&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [frame]&lt;br /&gt;
        image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
    [/frame]&lt;br /&gt;
    {SOUND:HIT_AND_MISS axe.ogg {SOUND_LIST:MISS} -100}&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52988</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52988"/>
		<updated>2014-02-08T01:03:00Z</updated>

		<summary type="html">&lt;p&gt;Coffee: /* Progressive parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine.&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        '''start_time'''=-200&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause before attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-prepare-bow.png:25&lt;br /&gt;
        [/frame]&lt;br /&gt;
        #now the time is synchronized with the missile frame for the arrow&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-fire-bow[1~3].png:50&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause after attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        '''sound_start_time'''=-150&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
Note: that the arrow hits the target at time=0. Defense hit sounds are typically played at time=-25, slightly before the arrow hits the centre of the hex (the unit would feel it slightly before). It is the same idea for sword swishes and such, that 'hit' the outside of the unit before they hit the centre of the hex.&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
for convenience, the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 image=image[1~2]-ex[4~5].png:[100,200]  is equivalent to  image=image1-ex4.png:100,image2-ex5:200.png&lt;br /&gt;
 image=image[1~4].png:[10,20*3]          is equivalent to  image1.png:10,image2.png:20,image3.png:20,image4.png:20&lt;br /&gt;
 image=image[1~3].png:50,other.png:40    is equivalent to  image1.png:50,image2.png:50,image3.png:50,other.png:40&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 200ms in each hex. so you typically want to have an offset of ''0~1:200,0~1:200,0~1:200,0~1:200,0~1:200'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:200,0.6~0:200&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, and from 1.11.7+ you can nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
A macro exists under macros/sound-util.cfg called SOUND:HIT_AND_MISS to simplify this type of animation, which is equivalent to:&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [frame]&lt;br /&gt;
        image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
    [/frame]&lt;br /&gt;
    {SOUND:HIT_AND_MISS axe.ogg {SOUND_LIST:MISS} -100}&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52987</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52987"/>
		<updated>2014-02-08T01:02:39Z</updated>

		<summary type="html">&lt;p&gt;Coffee: Add extra example for square bracket syntax&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine.&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        '''start_time'''=-200&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause before attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-prepare-bow.png:25&lt;br /&gt;
        [/frame]&lt;br /&gt;
        #now the time is synchronized with the missile frame for the arrow&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-fire-bow[1~3].png:50&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause after attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        '''sound_start_time'''=-150&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
Note: that the arrow hits the target at time=0. Defense hit sounds are typically played at time=-25, slightly before the arrow hits the centre of the hex (the unit would feel it slightly before). It is the same idea for sword swishes and such, that 'hit' the outside of the unit before they hit the centre of the hex.&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
for convenience, the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 image=image[1~2]-ex[4~5].png:[100,200]  is equivalent to  image=image1-ex4.png:100,image2-ex5:200.png&lt;br /&gt;
 image=image[1~4].png:[10,20*3]          is equivalent to  image1.png:10,image2.png:20,image3.png:20,image4.png:20&lt;br /&gt;
 image=image[1~3].png:50,other.png:40          is equivalent to  image1.png:50,image2.png:50,image3.png:50,other.png:40&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 200ms in each hex. so you typically want to have an offset of ''0~1:200,0~1:200,0~1:200,0~1:200,0~1:200'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:200,0.6~0:200&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, and from 1.11.7+ you can nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
A macro exists under macros/sound-util.cfg called SOUND:HIT_AND_MISS to simplify this type of animation, which is equivalent to:&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [frame]&lt;br /&gt;
        image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
    [/frame]&lt;br /&gt;
    {SOUND:HIT_AND_MISS axe.ogg {SOUND_LIST:MISS} -100}&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52372</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52372"/>
		<updated>2013-11-09T16:45:53Z</updated>

		<summary type="html">&lt;p&gt;Coffee: Update for 'if' 'else' new capabilities in 1.11.7&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine.&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        '''start_time'''=-200&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause before attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-prepare-bow.png:25&lt;br /&gt;
        [/frame]&lt;br /&gt;
        #now the time is synchronized with the missile frame for the arrow&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-fire-bow[1~3].png:50&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause after attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        '''sound_start_time'''=-150&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
Note: that the arrow hits the target at time=0. Defense hit sounds are typically played at time=-25, slightly before the arrow hits the centre of the hex (the unit would feel it slightly before). It is the same idea for sword swishes and such, that 'hit' the outside of the unit before they hit the centre of the hex.&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
for convenience, the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 image=image[1~2]-ex[4~5].png:[100,200]  is equivalent to  image=image1-ex4.png:100,image2-ex5:200.png&lt;br /&gt;
 image=image[1~4].png:[10,20*3]          is equivalent to  image1.png:10,image2.png:20,image3.png:20,image4.png:20&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 200ms in each hex. so you typically want to have an offset of ''0~1:200,0~1:200,0~1:200,0~1:200,0~1:200'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:200,0.6~0:200&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, and from 1.11.7+ you can nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
A macro exists under macros/sound-util.cfg called SOUND:HIT_AND_MISS to simplify this type of animation, which is equivalent to:&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [frame]&lt;br /&gt;
        image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
    [/frame]&lt;br /&gt;
    {SOUND:HIT_AND_MISS axe.ogg {SOUND_LIST:MISS} -100}&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52179</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52179"/>
		<updated>2013-10-12T23:04:36Z</updated>

		<summary type="html">&lt;p&gt;Coffee: /* Example Syntax */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine.&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        '''start_time'''=-200&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause before attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-prepare-bow.png:25&lt;br /&gt;
        [/frame]&lt;br /&gt;
        #now the time is synchronized with the missile frame for the arrow&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-fire-bow[1~3].png:50&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause after attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        '''sound_start_time'''=-150&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
Note: that the arrow hits the target at time=0. Defense hit sounds are typically played at time=-25, slightly before the arrow hits the centre of the hex (the unit would feel it slightly before). It is the same idea for sword swishes and such, that 'hit' the outside of the unit before they hit the centre of the hex.&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
for convenience, the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 image=image[1~2]-ex[4~5].png:[100,200]  is equivalent to  image=image1-ex4.png:100,image2-ex5:200.png&lt;br /&gt;
 image=image[1~4].png:[10,20*3]          is equivalent to  image1.png:10,image2.png:20,image3.png:20,image4.png:20&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 200ms in each hex. so you typically want to have an offset of ''0~1:200,0~1:200,0~1:200,0~1:200,0~1:200'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:200,0.6~0:200&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, but you can't nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
A macro exists under macros/sound-util.cfg called SOUND:HIT_AND_MISS to simplify this type of animation, which is equivalent to:&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [frame]&lt;br /&gt;
        image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
    [/frame]&lt;br /&gt;
    {SOUND:HIT_AND_MISS axe.ogg {SOUND_LIST:MISS} -100}&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52178</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52178"/>
		<updated>2013-10-12T23:03:11Z</updated>

		<summary type="html">&lt;p&gt;Coffee: Note about timing&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine.&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        '''start_time'''=-200&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause before attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-prepare-bow.png:25&lt;br /&gt;
        [/frame]&lt;br /&gt;
        #now the time is synchronized with the missile frame for the arrow&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-fire-bow[1~3].png:50&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause after attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        '''sound_start_time'''=-150&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
Note: that the arrow hits the target at time=0. Defense hit sounds are typically played at time=-25 slightly before the arrow hits the centre of the hex (the unit would feel it slightly before). It is the same idea for sword swishes and such, that 'hit' the outside of the unit before they hit the centre of the hex.&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
for convenience, the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 image=image[1~2]-ex[4~5].png:[100,200]  is equivalent to  image=image1-ex4.png:100,image2-ex5:200.png&lt;br /&gt;
 image=image[1~4].png:[10,20*3]          is equivalent to  image1.png:10,image2.png:20,image3.png:20,image4.png:20&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 200ms in each hex. so you typically want to have an offset of ''0~1:200,0~1:200,0~1:200,0~1:200,0~1:200'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:200,0.6~0:200&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, but you can't nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
A macro exists under macros/sound-util.cfg called SOUND:HIT_AND_MISS to simplify this type of animation, which is equivalent to:&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [frame]&lt;br /&gt;
        image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
    [/frame]&lt;br /&gt;
    {SOUND:HIT_AND_MISS axe.ogg {SOUND_LIST:MISS} -100}&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52177</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52177"/>
		<updated>2013-10-12T23:00:10Z</updated>

		<summary type="html">&lt;p&gt;Coffee: /* Example Syntax */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine.&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        '''start_time'''=-200&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause before attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-prepare-bow.png:25&lt;br /&gt;
        [/frame]&lt;br /&gt;
        #now the time is synchronized with the missile frame for the arrow&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-fire-bow[1~3].png:50&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause after attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        '''sound_start_time'''=-150&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
for convenience, the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 image=image[1~2]-ex[4~5].png:[100,200]  is equivalent to  image=image1-ex4.png:100,image2-ex5:200.png&lt;br /&gt;
 image=image[1~4].png:[10,20*3]          is equivalent to  image1.png:10,image2.png:20,image3.png:20,image4.png:20&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 200ms in each hex. so you typically want to have an offset of ''0~1:200,0~1:200,0~1:200,0~1:200,0~1:200'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:200,0.6~0:200&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, but you can't nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
A macro exists under macros/sound-util.cfg called SOUND:HIT_AND_MISS to simplify this type of animation, which is equivalent to:&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [frame]&lt;br /&gt;
        image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
    [/frame]&lt;br /&gt;
    {SOUND:HIT_AND_MISS axe.ogg {SOUND_LIST:MISS} -100}&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52176</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=52176"/>
		<updated>2013-10-12T22:59:32Z</updated>

		<summary type="html">&lt;p&gt;Coffee: Update example to be more realistic&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine.&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        '''start_time'''=-200&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause before attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-prepare-bow.png:25&lt;br /&gt;
        [/frame]&lt;br /&gt;
        #now the time is synchronized with the missile frame for the arrow&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter-fire-bow[1~3].png:50&lt;br /&gt;
        [/frame]&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=units/bowshooter.png:25  #because defense animations could possibly&lt;br /&gt;
                                           #be longer and if so this image will display&lt;br /&gt;
                                           #Also gives a bit of a pause after attacking&lt;br /&gt;
        [/frame]&lt;br /&gt;
&lt;br /&gt;
        '''sound_start_time'''=-150&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [sound_frame]&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/sound_frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
for convenience, the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 image=image[1~2]-ex[4~5].png:[100,200]  is equivalent to  image=image1-ex4.png:100,image2-ex5:200.png&lt;br /&gt;
 image=image[1~4].png:[10,20*3]          is equivalent to  image1.png:10,image2.png:20,image3.png:20,image4.png:20&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 200ms in each hex. so you typically want to have an offset of ''0~1:200,0~1:200,0~1:200,0~1:200,0~1:200'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:200,0.6~0:200&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, but you can't nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
A macro exists under macros/sound-util.cfg called SOUND:HIT_AND_MISS to simplify this type of animation, which is equivalent to:&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [frame]&lt;br /&gt;
        image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
    [/frame]&lt;br /&gt;
    {SOUND:HIT_AND_MISS axe.ogg {SOUND_LIST:MISS} -100}&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=49574</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=49574"/>
		<updated>2013-04-01T03:05:17Z</updated>

		<summary type="html">&lt;p&gt;Coffee: remove dev 1.9, as now is standard&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''start_time'''=-350&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [frame]&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [frame]&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
for convenience, the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 image=image[1~2]-ex[4~5].png:[100,200]  is equivalent to  image=image1-ex4.png:100,image2-ex5:200.png&lt;br /&gt;
 image=image[1~4].png:[10,20*3]          is equivalent to  image1.png:10,image2.png:20,image3.png:20,image4.png:20&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 150ms in each hex. so you typically want to have an offset of ''0~1:150,0~1:150,0~1:150,0~1:150,0~1:150'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:150,0.6~0:150&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, but you can't nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
A macro exists under macros/sound-util.cfg called SOUND:HIT_AND_MISS to simplify this type of animation, which is equivalent to:&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [frame]&lt;br /&gt;
        image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
    [/frame]&lt;br /&gt;
    {SOUND:HIT_AND_MISS axe.ogg {SOUND_LIST:MISS} -100}&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=49573</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=49573"/>
		<updated>2013-04-01T03:03:35Z</updated>

		<summary type="html">&lt;p&gt;Coffee: updated for 1.11.2 syntax enhancements&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''start_time'''=-350&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [frame]&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [frame]&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string, dev feature 1.11.2 - progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
for convenience, the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 image=image[1~2]-ex[4~5].png:[100,200]  is equivalent to  image=image1-ex4.png:100,image2-ex5:200.png&lt;br /&gt;
 image=image[1~4].png:[10,20*3]          is equivalent to  image1.png:10,image2.png:20,image3.png:20,image4.png:20&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 150ms in each hex. so you typically want to have an offset of ''0~1:150,0~1:150,0~1:150,0~1:150,0~1:150'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:150,0.6~0:150&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, but you can't nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
A macro exists under macros/sound-util.cfg called SOUND:HIT_AND_MISS to simplify this type of animation, which is equivalent to:&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [frame]&lt;br /&gt;
        image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
    [/frame]&lt;br /&gt;
    {SOUND:HIT_AND_MISS axe.ogg {SOUND_LIST:MISS} -100}&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=49365</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=49365"/>
		<updated>2013-03-26T20:39:21Z</updated>

		<summary type="html">&lt;p&gt;Coffee: example usage of SOUND:HIT_AND_MISS macro&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''start_time'''=-350&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [frame]&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [frame]&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;dev feature 1.9,progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;dev feature 1.9,progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
for convenience, the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 image=image[1~2]-ex[4~5].png:[100,200]  is equivalent to  image=image1-ex4.png:100,image2-ex5:200.png&lt;br /&gt;
 image=image[1~4].png:[10,20*3]          is equivalent to  image1.png:10,image2.png:20,image3.png:20,image4.png:20&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 150ms in each hex. so you typically want to have an offset of ''0~1:150,0~1:150,0~1:150,0~1:150,0~1:150'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:150,0.6~0:150&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, but you can't nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
A macro exists under macros/sound-util.cfg called SOUND:HIT_AND_MISS to simplify this type of animation, which is equivalent to:&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [frame]&lt;br /&gt;
        image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
    [/frame]&lt;br /&gt;
    {SOUND:HIT_AND_MISS axe.ogg {SOUND_LIST:MISS} -100}&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=49358</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=49358"/>
		<updated>2013-03-26T20:28:42Z</updated>

		<summary type="html">&lt;p&gt;Coffee: sound duration not needed any more for sound only frames&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''start_time'''=-350&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [frame]&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [frame]&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;dev feature 1.9,progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;dev feature 1.9,progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
for convenience, the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 image=image[1~2]-ex[4~5].png:[100,200]  is equivalent to  image=image1-ex4.png:100,image2-ex5:200.png&lt;br /&gt;
 image=image[1~4].png:[10,20*3]          is equivalent to  image1.png:10,image2.png:20,image3.png:20,image4.png:20&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 150ms in each hex. so you typically want to have an offset of ''0~1:150,0~1:150,0~1:150,0~1:150,0~1:150'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:150,0.6~0:150&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, but you can't nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=48502</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=48502"/>
		<updated>2013-02-16T21:58:05Z</updated>

		<summary type="html">&lt;p&gt;Coffee: make use of new image syntax in example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''start_time'''=-350&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [frame]&lt;br /&gt;
                duration=350&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [frame]&lt;br /&gt;
                duration=350&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;dev feature 1.9,progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;dev feature 1.9,progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
for convenience, the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 image=image[1~2]-ex[4~5].png:[100,200]  is equivalent to  image=image1-ex4.png:100,image2-ex5:200.png&lt;br /&gt;
 image=image[1~4].png:[10,20*3]          is equivalent to  image1.png:10,image2.png:20,image3.png:20,image4.png:20&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 150ms in each hex. so you typically want to have an offset of ''0~1:150,0~1:150,0~1:150,0~1:150,0~1:150'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:150,0.6~0:150&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, but you can't nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=48501</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=48501"/>
		<updated>2013-02-16T21:55:04Z</updated>

		<summary type="html">&lt;p&gt;Coffee: update depreciated syntax (begin/end)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''start_time'''=-350&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [frame]&lt;br /&gt;
                duration=350&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [frame]&lt;br /&gt;
                duration=350&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;dev feature 1.9,progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;dev feature 1.9,progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
for convenience, the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 halo=halo[1~2]-ex[4~5].png:[100,200]  is equivalent to  halo=halo1-ex4.png:100,halo2-ex5:200.png&lt;br /&gt;
 halo=halo[1~4].png:[10,20*3]  is equivalent to halo1.png:10,halo2.png:20,halo3.png:20,halo4.png:20&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 150ms in each hex. so you typically want to have an offset of ''0~1:150,0~1:150,0~1:150,0~1:150,0~1:150'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:150,0.6~0:150&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, but you can't nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    start_time=-100&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png:200&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=48500</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=48500"/>
		<updated>2013-02-16T21:52:00Z</updated>

		<summary type="html">&lt;p&gt;Coffee: update image to list&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''start_time'''=-350&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [frame]&lt;br /&gt;
                duration=350&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [frame]&lt;br /&gt;
                duration=350&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;dev feature 1.9,progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;dev feature 1.9,progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
for convenience, the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 halo=halo[1~2]-ex[4~5].png:[100,200]  is equivalent to  halo=halo1-ex4.png:100,halo2-ex5:200.png&lt;br /&gt;
 halo=halo[1~4].png:[10,20*3]  is equivalent to halo1.png:10,halo2.png:20,halo3.png:20,halo4.png:20&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image, or sequence of images, to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image, or sequence of images, to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 150ms in each hex. so you typically want to have an offset of ''0~1:150,0~1:150,0~1:150,0~1:150,0~1:150'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:150,0.6~0:150&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, but you can't nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            begin=-100&lt;br /&gt;
            end=100&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            begin=-100&lt;br /&gt;
            end=100&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=48499</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=48499"/>
		<updated>2013-02-16T21:50:45Z</updated>

		<summary type="html">&lt;p&gt;Coffee: add image to example list&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''start_time'''=-350&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [frame]&lt;br /&gt;
                duration=350&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [frame]&lt;br /&gt;
                duration=350&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;dev feature 1.9,progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;dev feature 1.9,progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 image=image1.png:100,image2.png:100,image3.png:100&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 image=image[1~3]:100&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
for convenience, the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 halo=halo[1~2]-ex[4~5].png:[100,200]  is equivalent to  halo=halo1-ex4.png:100,halo2-ex5:200.png&lt;br /&gt;
 halo=halo[1~4].png:[10,20*3]  is equivalent to halo1.png:10,halo2.png:20,halo3.png:20,halo4.png:20&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 150ms in each hex. so you typically want to have an offset of ''0~1:150,0~1:150,0~1:150,0~1:150,0~1:150'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:150,0.6~0:150&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, but you can't nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            begin=-100&lt;br /&gt;
            end=100&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            begin=-100&lt;br /&gt;
            end=100&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=48498</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=48498"/>
		<updated>2013-02-16T21:48:49Z</updated>

		<summary type="html">&lt;p&gt;Coffee: image/image_mod to progressive_string&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''start_time'''=-350&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [frame]&lt;br /&gt;
                duration=350&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [frame]&lt;br /&gt;
                duration=350&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;dev feature 1.9,progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;dev feature 1.9,progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
for convenience, the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 halo=halo[1~2]-ex[4~5].png:[100,200]  is equivalent to  halo=halo1-ex4.png:100,halo2-ex5:200.png&lt;br /&gt;
 halo=halo[1~4].png:[10,20*3]  is equivalent to halo1.png:10,halo2.png:20,halo3.png:20,halo4.png:20&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 150ms in each hex. so you typically want to have an offset of ''0~1:150,0~1:150,0~1:150,0~1:150,0~1:150'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:150,0.6~0:150&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, but you can't nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            begin=-100&lt;br /&gt;
            end=100&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            begin=-100&lt;br /&gt;
            end=100&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=48488</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=48488"/>
		<updated>2013-02-11T06:46:11Z</updated>

		<summary type="html">&lt;p&gt;Coffee: asterisk syntax for square brackets&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''start_time'''=-350&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [frame]&lt;br /&gt;
                duration=350&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [frame]&lt;br /&gt;
                duration=350&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;dev feature 1.9,progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;dev feature 1.9,progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
for convenience, the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 halo=halo[1~2]-ex[4~5].png:[100,200]  is equivalent to  halo=halo1-ex4.png:100,halo2-ex5:200.png&lt;br /&gt;
 halo=halo[1~4].png:[10,20*3]  is equivalent to halo1.png:10,halo2.png:20,halo3.png:20,halo4.png:20&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 150ms in each hex. so you typically want to have an offset of ''0~1:150,0~1:150,0~1:150,0~1:150,0~1:150'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:150,0.6~0:150&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, but you can't nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            begin=-100&lt;br /&gt;
            end=100&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            begin=-100&lt;br /&gt;
            end=100&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=TerrainGraphicsWML&amp;diff=48476</id>
		<title>TerrainGraphicsWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=TerrainGraphicsWML&amp;diff=48476"/>
		<updated>2013-02-04T09:26:38Z</updated>

		<summary type="html">&lt;p&gt;Coffee: Square bracket expansion allowed in 'flag' parameters&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== The toplevel [terrain_graphics] tag ==&lt;br /&gt;
&lt;br /&gt;
For information about the multi-hex tiling system, see [[MultiHexTutorial]]&lt;br /&gt;
&lt;br /&gt;
In terrain graphics, in Wesnoth 1.8.x all images are assumed to be .png and relative to images/terrain/. For example, writing 'image=grassland' means that the image file is images/terrain/grassland.png.  In Wesnoth 1.9.x the .png extension is required.  This means that TerrainGraphicsWML is incompatible from 1.8.x to 1.9.x.&lt;br /&gt;
&lt;br /&gt;
The multi-hex tiling system adds a new top-level element to WML, [terrain_graphics].&lt;br /&gt;
A building rule is used to specify images to place when terrains are in a certain formation.&lt;br /&gt;
When a building rule is applied to a map, it is applied once to each coordinate on the map;&lt;br /&gt;
when it is applied to a coordinate then that coordinate is considered the ''base''.&lt;br /&gt;
All locations in '''[terrain_graphics]''' are relative to the base.&lt;br /&gt;
&lt;br /&gt;
The following keys/tags are recognized:&lt;br /&gt;
* '''[tile]''': whenever a building rule is applied, each [tile] tag corresponds to a tile on the map. The corresponding tile must match each condition contained in [tile] for the [tile] tag to match. All [tile] tags must match in order for a rule to match. If the rule for a [tile] tag is applied, each action within [tile] will be executed on the tile corresponding to that [tile] tag&lt;br /&gt;
** '''x''','''y''': standard coordinates - the location of the corresponding tile relative to the base.&lt;br /&gt;
** '''pos''': a shortcut to specifying coordinates. Used in combination with ''map''&lt;br /&gt;
** '''type''': a comma-separated list of terrain codes (See [[TerrainWML]], data/terrain.cfg). In order for a tile to match this condition, it must be one of the terrains specified. However, if the string is preceded by &amp;quot;!&amp;quot;, the terrain must not be listed in order to match. If the string is '*', or if it is empty, any tile matches.&lt;br /&gt;
** '''name''': for animated terrain this takes the form of a comma separated list of images with durations specified after ':'. A square bracket expansion can also be used as in AnimationWML (see in example below).&lt;br /&gt;
** '''set_flag''': a comma-separated list of strings or square bracket expansion as in AnimationWML. Attaches flags from that list to the corresponding tile if the rule matches. The only difference a flag makes is being detected by ''has_flag'' and ''no_flag'' in [tile]. This is determined by the order of the [terrain_graphics] tags; a tag after another one cannot influence it. See also ''has_flag'', ''no_flag''&lt;br /&gt;
** '''has_flag''': a comma-separated list of strings or square bracket expansion as in AnimationWML. Matches if all flags in that list are attached to the corresponding tile. Flags are attached using the ''set_flag'' key.&lt;br /&gt;
** '''no_flag''': a comma-separated list of strings or square bracket expansion as in AnimationWML. Matches if none of the flags in that list are attached to the corresponding tile. Flags are attached using the ''set_flag'' key.&lt;br /&gt;
** '''set_no_flag''': helper combining ''set_flag'' and ''no_flag''. Same effect as using them with the same flags. Added because it's the most common use; ''set_flag'' or ''no_flag'' can still be used to add flags in one group only. &lt;br /&gt;
** '''[image]''': images specified as a subtag to '''[tile]''' sets the images for a single tile.&lt;br /&gt;
*** '''layer''': an integer, usually negative. The more negative it is, the earlier it is drawn, and thus the farther &amp;quot;back&amp;quot; it is when compositing the terrain images together.&lt;br /&gt;
*** '''name''': the image to apply on this tile if appropriate&lt;br /&gt;
*** '''random_start''' (default: yes): Tells engine to start animation at random point instead of at the beginning for every tile&lt;br /&gt;
*** '''base''': specifies the point at which the image is considered to be for layering purposes.  ''base'' is specified as '''x,y''' where x and y indicate distances in pixels from the top-left corner of the '''image'''. This is translated to a certain pixel on the map, and all images with the ''base'' attribute are drawn from top-to-bottom in terms of these specified pixel positions '''on the map'''.&lt;br /&gt;
*** '''[variant]''': an alternate image to use for differing times of day&lt;br /&gt;
**** '''tod''': the time of day for which this variant applies. Accepts a comma separated list of times of day.&lt;br /&gt;
**** '''name''': the image to apply on this tile if appropriate&lt;br /&gt;
**** '''random_start''' (default: yes): Tells engine to start animation at random point instead of at the beginning for every tile&lt;br /&gt;
* '''[image]''': image may also be used directly in the rule, to specify multihex images. The following additional attributes are recognized for multihex images (as well as all the ones for images within '''[tile]''').&lt;br /&gt;
** '''center''': specifies the point which the image will be centered on. If it is not specified, the image will instead be aligned with the top left corner of the tile.&lt;br /&gt;
* '''probability''': the percent probability for each position that if the position matches, then the rule will be applied. Default is 100(%).  See [[TerrainGraphicsTutorial#Cumulative_Probabilities|Cumulative_Probabilities]] for mathematical complications.&lt;br /&gt;
* '''rotations''': 6 comma(''',''') separated input strings. A rule that contains this key is not actually checked against the terrain; it instead is used as a template to create 6 new rules, each corresponding to a rotated version of the current rule. Whenever a rotated version is applied, instances of @(at-sign)R0, @R1, ... @R6 in attributes in the [terrain_graphics] tag will be adjusted by the corresponding amount and replaced with the letters specified by that numbered rotation in the ''rotations'' list. Each value corresponds to the rotated version that is -Pi/3 (60° clockwise) from the previous version; the first value corresponds to the unrotated version.&amp;lt;br&amp;gt;For example, if '''rotations=n,ne,se,s,sw,nw''' and it is being rotated 120°, then &amp;quot;@R0&amp;quot;-&amp;gt;&amp;quot;@R2&amp;quot;-&amp;gt;&amp;quot;se&amp;quot;, &amp;quot;@R1&amp;quot;-&amp;gt;&amp;quot;@R3&amp;quot;-&amp;gt;&amp;quot;s&amp;quot;, ... &amp;quot;@R6&amp;quot;-&amp;gt;&amp;quot;@R1&amp;quot;-&amp;gt;&amp;quot;ne&amp;quot;.&amp;lt;br&amp;gt;Basically the important thing is that this lets the rule be applied in any of the six hex-directions, allowing you to adjust the name of the image files automatically.&lt;br /&gt;
* '''set_flag''','''has_flag''', '''no_flag''': shortcuts to putting these in the [tile] subtags; unbound attributes will apply to all [tile] subtags.&lt;br /&gt;
* '''map''': a shortcut for defining [tile] tags with ''type'' conditions. Inputs a multi-line string value visually describing the map. The lines are cut into words of 4 characters, which correspond to [tile] tags. The line types alternate between lines corresponding to relatively even-abciss tiles and lines preceded by two spaces corresponding to relatively odd-abciss tiles. Every two lines represent 1 row on the map.&lt;br /&gt;
&lt;br /&gt;
=== Words ===&lt;br /&gt;
&lt;br /&gt;
A ''word'' is a 4-character shortcut to a [tile] tag. There are different types of words:&lt;br /&gt;
* Usually a word is interpreted as being the input to the ''type'' key of the corresponding [tile]. That is, it creates a [tile] with the attribute '''type=''word'''''.&lt;br /&gt;
* A word can also be a digit followed by 3 spaces. In this case, it is a shortcut to the [tile] with the attribute '''pos=''word'''''. This is called ''anchoring''.&lt;br /&gt;
&lt;br /&gt;
In 1.3, the format is basically the same but the following changes are made&lt;br /&gt;
* A ''word'' no longer needs to be 4 characters but is comma separated and spaces and tabs may be used for padding&lt;br /&gt;
* The 2 spaces for odd lines in no longer used, instead a leading comma is used on these lines (before the comma spaces and tabs are allowed for padding)&lt;br /&gt;
* A ''word'' may only be a dot a star or an anchor. The terrain letter format was not used and hard to support in the new engine, so that support is dropped.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
To define a north-south 2-tile mountain, the following syntax can be used:&lt;br /&gt;
&lt;br /&gt;
 [terrain_graphics]&lt;br /&gt;
     [tile]&lt;br /&gt;
         x=0&lt;br /&gt;
         y=0&lt;br /&gt;
         type=Mm&lt;br /&gt;
         set_no_flag=&amp;quot;base&amp;quot;&lt;br /&gt;
     [/tile]&lt;br /&gt;
     [tile]&lt;br /&gt;
         x=0&lt;br /&gt;
         y=1&lt;br /&gt;
         type=Mm&lt;br /&gt;
         set_no_flag=&amp;quot;base&amp;quot;&lt;br /&gt;
     [/tile]&lt;br /&gt;
     [image]&lt;br /&gt;
          name=&amp;quot;mountain-n-s.png&amp;quot;&lt;br /&gt;
     [/image]&lt;br /&gt;
 [/terrain_graphics]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This represents a tile 1, and its six adjacent tiles 2, in the map notation.&lt;br /&gt;
&lt;br /&gt;
 .,   .,   .,   .&lt;br /&gt;
 ,  .,   2,   .,   .&lt;br /&gt;
 .,   2,   2,   .&lt;br /&gt;
 ,  .,   1,   .,   .&lt;br /&gt;
 .,   2,   2,   .&lt;br /&gt;
 ,  .,   2,   .,   .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To define an animated campfire at coordinates (4,5) with files &amp;quot;misc/fire-A01.png&amp;quot; to &amp;quot;misc/fire-A08.png&amp;quot; with an inter-frame transition time of 140, the following can be placed at the scenario top level (adapted from the CAMPFIRE macro):&lt;br /&gt;
&lt;br /&gt;
 [terrain_graphics]&lt;br /&gt;
     x,y=4,5&lt;br /&gt;
     [tile]&lt;br /&gt;
         x=0&lt;br /&gt;
         y=0&lt;br /&gt;
         [image]&lt;br /&gt;
             layer=0&lt;br /&gt;
             name=&amp;quot;misc/fire-A[01~08].png:140&amp;quot;&lt;br /&gt;
         [/image]&lt;br /&gt;
     [/tile]&lt;br /&gt;
 [/terrain_graphics]&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[MultiHexTutorial]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
* Ayin's [http://www.anathas.org/ayin/wesnoth/doc/terrain_graphics_wml detailed Terrain Graphics document]&lt;br /&gt;
* [[TerrainGraphicsTutorial]] - First half of Ayin's document, wikified&lt;br /&gt;
* [[TerrainGraphicsReference]] - Second (partial) half of Ayin's document, wikified&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=InterfaceActionsWML&amp;diff=48449</id>
		<title>InterfaceActionsWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=InterfaceActionsWML&amp;diff=48449"/>
		<updated>2013-02-02T07:50:21Z</updated>

		<summary type="html">&lt;p&gt;Coffee: /* [item] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
== Interface actions ==&lt;br /&gt;
&lt;br /&gt;
Part of [[ActionWML]], interface actions are actions that do not have a direct effect on gameplay;&lt;br /&gt;
instead, they show something to the player.  The main interface tags&lt;br /&gt;
are '''[message]''' and '''[objectives]''', but several other tags affect&lt;br /&gt;
the interface also.&lt;br /&gt;
&lt;br /&gt;
== [inspect] ==&lt;br /&gt;
This user interface action only works in debug mode. It displays the gamestate inspector dialog (the same one which can be brought up with '':inspect'' ), which can be used to inspect the values of WML variables, AI configuration, recall lists, and more.&lt;br /&gt;
&lt;br /&gt;
* '''name''': optional attribute to specify the name of this gamestate inspector dialog. It is just a label to help differentiate between different invocations of gamestate inspector dialog.&lt;br /&gt;
&lt;br /&gt;
== [message] ==&lt;br /&gt;
The most commonly used interface action is [message], which displays a message to the user in a dialog box. It can also be used to take input from the user.&lt;br /&gt;
&lt;br /&gt;
The following key/tags are accepted for [message]:&lt;br /&gt;
* [[StandardUnitFilter]]: The unit whose profile and name are displayed. Do not use a [filter] tag. If no unit matching this filter is found, the message is not displayed (The unit has probably been killed).&amp;lt;br&amp;gt;'''[message]''' elements should be constructed so that it is either guaranteed that a certain unit is alive, or so that dialog flows smoothly even if the message isn't displayed.&lt;br /&gt;
&lt;br /&gt;
* '''speaker''': an alternative to standard unit filter. You may specify as the value of the speaker attribute a unit id or any of the following special values:&lt;br /&gt;
** '''narrator''': the dialog box is displayed without a caption for the unit speaking or a unit image&lt;br /&gt;
** '''unit''': the primary unit for the event is speaking&lt;br /&gt;
** '''second_unit''': the secondary unit for the event is speaking&lt;br /&gt;
&lt;br /&gt;
* '''message''': (translatable) the text to display to the right of the image. ''message'' is sometimes multiple lines; if it is, be sure to use quotes(''' ' ''' or ''' &amp;quot; ''')&lt;br /&gt;
* '''[show_if]''': if present then this message will only be displayed if the conditional statement in this tag is passed (see [[ConditionalActionsWML#Condition_Tags|ConditionalActionsWML]])&lt;br /&gt;
* '''side_for''': (default: all sides) comma-separated list of sides for who message is shown.&lt;br /&gt;
* '''image''': (default: profile image of speaker) the image to display next to the message. Append ~RIGHT() if you want the image to appear on the right side.&lt;br /&gt;
* '''caption''': (default: name of speaker) the caption to display beside the image. Name to be displayed. Note: use a translation mark to avoid wmllint errors.&lt;br /&gt;
* '''scroll''': Boolean specifying whether the game view should scroll to the speaking unit. Defaults to ''yes''.&lt;br /&gt;
* '''duration''': (default: 10) the minimum number of frames for this message to be displayed. (A frame lasts about 30 milliseconds.) During this time any dialog decisions will be disregarded.&lt;br /&gt;
* '''sound''': a sound effect (wav file) to play as the message is displayed. This can be a comma-separated list, from which one will be randomly chosen.&lt;br /&gt;
* '''[option]''': No '''[option]''' elements have to be used. If '''[option]''' elements are present, then each option will be displayed in a menu for the user to select one option.&lt;br /&gt;
** '''message''': (translatable) the text displayed for the option (see [[DescriptionWML]])&lt;br /&gt;
** '''[show_if]''': if present then this option will only be displayed if the conditional statement in this tag is passed (see [[ConditionalActionsWML#Condition_Tags|ConditionalActionsWML]])&lt;br /&gt;
** '''[command]''': an element containing actions which are executed if the option is selected.&lt;br /&gt;
* '''[text_input]''': there can be only one [text_input] tag. this adds a text input field to the message.&lt;br /&gt;
** '''variable''': the variable that the user's input will be written to&lt;br /&gt;
** '''label''': a text label to the left of the input field&lt;br /&gt;
** '''max_length''': the maximum number of characters that may be typed into the field&lt;br /&gt;
** '''text''': text that is written into the field in the beginning&lt;br /&gt;
* Check [[EventWML#Multiplayer_safety]] to find out in which events you can safely use '''[option]''' and '''[text_input]''' without causing OOS.&lt;br /&gt;
&lt;br /&gt;
=== Formatting ===&lt;br /&gt;
In 1.8, [http://developer.gnome.org/pango/unstable/PangoMarkupFormat.html Pango markup formatting codes] have been adopted for '''[message]'''. These can also be used in unit names (user_description), objectives, and such. Note that you'll probably want to use a single quote ' instead of a double quote &amp;quot; as double quotes cannot be escaped, otherwise the string will appear fragmented and you may also encounter errors. Running wmllint on your campaign will up-convert it, warning you about unusual cases you must fix by hand.&lt;br /&gt;
&lt;br /&gt;
For example, if you wanted to write &amp;quot;You are victorious!&amp;quot; in large, italic, gold letters, you might write it this way:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;span color='#BCB088' size='large' font-style='italic'&amp;gt;You are victorious!&amp;lt;/span&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
These are the codes taken from the Pango markup formatting guide:&lt;br /&gt;
&lt;br /&gt;
*'''font''', '''font_desc''': A font description string, such as &amp;quot;Sans Italic 12&amp;quot;.&lt;br /&gt;
*'''font_family''', '''face''': A font family name.&lt;br /&gt;
*'''font_size''', '''size''': Font size in 1024ths of a point, or one of the absolute sizes 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', or one of the relative sizes 'smaller' or 'larger'.&lt;br /&gt;
*'''font_style''', '''style''': One of 'normal', 'oblique', 'italic'.&lt;br /&gt;
*'''font_weight''', '''weight''': One of 'ultralight', 'light', 'normal', 'bold', 'ultrabold', 'heavy', or a numeric weight.&lt;br /&gt;
*'''font_variant''', '''variant''': One of 'normal' or 'smallcaps'.&lt;br /&gt;
*'''font_stretch''', '''stretch''': One of 'ultracondensed', 'extracondensed', 'condensed', 'semicondensed', 'normal', 'semiexpanded', 'expanded', 'extraexpanded', 'ultraexpanded'.&lt;br /&gt;
*'''foreground''', '''fgcolor''', '''color''': An RGB color specification such as '#00FF00' or a color name such as 'red'.&lt;br /&gt;
*'''background, bgcolor''': An RGB color specification such as '#00FF00' or a color name such as 'red'.&lt;br /&gt;
*'''underline''': One of 'none', 'single', 'double', 'low', 'error'.&lt;br /&gt;
*'''underline_color''': The color of underlines; an RGB color specification such as '#00FF00' or a color name such as 'red'.&lt;br /&gt;
*'''rise''': Vertical displacement, in 10000ths of an em. Can be negative for subscript, positive for superscript.&lt;br /&gt;
*'''strikethrough''': 'true' or 'false' whether to strike through the text.&lt;br /&gt;
*'''strikethrough_color''': The color of strikethrough lines; an RGB color specification such as '#00FF00' or a color name such as 'red'&lt;br /&gt;
*'''fallback''': 'true' or 'false' whether to enable fallback. If disabled, then characters will only be used from the closest matching font on the system. No fallback will be done to other fonts on the system that might contain the characters in the text. Fallback is enabled by default. Most applications should not disable fallback.&lt;br /&gt;
*'''letter_spacing''': Inter-letter spacing in 1024ths of a point.&lt;br /&gt;
*'''gravity''': One of 'south', 'east', 'north', 'west', 'auto'.&lt;br /&gt;
*'''gravity_hint''': One of 'natural', 'strong', 'line'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In 1.6, Wesnoth uses older text formatting options&lt;br /&gt;
* A tilde (~) as the first character causes the line to be boldfaced.&lt;br /&gt;
* An at symbol (@) as the first character causes the line to be green, as done with victory conditions.&lt;br /&gt;
* A pound symbol (#) as the first character causes the line to be red, as done with defeat conditions.&lt;br /&gt;
* An asterisk (*) as the first character causes the line to be bigger.&lt;br /&gt;
* A backquote (`) as the first character causes the line to be smaller.&lt;br /&gt;
* If used, the caption key text is boldfaced.&lt;br /&gt;
* An RGB colour code in the beginning causes the line to be the given colour. This can still be preceded by the above characters. Example: ''message=_&amp;quot;&amp;lt;255,0,0&amp;gt;Red!&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
== [objectives] ==&lt;br /&gt;
The other tag used for plot development is '''[objectives]'''.&lt;br /&gt;
The '''[objectives]''' tag overwrites any previously set objectives,&lt;br /&gt;
and displays text which should describe the objectives of the scenario.&lt;br /&gt;
Scenario objectives are displayed on the player's first turn after the tag is used,&lt;br /&gt;
or as part of the event if it triggers during that player's turn.&lt;br /&gt;
Objectives can also be accessed at any time in a scenario using the&lt;br /&gt;
&amp;quot;Scenario Objectives&amp;quot; game menu option, making this tag useful for&lt;br /&gt;
scenario-specific information that the player may need to refer to during play.&lt;br /&gt;
&lt;br /&gt;
Attributes of '''[objectives]''':&lt;br /&gt;
* '''side''': Default '0'. The side to set the objectives for. A value of 0 sets objectives for all sides. note: There are side-specific objectives and default objectives, which are used in case a side doesn't have specific ones. Specifying 0 sets the default ones.&lt;br /&gt;
* '''[[StandardSideFilter]]''' {{DevFeature1.11}} tags and keys: Sets the objectives of all matching sides to these passed specifications (the rest of this [objectives] tag). If no sides (such as when passing side=0) or all sides match, sets the default objectives, and the side specific ones for the matching sides otherwise.&lt;br /&gt;
* '''bullet''': Default '• '. Replaces the default bullet, with whatever is passed, for all objectives, gold carryover notes, and notes defined with [note].&lt;br /&gt;
* '''summary''': Displayed first in the objectives text, this should describe the basic objective for the overall scenario.  Can be omitted.&lt;br /&gt;
* '''note''': Displayed last in the objectives text, this is sometimes used for hints or additional information.  Can be omitted.&lt;br /&gt;
* '''victory_string''': Default ' _ &amp;quot;Victory:&amp;quot;', this text precedes the victory objectives.&lt;br /&gt;
* '''defeat_string''': Default ' _ &amp;quot;Defeat:&amp;quot;', this text precedes the defeat objectives.&lt;br /&gt;
* '''gold_carryover_string''': Default ' _ &amp;quot;Gold carryover:&amp;quot;', this text precedes the gold carryover information.&lt;br /&gt;
* '''notes_string''': Default ' _ &amp;quot;Notes:&amp;quot;', this text precedes the notes.&lt;br /&gt;
* '''silent''': Default: not present. If set to &amp;quot;yes&amp;quot;, the objectives are silently changed. Else, they will be shown to the user when appropriate.&lt;br /&gt;
&lt;br /&gt;
Tags of '''[objectives]''':&lt;br /&gt;
* '''[objective]''': describes a win or loss condition. Most scenarios have multiple win or loss conditions, so use a separate [objective] subtag for each line; this helps with translations.&lt;br /&gt;
** '''bullet''': Default '• ' or whatever is set in the parent [objectives] block. Replaces the default bullet, with whatever is provided, for the objective defined by the [objective] block.&lt;br /&gt;
** '''red''': Default '0' for winning objectives, '255' for losing objectives. Overrides the default red coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''green''': Default '255' for winning objectives, '0' for losing objectives. Overrides the default green coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''blue''': Default '0'. Overrides the default blue coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''description''': text for the specific win or loss condition.&lt;br /&gt;
** '''condition''': The color and placement of the text. Values are 'win'(colored green, placed after ''victory_string'') and 'lose'(colored red, placed after ''defeat_string'')&lt;br /&gt;
** '''show_turn_counter''': If set to yes, displays the number of turns remaining in the scenario. Default is no.&lt;br /&gt;
** '''[show_if]''': A condition that disables the objective if it doesn't hold. Conditional objectives are refreshed at '''[show_objectives]''' time only.&lt;br /&gt;
* '''[gold_carryover]''': describes how the gold carryover works in this scenario. This is intended to be a more convenient way of displaying carryover information than using the note= key in [objectives].&lt;br /&gt;
** '''bullet''': Default '• ' or whatever is set in the parent [objectives] block. Replaces the default bullet with whatever is provided.&lt;br /&gt;
** '''red''': Default '255'. Overrides the default red coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''green''': Default '255'. Overrides the default green coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''blue''': Default '192'. Overrides the default blue coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''bonus''' (boolean): whether an early finish bonus is granted. If omitted, early finish bonus is not mentioned.&lt;br /&gt;
** '''carryover_percentage''': the amount of carryover gold. If omitted, the amount is not mentioned.&lt;br /&gt;
* '''[note]''': describes a note, usually used for hints or additional information. This is an easier way of adding several notes than concatenating them together into a single string to use with the ''note='' key.&lt;br /&gt;
** '''bullet''': Default '• ' or whatever is set in the parent [objectives] block. Replaces the default bullet with whatever is provided for the note defined by the [note] block.&lt;br /&gt;
** '''red''': Default '255'. Overrides the default red coloring of the entire note, including the bullet.&lt;br /&gt;
** '''green''': Default '255'. Overrides the default green coloring of the entire note, including the bullet.&lt;br /&gt;
** '''blue''': Default '255'. Overrides the default blue coloring of the entire note, including the bullet.&lt;br /&gt;
** '''description''': the text of the note.&lt;br /&gt;
** {{DevFeature1.11}} '''[show_if]''': The note will not be shown if the specified condition isn't met. Conditional notes are refreshed at '''[show_objectives]''' time only.&lt;br /&gt;
&lt;br /&gt;
== [set_menu_item] ==&lt;br /&gt;
This tag is used to add a custom option in the right-click context menu which can then be used to trigger arbitrary WML commands.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Due to limitations in portable devices where there are no scroll bars for context menus, there is a hard-coded limit of 7 custom WML menu items. If you really need to have more than 7 menu items, try combining some of them in a submenu.&lt;br /&gt;
&lt;br /&gt;
* '''id''': the unique id for this menu item. If a menu item with this id already exists, it allows you to set specific changes to that item.&lt;br /&gt;
* '''description''': the in-game text that will appear for this item in the menu.&lt;br /&gt;
* '''image''': the image to display next to this item.&lt;br /&gt;
* '''needs_select''': if ''yes'' (default ''no''), then the latest select event (see [[EventWML]]) that triggered before this menu item was chosen will be transmitted over the network before this menu item action will be. This only has any effect in networked multiplayer, and is intended to allow more elaborate menu item behaviour there without causing out of sync errors. If you don't know what this means, just leave it false.&lt;br /&gt;
* '''[show_if]''': If present, the menu item will only be available if the conditional statement (see [[ConditionalActionsWML#Condition_Tags|ConditionalActionsWML]]) within evaluates to true. When this is evaluated, the WML variables ''$x1'' and ''$y1'' will point to the location on which the context menu was invoked, so it's possible to for example only enable the option on empty hexes or on a particular unit.&lt;br /&gt;
* '''[filter_location]''': contains a location filter similar to the one found inside Single Unit Filters (see [[FilterWML]]). The menu item will only be available on matching locations.&lt;br /&gt;
* '''[command]''': contains the WML actions to be executed when the menu item is selected. Again, the WML variables ''$x1'' and ''$y1'' will point to the location on which the context menu was invoked on.&lt;br /&gt;
** '''delayed_variable_substitution ''' {{DevFeature1.11}} (boolean yes|no, default: yes): If no, forces a variable substitution run onto the wml included in this [command] block. Use this, if you want variables which are to substitute to get the values they have at execution time of the event where this set_menu_item appears. Other than that, they get the values they have at invocation time of the menu item.&lt;br /&gt;
&lt;br /&gt;
== [clear_menu_item] ==&lt;br /&gt;
{{DevFeature1.11}}&lt;br /&gt;
&lt;br /&gt;
Removes a menu item from the scenario.&lt;br /&gt;
Normally menu items are, including all their defining wml, automatically carried over between scenarios. This tag prevents this. (The behavior is comparable to set_variable/clear_variable).&lt;br /&gt;
* '''id''': (string): id of the menu item to clear. Can be a comma-separated list.&lt;br /&gt;
&lt;br /&gt;
== Other interface tags ==&lt;br /&gt;
&lt;br /&gt;
The following tags are also action tags:&lt;br /&gt;
=== [item] ===&lt;br /&gt;
Makes a graphical item appear on a certain hex. Note this only places the graphics for an item. It does not make the item do anything. Use a moveto event to make moving onto the item do something. &amp;lt;tt&amp;gt;''('''Hint:''' There are a number of predefined items that are used in various campaigns that you can make use of. You can find [http://www.wesnoth.org/macro-reference.xhtml#file:items.cfg a list of them] if you look into the items.cfg file in the wesnoth install directory (under /data/core/macros).)''&amp;lt;/tt&amp;gt;&lt;br /&gt;
* '''x''', '''y''': the location to place the item. (only for [event][item]: full [[StandardLocationFilter|SLF]] support)&lt;br /&gt;
* '''image''': the image (in ''images/'' as .png) to place on the hex. This image is aligned with the top-left of the hex (which is 72 pixels wide and 72 pixels tall). It is drawn underneath units. ''('''Hint:''' If using an image smaller than 72x72, then it might be useful to [[ImagePathFunctionWML#Blit_Function|BLIT]] the image onto &amp;lt;tt&amp;gt;misc/blank-hex.png&amp;lt;/tt&amp;gt; (a blank 72x72 image).)''&lt;br /&gt;
* '''halo''': an image to place centered on the hex. It is drawn on top of units. Use this instead of ''image'' if the image is bigger than the hex or if you want to animate an image.&lt;br /&gt;
''Example (where the integer after the colon is the duration of each frame or square bracket expansion as per AnimationWML is used): halo=scenery/fire1.png:100,scenery/fire2.png:100,scenery/fire3.png:100,scenery/fire4.png:100,scenery/fire5.png:100,scenery/fire6.png:100,scenery/fire7.png:100,scenery/fire8.png:100''&lt;br /&gt;
or equivalently (requires Wesnoth 1.11.2+):&lt;br /&gt;
''halo=scenery/fire[1~8].png:100''&lt;br /&gt;
* '''team_name''': name of the team for which the item is to be displayed (hidden for others). For multiple teams just put all the names in one string, for example separated by commas.&lt;br /&gt;
* '''visible_in_fog''': whether the item should be visible through fog or not. Default yes.&lt;br /&gt;
* '''redraw''': {{DevFeature1.11}}(boolean yes|no, default: yes): If no, disables implicit calls to [[InterfaceActionsWML#.5Bredraw.5D|[redraw]]] when placing the items.&lt;br /&gt;
&lt;br /&gt;
=== [remove_item] ===&lt;br /&gt;
Removes any graphical items on a given hex.&lt;br /&gt;
* [[StandardLocationFilter]]: the hexes to remove items off&lt;br /&gt;
* '''image''' if specified, only removes the given image item (This image name must include any [[ImagePathFunctionWML|image path functions]] appended to the original image name.)&lt;br /&gt;
&lt;br /&gt;
=== [print] ===&lt;br /&gt;
Displays a message across the screen. The message will disappear after a certain time.&lt;br /&gt;
* '''text''': (translatable) the text to display.&lt;br /&gt;
* '''size''': (default=12) the pointsize of the font to use&lt;br /&gt;
* '''duration''': (default=50) the length of time to display the text for. This is measured in the number of 'frames'. A frame in Wesnoth is usually displayed for around 30ms.&lt;br /&gt;
* '''red''', '''green''', '''blue''': (default=0,0,0) the color to display the text in. Values vary from 0-255.&lt;br /&gt;
=== [move_unit_fake] ===&lt;br /&gt;
Moves an image of a unit along a certain path on the map. The path does not need to be a continuous list of adjacent hexes, so for example only the start and end points can be given, in which case the straightest line between those points will be calculated and used.&lt;br /&gt;
* '''type''': the type of the unit whose image to use&lt;br /&gt;
* '''x''': a comma-separated list of x locations to move along&lt;br /&gt;
* '''y''': a comma-separated list of y locations to move along (x and y values are matched pairs)&lt;br /&gt;
* '''side''': the side of the fake unit, used for team-coloring the fake unit&lt;br /&gt;
* '''gender''': the gender of the fake unit. Example: gender=female&lt;br /&gt;
* '''variation''': the variation of the fake unit. Example: variation=undead&lt;br /&gt;
* '''image_mods''': [[ImagePathFunctionWML|image path functions]] sequence to be applied on the fake unit.&lt;br /&gt;
=== [move_units_fake] ===&lt;br /&gt;
moves multiple images of units along paths on the map. These units are moved in lockstep.&lt;br /&gt;
* '''[fake_unit]''': A fake unit to move&lt;br /&gt;
** '''type''': the type of unit whose image to use&lt;br /&gt;
** '''x''': a comma-separated list of x locations to move along&lt;br /&gt;
** '''y''': a comma-separated list of y locations to move along (x and y values are matched pairs)&lt;br /&gt;
** '''side''': the side of the fake unit, used for team-coloring the fake unit&lt;br /&gt;
** '''skip_steps''': the number of steps to skip before this unit starts moving&lt;br /&gt;
=== [hide_unit] ===&lt;br /&gt;
Temporarily prevents the engine from displaying the given unit. The unit does not become invisible, as it would be with the '''[hides]''' ability; it is still the same plain unit, but without an image. Useful in conjunction with '''[move_unit_fake]''': to move a leader unit into position on-screen. Until 1.8 each '''[hide_unit]''' tag only hides one unit.&lt;br /&gt;
* [[StandardUnitFilter]]: All matching units will be hidden&lt;br /&gt;
&lt;br /&gt;
=== [unhide_unit] ===&lt;br /&gt;
Stops the currently hidden units from being hidden.&lt;br /&gt;
* [[StandardUnitFilter]]: Only the matching units will be unhidden&lt;br /&gt;
&lt;br /&gt;
=== [lock_view] ===&lt;br /&gt;
{{DevFeature1.11}} Locks gamemap view scrolling for human players, so they cannot scroll the gamemap view until it is unlocked. WML or Lua actions such as '''[scroll_to]''' will continue to work normally, as they ignore this restriction; the locked/unlocked state is preserved when saving the current game.&lt;br /&gt;
&lt;br /&gt;
This feature is generally intended to be used in cutscenes to prevent the player scrolling away from scripted actions. &lt;br /&gt;
&lt;br /&gt;
=== [unlock_view] ===&lt;br /&gt;
{{DevFeature1.11}} Unlocks gamemap view scrolling for human players.&lt;br /&gt;
&lt;br /&gt;
=== [scroll] ===&lt;br /&gt;
Scroll a certain number of pixels in a given direction. Useful for earthquake/shaking effects.&lt;br /&gt;
* '''x''', '''y''': the number of pixels to scroll along the x and y axis&lt;br /&gt;
=== '''[scroll_to]''' ===&lt;br /&gt;
Scroll to a given hex&lt;br /&gt;
* '''x''', '''y''': the hex to scroll to&lt;br /&gt;
* {{DevFeature1.11}} [[StandardLocationFilter]], do not use a [filter_location] sub-tag. If more than one location matches the filter, only the first matching location will be used.&lt;br /&gt;
* '''check_fogged''': whether to scroll even to locations covered in fog or shroud. Possible values ''true'' (don't scroll to fog) and ''false'' (scroll even to fog), with ''false'' as the default.&lt;br /&gt;
* {{DevFeature1.11}} '''immediate''': whether to instantly warp to the target hex regardless of the scroll speed setting in Preferences (defaults to ''false'').&lt;br /&gt;
&lt;br /&gt;
=== [scroll_to_unit] ===&lt;br /&gt;
Scroll to a given unit&lt;br /&gt;
* [[StandardUnitFilter]]&lt;br /&gt;
* '''check_fogged''': whether to scroll even to locations covered in fog or shroud. Possible values ''true'' (don't scroll to fog) and ''false'' (scroll even to fog), with ''false'' as the default.&lt;br /&gt;
* {{DevFeature1.11}} '''immediate''': whether to instantly warp to the target hex regardless of the scroll speed setting in Preferences (defaults to ''false'').&lt;br /&gt;
=== [select_unit] ===&lt;br /&gt;
Selects a given unit.&lt;br /&gt;
* [[StandardUnitFilter]]: The first unit found will be selected.&lt;br /&gt;
* '''fire_event''': whether a ''select'' event should be triggered or not (def. ''no''). (Note that select events aren't multiplayer save.)&lt;br /&gt;
* '''highlight''': whether the unit's current hex should be highlighted (def. ''yes'').&lt;br /&gt;
&lt;br /&gt;
=== [sound]===&lt;br /&gt;
Plays a sound&lt;br /&gt;
* '''name''': the filename of the sound to play (in ''sounds/'' as .wav or .ogg)&lt;br /&gt;
* '''repeat''': repeats the sound for a specified additional number of times (default=0)&lt;br /&gt;
=== [sound_source] ===&lt;br /&gt;
Creates a sound source. &amp;quot;Sound sources&amp;quot; is a general name for a mechanism which makes possible for map elements to emit sounds according to some rules, where &amp;quot;map elements&amp;quot; can be specific locations or terrain types. For now, only sound sources tied to locations are supported.&lt;br /&gt;
* '''id''': a unique identification key of the sound source&lt;br /&gt;
* '''sounds''': a list of comma separated, randomly played sounds associated with the sound source&lt;br /&gt;
* '''delay''': a numerical value (in milliseconds) of the minimal delay between two playbacks of the source's sound if the source remains visible on the screen; if one scrolls out and back in, the source will be considered as ready to play&lt;br /&gt;
* '''chance''': a percentage (a value from 0 to 100) describing the chance of the source being activated every second after the delay has passed or when the source's location appears on the screen (note that it cannot play more than one file at the same time)&lt;br /&gt;
* '''check_fogged''': possible values &amp;quot;true&amp;quot; and &amp;quot;false&amp;quot; - if true the source will not play if its locations are fogged&lt;br /&gt;
* '''check_shrouded''': possible values &amp;quot;true&amp;quot; and &amp;quot;false&amp;quot; - if true the source will not play if its locations are shrouded&lt;br /&gt;
* '''x,y''': similar to x,y as found in a [[StandardLocationFilter]], these are the locations associated with the sound source&lt;br /&gt;
* '''fade_range''' (default = 3): distance in hexes that determines a &amp;quot;circular&amp;quot; area around the one specified by '''full_range''' where sound volume fades out linearly&lt;br /&gt;
* '''full_range''' (default = 14): distance in hexes that determines a &amp;quot;circular&amp;quot; area where source plays with full volume, relative to screen center&lt;br /&gt;
* '''loop''': number of times a sound sample should be looped if it stays visible. -1 means infinite (~65000)&lt;br /&gt;
&lt;br /&gt;
=== [remove_sound_source] ===&lt;br /&gt;
Removes a previously defined sound source.&lt;br /&gt;
* '''id''': the identification key of the sound source to remove&lt;br /&gt;
&lt;br /&gt;
=== [music]===&lt;br /&gt;
Switches to playing different music&lt;br /&gt;
* '''name''': the filename of the music to play (in ''music/'' as .ogg)&lt;br /&gt;
* see [[MusicListWML]] for the correct syntax&lt;br /&gt;
===[volume]===&lt;br /&gt;
Changes the game volume to a percent of the preferences volume for the game being played. Values can go from 0 to 100:  &lt;br /&gt;
* '''music''':  Changes the music volume.&lt;br /&gt;
* '''sound''':  Changes the sound volume.&lt;br /&gt;
=== [color_adjust]===&lt;br /&gt;
Tints the color of the screen.&lt;br /&gt;
* '''red''', '''green''', '''blue''': values from -255 to 255, the amount to tint by for each color&lt;br /&gt;
=== [delay] ===&lt;br /&gt;
Pauses the game.&lt;br /&gt;
* '''time''': the time to pause in milliseconds&lt;br /&gt;
=== [redraw] ===&lt;br /&gt;
Redraws the screen (this normally isn't done during events, although some of the other interface actions cause the screen or parts of it to be redrawn).&lt;br /&gt;
* '''clear_shroud''' (boolean yes|no, default no): If yes, clears fog and shroud around existing units. Useful if you, for example, spawn friendly units in the middle of an event and want the shroud to update accordingly (otherwise units that spawn inside fog would remain invisible for the duration of the event, since the fog would not automatically get cleared around them).&lt;br /&gt;
* '''[[StandardSideFilter]]''': the sides for which to recalculate fog and shroud.&lt;br /&gt;
* '''side''': If used (forces clear_shroud=yes), clears fog and shroud for that side.&lt;br /&gt;
&lt;br /&gt;
=== [unit_overlay] ===&lt;br /&gt;
Sets an image that will be drawn over a particular unit, and follow it around&lt;br /&gt;
* [[StandardUnitFilter]]: All matching units will get the overlay (do not use [filter])&lt;br /&gt;
* '''image''': the image to place on the unit&lt;br /&gt;
&lt;br /&gt;
=== [remove_unit_overlay] ===&lt;br /&gt;
removes a particular overlayed image from a unit&lt;br /&gt;
* [[StandardUnitFilter]]: The overlay will get removed from all matching units (do not use [filter])&lt;br /&gt;
* '''image''': the image to remove from the unit&lt;br /&gt;
&lt;br /&gt;
=== [animate_unit] ===&lt;br /&gt;
Uses an animation of a unit to animate it on screen (if the unit has the corresponding animation).&lt;br /&gt;
* '''flag''': The key to find the custom animation in the unit description (see the '''[extra_anim]''' description in [[AnimationWML]]). Standard animations can be triggered with the following keywords: ''leading recruited standing idling levelout levelin healing healed poisoned movement defend attack death victory pre_teleport post_teleport''&lt;br /&gt;
* '''[filter]''' with a [[StandardUnitFilter]] as argument, see [[FilterWML]]. By default, the unit at the event location will be animated. You can use this tag to choose any other unit to animate.&lt;br /&gt;
* '''[primary_attack]''': If this tag is not present, the filter for animation will be triggered with no attack. If it is here, all attacks from the unit will be filtered, and a matching one will be used to filter the animation. Takes a weapon filter as argument, see [[FilterWML]].&lt;br /&gt;
* '''[secondary_attack]''': Similar to '''[primary_attack]'''. May be needed to trigger a defense animation correctly, if there are more than one animations available for the defending unit.&lt;br /&gt;
* '''hits''': yes/no/hit/miss/kill: which according variation of a attack/defense animation shall be chosen (required)&lt;br /&gt;
* '''text''': a text to hover during the animation &lt;br /&gt;
* '''red''': red value for the text color (0-255)&lt;br /&gt;
* '''green''': green value for the text color&lt;br /&gt;
* '''blue''': blue value for the text color&lt;br /&gt;
* '''with_bars''': yes/no: whether to display the status bars during the animation (e.g. the hitpoint bar)&lt;br /&gt;
* '''[animate]''': a sub block with the same syntax as '''[animate_unit]''' except that the '''[filter]''' block is mandatory to find the unit. This block will find and animate another unit simultaneously.&lt;br /&gt;
* '''[facing]''': a [[StandardLocationFilter]] specifying what direction the unit should be facing when animated&lt;br /&gt;
&lt;br /&gt;
=== [label] ===&lt;br /&gt;
Places a label on the map.&lt;br /&gt;
* '''x''', '''y''': the location of the label&lt;br /&gt;
* '''text''': what the label should say&lt;br /&gt;
* '''team_name''': if specified, the label will only be visible to the given team.&lt;br /&gt;
* '''color''': color of the label. The format is r,g,b; r, g and b are numbers between 0 and 255.&lt;br /&gt;
* '''visible_in_fog''': whether the label should be visible through fog or not. Default yes.&lt;br /&gt;
* '''visible_in_shroud''': whether the label should be visible through shroud or not. Default no.&lt;br /&gt;
* '''immutable''': whether this label is protected from being removed or changed by players. Default yes.&lt;br /&gt;
=== [floating_text]===&lt;br /&gt;
Floats text (similar to the damage and healing numbers) on the given locations.&lt;br /&gt;
* [[StandardLocationFilter]]: the text will be floated on all matching locations simultaneously.&lt;br /&gt;
* '''text''': the text to display.&lt;br /&gt;
&lt;br /&gt;
The default text color is &amp;lt;span style=&amp;quot;color: #6b8cff;&amp;quot;&amp;gt;'''#6b8cff'''&amp;lt;/span&amp;gt;. To change the color, use [[#Formatting|Pango markup]]. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Float some golden yellow text at 20,20.&lt;br /&gt;
[floating_text]&lt;br /&gt;
   x,y=20,20&lt;br /&gt;
   text=&amp;quot;&amp;lt;span color='#cccc33'&amp;gt;&amp;quot; + _ &amp;quot;Your text here&amp;quot; + &amp;quot;&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
[/floating_text]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [deprecated_message] ===&lt;br /&gt;
Shows a deprecated message in the message area, this feature is only intended to be used to warn about deprecated macros in mainline. The message is not translatable.&lt;br /&gt;
* '''message''': the message to show.&lt;br /&gt;
=== [wml_message] ===&lt;br /&gt;
Outputs a message to Wesnoth's console output. Intended for campaign designers to output silent text to the console, without annoying the player; then, that text might contain information useful for later bug-reporting. The log domain for it is '''wml''', and the '''debug/dbg''' log level is available for use with the '''logger''' attribute. Depending on the current log level ('''error''' by default), which may be changed with the in-game :log command, or the --log-&amp;lt;level&amp;gt;=wml command line switch, the messages are echoed to the in-game chat.&lt;br /&gt;
* '''message''': the message to show.&lt;br /&gt;
* '''logger''': the Wesnoth engine output logger that should catch the text; this might be 'err' (the errors log level), 'warn'/'wrn' (the warnings log level) or anything else (the information log level). Not all information will be displayed depending on the log level chosen when starting Wesnoth.&lt;br /&gt;
&lt;br /&gt;
Note: As of 1.9.4/1.9.5 (r48805) the following &amp;quot;loggers&amp;quot; should work: If in [wml_message]: err/error, warn/wrn/warning, debug/dbg; using the :log command: Only the long forms error, warning, info and debug (this part gathered by trying rather than source inspecting). The long forms are most likely also the only ones working when starting wesnoth with --log-&amp;lt;level&amp;gt;=wml.&lt;br /&gt;
For log level warning or error (as during normal play), only wml_messages with logger error or warning display (for both). With logger info or debug, additionally wml_messages with logger info or debug display (for both).&lt;br /&gt;
&lt;br /&gt;
=== [open_help] ===&lt;br /&gt;
Opens the in-game help.&lt;br /&gt;
* '''topic''': the id of the topic to open&lt;br /&gt;
=== [show_objectives] ===&lt;br /&gt;
refreshes the objectives defined by [objectives] and its [show_if] tags, and displays them. (It is also called whenever the user explicitly asks for the objectives; this matters only if the tag was overridden by a [[LuaWML#register_wml_action|Lua]] script.)&lt;br /&gt;
* '''side''': the side to show the objectives. If not set, all sides are used.&lt;br /&gt;
* '''[[StandardSideFilter]]''' {{DevFeature1.11}} tags and keys: Tag affects the matching sides instead of just all or the one given by the integer value of the side= key.&lt;br /&gt;
&lt;br /&gt;
=== [chat] ===&lt;br /&gt;
Displays a message in the chat area.&lt;br /&gt;
* '''speaker''': (default=&amp;quot;WML&amp;quot;) A string for the name of the sender of the message.&lt;br /&gt;
* '''message''': The message that should be displayed.&lt;br /&gt;
* '''[[StandardSideFilter]]''' tags and keys as argument; if the same client controls multiple sides that match, then the message will only be displayed once.&lt;br /&gt;
&lt;br /&gt;
== Useful Macros ==&lt;br /&gt;
There are some predefined macros that you find useful for interface actions. You can find a complete list along with a detailed explanation of how they work [http://www.wesnoth.org/macro-reference.xhtml here].&lt;br /&gt;
* '''{HIGHLIGHT_UNIT}''' Highlight a unit on the map. Use this to show important units&lt;br /&gt;
* '''{HIGHLIGHT_IMAGE}''' Places and highlights an image on the map. Use this to show important items or locations&lt;br /&gt;
* '''{SET_IMAGE}''' Places an image on the map which has no other function.&lt;br /&gt;
* '''{QUAKE &amp;lt;soundfile&amp;gt;}''' Creates a tremor-like screenshake and plays &amp;lt;soundfile&amp;gt;. For example, '''{QUAKE (rumble.ogg)}'''.&lt;br /&gt;
* '''{FLASH_WHITE}''' Flash the screen white momentarily. You can also replace WHITE with RED, BLUE or GREEN for a different colour.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[DirectActionsWML]]&lt;br /&gt;
* [[InternalActionsWML]]&lt;br /&gt;
* [[EventWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;br /&gt;
[[Category: ActionsWML]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=TerrainGraphicsWML&amp;diff=48448</id>
		<title>TerrainGraphicsWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=TerrainGraphicsWML&amp;diff=48448"/>
		<updated>2013-02-02T07:49:15Z</updated>

		<summary type="html">&lt;p&gt;Coffee: /* Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== The toplevel [terrain_graphics] tag ==&lt;br /&gt;
&lt;br /&gt;
For information about the multi-hex tiling system, see [[MultiHexTutorial]]&lt;br /&gt;
&lt;br /&gt;
In terrain graphics, in Wesnoth 1.8.x all images are assumed to be .png and relative to images/terrain/. For example, writing 'image=grassland' means that the image file is images/terrain/grassland.png.  In Wesnoth 1.9.x the .png extension is required.  This means that TerrainGraphicsWML is incompatible from 1.8.x to 1.9.x.&lt;br /&gt;
&lt;br /&gt;
The multi-hex tiling system adds a new top-level element to WML, [terrain_graphics].&lt;br /&gt;
A building rule is used to specify images to place when terrains are in a certain formation.&lt;br /&gt;
When a building rule is applied to a map, it is applied once to each coordinate on the map;&lt;br /&gt;
when it is applied to a coordinate then that coordinate is considered the ''base''.&lt;br /&gt;
All locations in '''[terrain_graphics]''' are relative to the base.&lt;br /&gt;
&lt;br /&gt;
The following keys/tags are recognized:&lt;br /&gt;
* '''[tile]''': whenever a building rule is applied, each [tile] tag corresponds to a tile on the map. The corresponding tile must match each condition contained in [tile] for the [tile] tag to match. All [tile] tags must match in order for a rule to match. If the rule for a [tile] tag is applied, each action within [tile] will be executed on the tile corresponding to that [tile] tag&lt;br /&gt;
** '''x''','''y''': standard coordinates - the location of the corresponding tile relative to the base.&lt;br /&gt;
** '''pos''': a shortcut to specifying coordinates. Used in combination with ''map''&lt;br /&gt;
** '''type''': a comma-separated list of terrain codes (See [[TerrainWML]], data/terrain.cfg). In order for a tile to match this condition, it must be one of the terrains specified. However, if the string is preceded by &amp;quot;!&amp;quot;, the terrain must not be listed in order to match. If the string is '*', or if it is empty, any tile matches.&lt;br /&gt;
** '''name''': for animated terrain this takes the form of a comma separated list of images with durations specified after ':'. A square bracket expansion can also be used as in AnimationWML (see in example below).&lt;br /&gt;
** '''set_flag''': a comma-separated list of strings. Attaches flags from that list to the corresponding tile if the rule matches. The only difference a flag makes is being detected by ''has_flag'' and ''no_flag'' in [tile]. This is determined by the order of the [terrain_graphics] tags; a tag after another one cannot influence it. See also ''has_flag'', ''no_flag''&lt;br /&gt;
** '''has_flag''': a comma-separated list of strings. Matches if all flags in that list are attached to the corresponding tile. Flags are attached using the ''set_flag'' key.&lt;br /&gt;
** '''no_flag''': a comma-separated list of strings. Matches if none of the flags in that list are attached to the corresponding tile. Flags are attached using the ''set_flag'' key.&lt;br /&gt;
** '''set_no_flag''': helper combining ''set_flag'' and ''no_flag''. Same effect as using them with the same flags. Added because it's the most common use; ''set_flag'' or ''no_flag'' can still be used to add flags in one group only. &lt;br /&gt;
** '''[image]''': images specified as a subtag to '''[tile]''' sets the images for a single tile.&lt;br /&gt;
*** '''layer''': an integer, usually negative. The more negative it is, the earlier it is drawn, and thus the farther &amp;quot;back&amp;quot; it is when compositing the terrain images together.&lt;br /&gt;
*** '''name''': the image to apply on this tile if appropriate&lt;br /&gt;
*** '''random_start''' (default: yes): Tells engine to start animation at random point instead of at the beginning for every tile&lt;br /&gt;
*** '''base''': specifies the point at which the image is considered to be for layering purposes.  ''base'' is specified as '''x,y''' where x and y indicate distances in pixels from the top-left corner of the '''image'''. This is translated to a certain pixel on the map, and all images with the ''base'' attribute are drawn from top-to-bottom in terms of these specified pixel positions '''on the map'''.&lt;br /&gt;
*** '''[variant]''': an alternate image to use for differing times of day&lt;br /&gt;
**** '''tod''': the time of day for which this variant applies. Accepts a comma separated list of times of day.&lt;br /&gt;
**** '''name''': the image to apply on this tile if appropriate&lt;br /&gt;
**** '''random_start''' (default: yes): Tells engine to start animation at random point instead of at the beginning for every tile&lt;br /&gt;
* '''[image]''': image may also be used directly in the rule, to specify multihex images. The following additional attributes are recognized for multihex images (as well as all the ones for images within '''[tile]''').&lt;br /&gt;
** '''center''': specifies the point which the image will be centered on. If it is not specified, the image will instead be aligned with the top left corner of the tile.&lt;br /&gt;
* '''probability''': the percent probability for each position that if the position matches, then the rule will be applied. Default is 100(%).  See [[TerrainGraphicsTutorial#Cumulative_Probabilities|Cumulative_Probabilities]] for mathematical complications.&lt;br /&gt;
* '''rotations''': 6 comma(''',''') separated input strings. A rule that contains this key is not actually checked against the terrain; it instead is used as a template to create 6 new rules, each corresponding to a rotated version of the current rule. Whenever a rotated version is applied, instances of @(at-sign)R0, @R1, ... @R6 in attributes in the [terrain_graphics] tag will be adjusted by the corresponding amount and replaced with the letters specified by that numbered rotation in the ''rotations'' list. Each value corresponds to the rotated version that is -Pi/3 (60° clockwise) from the previous version; the first value corresponds to the unrotated version.&amp;lt;br&amp;gt;For example, if '''rotations=n,ne,se,s,sw,nw''' and it is being rotated 120°, then &amp;quot;@R0&amp;quot;-&amp;gt;&amp;quot;@R2&amp;quot;-&amp;gt;&amp;quot;se&amp;quot;, &amp;quot;@R1&amp;quot;-&amp;gt;&amp;quot;@R3&amp;quot;-&amp;gt;&amp;quot;s&amp;quot;, ... &amp;quot;@R6&amp;quot;-&amp;gt;&amp;quot;@R1&amp;quot;-&amp;gt;&amp;quot;ne&amp;quot;.&amp;lt;br&amp;gt;Basically the important thing is that this lets the rule be applied in any of the six hex-directions, allowing you to adjust the name of the image files automatically.&lt;br /&gt;
* '''set_flag''','''has_flag''', '''no_flag''': shortcuts to putting these in the [tile] subtags; unbound attributes will apply to all [tile] subtags.&lt;br /&gt;
* '''map''': a shortcut for defining [tile] tags with ''type'' conditions. Inputs a multi-line string value visually describing the map. The lines are cut into words of 4 characters, which correspond to [tile] tags. The line types alternate between lines corresponding to relatively even-abciss tiles and lines preceded by two spaces corresponding to relatively odd-abciss tiles. Every two lines represent 1 row on the map.&lt;br /&gt;
&lt;br /&gt;
=== Words ===&lt;br /&gt;
&lt;br /&gt;
A ''word'' is a 4-character shortcut to a [tile] tag. There are different types of words:&lt;br /&gt;
* Usually a word is interpreted as being the input to the ''type'' key of the corresponding [tile]. That is, it creates a [tile] with the attribute '''type=''word'''''.&lt;br /&gt;
* A word can also be a digit followed by 3 spaces. In this case, it is a shortcut to the [tile] with the attribute '''pos=''word'''''. This is called ''anchoring''.&lt;br /&gt;
&lt;br /&gt;
In 1.3, the format is basically the same but the following changes are made&lt;br /&gt;
* A ''word'' no longer needs to be 4 characters but is comma separated and spaces and tabs may be used for padding&lt;br /&gt;
* The 2 spaces for odd lines in no longer used, instead a leading comma is used on these lines (before the comma spaces and tabs are allowed for padding)&lt;br /&gt;
* A ''word'' may only be a dot a star or an anchor. The terrain letter format was not used and hard to support in the new engine, so that support is dropped.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
To define a north-south 2-tile mountain, the following syntax can be used:&lt;br /&gt;
&lt;br /&gt;
 [terrain_graphics]&lt;br /&gt;
     [tile]&lt;br /&gt;
         x=0&lt;br /&gt;
         y=0&lt;br /&gt;
         type=Mm&lt;br /&gt;
         set_no_flag=&amp;quot;base&amp;quot;&lt;br /&gt;
     [/tile]&lt;br /&gt;
     [tile]&lt;br /&gt;
         x=0&lt;br /&gt;
         y=1&lt;br /&gt;
         type=Mm&lt;br /&gt;
         set_no_flag=&amp;quot;base&amp;quot;&lt;br /&gt;
     [/tile]&lt;br /&gt;
     [image]&lt;br /&gt;
          name=&amp;quot;mountain-n-s.png&amp;quot;&lt;br /&gt;
     [/image]&lt;br /&gt;
 [/terrain_graphics]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This represents a tile 1, and its six adjacent tiles 2, in the map notation.&lt;br /&gt;
&lt;br /&gt;
 .,   .,   .,   .&lt;br /&gt;
 ,  .,   2,   .,   .&lt;br /&gt;
 .,   2,   2,   .&lt;br /&gt;
 ,  .,   1,   .,   .&lt;br /&gt;
 .,   2,   2,   .&lt;br /&gt;
 ,  .,   2,   .,   .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To define an animated campfire at coordinates (4,5) with files &amp;quot;misc/fire-A01.png&amp;quot; to &amp;quot;misc/fire-A08.png&amp;quot; with an inter-frame transition time of 140, the following can be placed at the scenario top level (adapted from the CAMPFIRE macro):&lt;br /&gt;
&lt;br /&gt;
 [terrain_graphics]&lt;br /&gt;
     x,y=4,5&lt;br /&gt;
     [tile]&lt;br /&gt;
         x=0&lt;br /&gt;
         y=0&lt;br /&gt;
         [image]&lt;br /&gt;
             layer=0&lt;br /&gt;
             name=&amp;quot;misc/fire-A[01~08].png:140&amp;quot;&lt;br /&gt;
         [/image]&lt;br /&gt;
     [/tile]&lt;br /&gt;
 [/terrain_graphics]&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[MultiHexTutorial]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
* Ayin's [http://www.anathas.org/ayin/wesnoth/doc/terrain_graphics_wml detailed Terrain Graphics document]&lt;br /&gt;
* [[TerrainGraphicsTutorial]] - First half of Ayin's document, wikified&lt;br /&gt;
* [[TerrainGraphicsReference]] - Second (partial) half of Ayin's document, wikified&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=48447</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=48447"/>
		<updated>2013-02-02T07:48:21Z</updated>

		<summary type="html">&lt;p&gt;Coffee: /* Progressive parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''start_time'''=-350&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [frame]&lt;br /&gt;
                duration=350&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [frame]&lt;br /&gt;
                duration=350&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;dev feature 1.9,progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;dev feature 1.9,progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or (from Wesnoth 1.11.2+) equivalently,&lt;br /&gt;
 halo=halo[1~3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07~10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 halo=halo[5~3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 halo=halo[1~2]-ex[4~5].png:[100,200]  is equivalent to  halo=halo1-ex4.png:100,halo2-ex5:200.png&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 150ms in each hex. so you typically want to have an offset of ''0~1:150,0~1:150,0~1:150,0~1:150,0~1:150'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:150,0.6~0:150&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, but you can't nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            begin=-100&lt;br /&gt;
            end=100&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            begin=-100&lt;br /&gt;
            end=100&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=InterfaceActionsWML&amp;diff=48430</id>
		<title>InterfaceActionsWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=InterfaceActionsWML&amp;diff=48430"/>
		<updated>2013-01-27T09:08:35Z</updated>

		<summary type="html">&lt;p&gt;Coffee: /* [item] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
== Interface actions ==&lt;br /&gt;
&lt;br /&gt;
Part of [[ActionWML]], interface actions are actions that do not have a direct effect on gameplay;&lt;br /&gt;
instead, they show something to the player.  The main interface tags&lt;br /&gt;
are '''[message]''' and '''[objectives]''', but several other tags affect&lt;br /&gt;
the interface also.&lt;br /&gt;
&lt;br /&gt;
== [inspect] ==&lt;br /&gt;
This user interface action only works in debug mode. It displays the gamestate inspector dialog (the same one which can be brought up with '':inspect'' ), which can be used to inspect the values of WML variables, AI configuration, recall lists, and more.&lt;br /&gt;
&lt;br /&gt;
* '''name''': optional attribute to specify the name of this gamestate inspector dialog. It is just a label to help differentiate between different invocations of gamestate inspector dialog.&lt;br /&gt;
&lt;br /&gt;
== [message] ==&lt;br /&gt;
The most commonly used interface action is [message], which displays a message to the user in a dialog box. It can also be used to take input from the user.&lt;br /&gt;
&lt;br /&gt;
The following key/tags are accepted for [message]:&lt;br /&gt;
* [[StandardUnitFilter]]: The unit whose profile and name are displayed. Do not use a [filter] tag. If no unit matching this filter is found, the message is not displayed (The unit has probably been killed).&amp;lt;br&amp;gt;'''[message]''' elements should be constructed so that it is either guaranteed that a certain unit is alive, or so that dialog flows smoothly even if the message isn't displayed.&lt;br /&gt;
&lt;br /&gt;
* '''speaker''': an alternative to standard unit filter. You may specify as the value of the speaker attribute a unit id or any of the following special values:&lt;br /&gt;
** '''narrator''': the dialog box is displayed without a caption for the unit speaking or a unit image&lt;br /&gt;
** '''unit''': the primary unit for the event is speaking&lt;br /&gt;
** '''second_unit''': the secondary unit for the event is speaking&lt;br /&gt;
&lt;br /&gt;
* '''message''': (translatable) the text to display to the right of the image. ''message'' is sometimes multiple lines; if it is, be sure to use quotes(''' ' ''' or ''' &amp;quot; ''')&lt;br /&gt;
* '''[show_if]''': if present then this message will only be displayed if the conditional statement in this tag is passed (see [[ConditionalActionsWML#Condition_Tags|ConditionalActionsWML]])&lt;br /&gt;
* '''side_for''': (default: all sides) comma-separated list of sides for who message is shown.&lt;br /&gt;
* '''image''': (default: profile image of speaker) the image to display next to the message. Append ~RIGHT() if you want the image to appear on the right side.&lt;br /&gt;
* '''caption''': (default: name of speaker) the caption to display beside the image. Name to be displayed. Note: use a translation mark to avoid wmllint errors.&lt;br /&gt;
* '''scroll''': Boolean specifying whether the game view should scroll to the speaking unit. Defaults to ''yes''.&lt;br /&gt;
* '''duration''': (default: 10) the minimum number of frames for this message to be displayed. (A frame lasts about 30 milliseconds.) During this time any dialog decisions will be disregarded.&lt;br /&gt;
* '''sound''': a sound effect (wav file) to play as the message is displayed. This can be a comma-separated list, from which one will be randomly chosen.&lt;br /&gt;
* '''[option]''': No '''[option]''' elements have to be used. If '''[option]''' elements are present, then each option will be displayed in a menu for the user to select one option.&lt;br /&gt;
** '''message''': (translatable) the text displayed for the option (see [[DescriptionWML]])&lt;br /&gt;
** '''[show_if]''': if present then this option will only be displayed if the conditional statement in this tag is passed (see [[ConditionalActionsWML#Condition_Tags|ConditionalActionsWML]])&lt;br /&gt;
** '''[command]''': an element containing actions which are executed if the option is selected.&lt;br /&gt;
* '''[text_input]''': there can be only one [text_input] tag. this adds a text input field to the message.&lt;br /&gt;
** '''variable''': the variable that the user's input will be written to&lt;br /&gt;
** '''label''': a text label to the left of the input field&lt;br /&gt;
** '''max_length''': the maximum number of characters that may be typed into the field&lt;br /&gt;
** '''text''': text that is written into the field in the beginning&lt;br /&gt;
* Check [[EventWML#Multiplayer_safety]] to find out in which events you can safely use '''[option]''' and '''[text_input]''' without causing OOS.&lt;br /&gt;
&lt;br /&gt;
=== Formatting ===&lt;br /&gt;
In 1.8, [http://developer.gnome.org/pango/unstable/PangoMarkupFormat.html Pango markup formatting codes] have been adopted for '''[message]'''. These can also be used in unit names (user_description), objectives, and such. Note that you'll probably want to use a single quote ' instead of a double quote &amp;quot; as double quotes cannot be escaped, otherwise the string will appear fragmented and you may also encounter errors. Running wmllint on your campaign will up-convert it, warning you about unusual cases you must fix by hand.&lt;br /&gt;
&lt;br /&gt;
For example, if you wanted to write &amp;quot;You are victorious!&amp;quot; in large, italic, gold letters, you might write it this way:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;span color='#BCB088' size='large' font-style='italic'&amp;gt;You are victorious!&amp;lt;/span&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
These are the codes taken from the Pango markup formatting guide:&lt;br /&gt;
&lt;br /&gt;
*'''font''', '''font_desc''': A font description string, such as &amp;quot;Sans Italic 12&amp;quot;.&lt;br /&gt;
*'''font_family''', '''face''': A font family name.&lt;br /&gt;
*'''font_size''', '''size''': Font size in 1024ths of a point, or one of the absolute sizes 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', or one of the relative sizes 'smaller' or 'larger'.&lt;br /&gt;
*'''font_style''', '''style''': One of 'normal', 'oblique', 'italic'.&lt;br /&gt;
*'''font_weight''', '''weight''': One of 'ultralight', 'light', 'normal', 'bold', 'ultrabold', 'heavy', or a numeric weight.&lt;br /&gt;
*'''font_variant''', '''variant''': One of 'normal' or 'smallcaps'.&lt;br /&gt;
*'''font_stretch''', '''stretch''': One of 'ultracondensed', 'extracondensed', 'condensed', 'semicondensed', 'normal', 'semiexpanded', 'expanded', 'extraexpanded', 'ultraexpanded'.&lt;br /&gt;
*'''foreground''', '''fgcolor''', '''color''': An RGB color specification such as '#00FF00' or a color name such as 'red'.&lt;br /&gt;
*'''background, bgcolor''': An RGB color specification such as '#00FF00' or a color name such as 'red'.&lt;br /&gt;
*'''underline''': One of 'none', 'single', 'double', 'low', 'error'.&lt;br /&gt;
*'''underline_color''': The color of underlines; an RGB color specification such as '#00FF00' or a color name such as 'red'.&lt;br /&gt;
*'''rise''': Vertical displacement, in 10000ths of an em. Can be negative for subscript, positive for superscript.&lt;br /&gt;
*'''strikethrough''': 'true' or 'false' whether to strike through the text.&lt;br /&gt;
*'''strikethrough_color''': The color of strikethrough lines; an RGB color specification such as '#00FF00' or a color name such as 'red'&lt;br /&gt;
*'''fallback''': 'true' or 'false' whether to enable fallback. If disabled, then characters will only be used from the closest matching font on the system. No fallback will be done to other fonts on the system that might contain the characters in the text. Fallback is enabled by default. Most applications should not disable fallback.&lt;br /&gt;
*'''letter_spacing''': Inter-letter spacing in 1024ths of a point.&lt;br /&gt;
*'''gravity''': One of 'south', 'east', 'north', 'west', 'auto'.&lt;br /&gt;
*'''gravity_hint''': One of 'natural', 'strong', 'line'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In 1.6, Wesnoth uses older text formatting options&lt;br /&gt;
* A tilde (~) as the first character causes the line to be boldfaced.&lt;br /&gt;
* An at symbol (@) as the first character causes the line to be green, as done with victory conditions.&lt;br /&gt;
* A pound symbol (#) as the first character causes the line to be red, as done with defeat conditions.&lt;br /&gt;
* An asterisk (*) as the first character causes the line to be bigger.&lt;br /&gt;
* A backquote (`) as the first character causes the line to be smaller.&lt;br /&gt;
* If used, the caption key text is boldfaced.&lt;br /&gt;
* An RGB colour code in the beginning causes the line to be the given colour. This can still be preceded by the above characters. Example: ''message=_&amp;quot;&amp;lt;255,0,0&amp;gt;Red!&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
== [objectives] ==&lt;br /&gt;
The other tag used for plot development is '''[objectives]'''.&lt;br /&gt;
The '''[objectives]''' tag overwrites any previously set objectives,&lt;br /&gt;
and displays text which should describe the objectives of the scenario.&lt;br /&gt;
Scenario objectives are displayed on the player's first turn after the tag is used,&lt;br /&gt;
or as part of the event if it triggers during that player's turn.&lt;br /&gt;
Objectives can also be accessed at any time in a scenario using the&lt;br /&gt;
&amp;quot;Scenario Objectives&amp;quot; game menu option, making this tag useful for&lt;br /&gt;
scenario-specific information that the player may need to refer to during play.&lt;br /&gt;
&lt;br /&gt;
Attributes of '''[objectives]''':&lt;br /&gt;
* '''side''': Default '0'. The side to set the objectives for. A value of 0 sets objectives for all sides. note: There are side-specific objectives and default objectives, which are used in case a side doesn't have specific ones. Specifying 0 sets the default ones.&lt;br /&gt;
* '''[[StandardSideFilter]]''' {{DevFeature1.11}} tags and keys: Sets the objectives of all matching sides to these passed specifications (the rest of this [objectives] tag). If no sides (such as when passing side=0) or all sides match, sets the default objectives, and the side specific ones for the matching sides otherwise.&lt;br /&gt;
* '''bullet''': Default '• '. Replaces the default bullet, with whatever is passed, for all objectives, gold carryover notes, and notes defined with [note].&lt;br /&gt;
* '''summary''': Displayed first in the objectives text, this should describe the basic objective for the overall scenario.  Can be omitted.&lt;br /&gt;
* '''note''': Displayed last in the objectives text, this is sometimes used for hints or additional information.  Can be omitted.&lt;br /&gt;
* '''victory_string''': Default ' _ &amp;quot;Victory:&amp;quot;', this text precedes the victory objectives.&lt;br /&gt;
* '''defeat_string''': Default ' _ &amp;quot;Defeat:&amp;quot;', this text precedes the defeat objectives.&lt;br /&gt;
* '''gold_carryover_string''': Default ' _ &amp;quot;Gold carryover:&amp;quot;', this text precedes the gold carryover information.&lt;br /&gt;
* '''notes_string''': Default ' _ &amp;quot;Notes:&amp;quot;', this text precedes the notes.&lt;br /&gt;
* '''silent''': Default: not present. If set to &amp;quot;yes&amp;quot;, the objectives are silently changed. Else, they will be shown to the user when appropriate.&lt;br /&gt;
&lt;br /&gt;
Tags of '''[objectives]''':&lt;br /&gt;
* '''[objective]''': describes a win or loss condition. Most scenarios have multiple win or loss conditions, so use a separate [objective] subtag for each line; this helps with translations.&lt;br /&gt;
** '''bullet''': Default '• ' or whatever is set in the parent [objectives] block. Replaces the default bullet, with whatever is provided, for the objective defined by the [objective] block.&lt;br /&gt;
** '''red''': Default '0' for winning objectives, '255' for losing objectives. Overrides the default red coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''green''': Default '255' for winning objectives, '0' for losing objectives. Overrides the default green coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''blue''': Default '0'. Overrides the default blue coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''description''': text for the specific win or loss condition.&lt;br /&gt;
** '''condition''': The color and placement of the text. Values are 'win'(colored green, placed after ''victory_string'') and 'lose'(colored red, placed after ''defeat_string'')&lt;br /&gt;
** '''show_turn_counter''': If set to yes, displays the number of turns remaining in the scenario. Default is no.&lt;br /&gt;
** '''[show_if]''': A condition that disables the objective if it doesn't hold. Conditional objectives are refreshed at '''[show_objectives]''' time only.&lt;br /&gt;
* '''[gold_carryover]''': describes how the gold carryover works in this scenario. This is intended to be a more convenient way of displaying carryover information than using the note= key in [objectives].&lt;br /&gt;
** '''bullet''': Default '• ' or whatever is set in the parent [objectives] block. Replaces the default bullet with whatever is provided.&lt;br /&gt;
** '''red''': Default '255'. Overrides the default red coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''green''': Default '255'. Overrides the default green coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''blue''': Default '192'. Overrides the default blue coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''bonus''' (boolean): whether an early finish bonus is granted. If omitted, early finish bonus is not mentioned.&lt;br /&gt;
** '''carryover_percentage''': the amount of carryover gold. If omitted, the amount is not mentioned.&lt;br /&gt;
* '''[note]''': describes a note, usually used for hints or additional information. This is an easier way of adding several notes than concatenating them together into a single string to use with the ''note='' key.&lt;br /&gt;
** '''bullet''': Default '• ' or whatever is set in the parent [objectives] block. Replaces the default bullet with whatever is provided for the note defined by the [note] block.&lt;br /&gt;
** '''red''': Default '255'. Overrides the default red coloring of the entire note, including the bullet.&lt;br /&gt;
** '''green''': Default '255'. Overrides the default green coloring of the entire note, including the bullet.&lt;br /&gt;
** '''blue''': Default '255'. Overrides the default blue coloring of the entire note, including the bullet.&lt;br /&gt;
** '''description''': the text of the note.&lt;br /&gt;
** {{DevFeature1.11}} '''[show_if]''': The note will not be shown if the specified condition isn't met. Conditional notes are refreshed at '''[show_objectives]''' time only.&lt;br /&gt;
&lt;br /&gt;
== [set_menu_item] ==&lt;br /&gt;
This tag is used to add a custom option in the right-click context menu which can then be used to trigger arbitrary WML commands.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Due to limitations in portable devices where there are no scroll bars for context menus, there is a hard-coded limit of 7 custom WML menu items. If you really need to have more than 7 menu items, try combining some of them in a submenu.&lt;br /&gt;
&lt;br /&gt;
* '''id''': the unique id for this menu item. If a menu item with this id already exists, it allows you to set specific changes to that item.&lt;br /&gt;
* '''description''': the in-game text that will appear for this item in the menu.&lt;br /&gt;
* '''image''': the image to display next to this item.&lt;br /&gt;
* '''needs_select''': if ''yes'' (default ''no''), then the latest select event (see [[EventWML]]) that triggered before this menu item was chosen will be transmitted over the network before this menu item action will be. This only has any effect in networked multiplayer, and is intended to allow more elaborate menu item behaviour there without causing out of sync errors. If you don't know what this means, just leave it false.&lt;br /&gt;
* '''[show_if]''': If present, the menu item will only be available if the conditional statement (see [[ConditionalActionsWML#Condition_Tags|ConditionalActionsWML]]) within evaluates to true. When this is evaluated, the WML variables ''$x1'' and ''$y1'' will point to the location on which the context menu was invoked, so it's possible to for example only enable the option on empty hexes or on a particular unit.&lt;br /&gt;
* '''[filter_location]''': contains a location filter similar to the one found inside Single Unit Filters (see [[FilterWML]]). The menu item will only be available on matching locations.&lt;br /&gt;
* '''[command]''': contains the WML actions to be executed when the menu item is selected. Again, the WML variables ''$x1'' and ''$y1'' will point to the location on which the context menu was invoked on.&lt;br /&gt;
** '''delayed_variable_substitution ''' {{DevFeature1.11}} (boolean yes|no, default: yes): If no, forces a variable substitution run onto the wml included in this [command] block. Use this, if you want variables which are to substitute to get the values they have at execution time of the event where this set_menu_item appears. Other than that, they get the values they have at invocation time of the menu item.&lt;br /&gt;
&lt;br /&gt;
== [clear_menu_item] ==&lt;br /&gt;
{{DevFeature1.11}}&lt;br /&gt;
&lt;br /&gt;
Removes a menu item from the scenario.&lt;br /&gt;
Normally menu items are, including all their defining wml, automatically carried over between scenarios. This tag prevents this. (The behavior is comparable to set_variable/clear_variable).&lt;br /&gt;
* '''id''': (string): id of the menu item to clear. Can be a comma-separated list.&lt;br /&gt;
&lt;br /&gt;
== Other interface tags ==&lt;br /&gt;
&lt;br /&gt;
The following tags are also action tags:&lt;br /&gt;
=== [item] ===&lt;br /&gt;
Makes a graphical item appear on a certain hex. Note this only places the graphics for an item. It does not make the item do anything. Use a moveto event to make moving onto the item do something. &amp;lt;tt&amp;gt;''('''Hint:''' There are a number of predefined items that are used in various campaigns that you can make use of. You can find [http://www.wesnoth.org/macro-reference.xhtml#file:items.cfg a list of them] if you look into the items.cfg file in the wesnoth install directory (under /data/core/macros).)''&amp;lt;/tt&amp;gt;&lt;br /&gt;
* '''x''', '''y''': the location to place the item. (only for [event][item]: full [[StandardLocationFilter|SLF]] support)&lt;br /&gt;
* '''image''': the image (in ''images/'' as .png) to place on the hex. This image is aligned with the top-left of the hex (which is 72 pixels wide and 72 pixels tall). It is drawn underneath units. ''('''Hint:''' If using an image smaller than 72x72, then it might be useful to [[ImagePathFunctionWML#Blit_Function|BLIT]] the image onto &amp;lt;tt&amp;gt;misc/blank-hex.png&amp;lt;/tt&amp;gt; (a blank 72x72 image).)''&lt;br /&gt;
* '''halo''': an image to place centered on the hex. It is drawn on top of units. Use this instead of ''image'' if the image is bigger than the hex or if you want to animate an image.&lt;br /&gt;
''Example (where the integer after the colon is the duration of each frame or suqare bracket expansion as per AnimationWML is used): halo=scenery/fire1.png:100,scenery/fire2.png:100,scenery/fire3.png:100,scenery/fire4.png:100,scenery/fire5.png:100,scenery/fire6.png:100,scenery/fire7.png:100,scenery/fire8.png:100''&lt;br /&gt;
or equivalently:&lt;br /&gt;
''halo=scenery/fire[1-8].png:100''&lt;br /&gt;
* '''team_name''': name of the team for which the item is to be displayed (hidden for others). For multiple teams just put all the names in one string, for example separated by commas.&lt;br /&gt;
* '''visible_in_fog''': whether the item should be visible through fog or not. Default yes.&lt;br /&gt;
* '''redraw''': {{DevFeature1.11}}(boolean yes|no, default: yes): If no, disables implicit calls to [[InterfaceActionsWML#.5Bredraw.5D|[redraw]]] when placing the items.&lt;br /&gt;
&lt;br /&gt;
=== [remove_item] ===&lt;br /&gt;
Removes any graphical items on a given hex.&lt;br /&gt;
* [[StandardLocationFilter]]: the hexes to remove items off&lt;br /&gt;
* '''image''' if specified, only removes the given image item (This image name must include any [[ImagePathFunctionWML|image path functions]] appended to the original image name.)&lt;br /&gt;
&lt;br /&gt;
=== [print] ===&lt;br /&gt;
Displays a message across the screen. The message will disappear after a certain time.&lt;br /&gt;
* '''text''': (translatable) the text to display.&lt;br /&gt;
* '''size''': (default=12) the pointsize of the font to use&lt;br /&gt;
* '''duration''': (default=50) the length of time to display the text for. This is measured in the number of 'frames'. A frame in Wesnoth is usually displayed for around 30ms.&lt;br /&gt;
* '''red''', '''green''', '''blue''': (default=0,0,0) the color to display the text in. Values vary from 0-255.&lt;br /&gt;
=== [move_unit_fake] ===&lt;br /&gt;
Moves an image of a unit along a certain path on the map. The path does not need to be a continuous list of adjacent hexes, so for example only the start and end points can be given, in which case the straightest line between those points will be calculated and used.&lt;br /&gt;
* '''type''': the type of the unit whose image to use&lt;br /&gt;
* '''x''': a comma-separated list of x locations to move along&lt;br /&gt;
* '''y''': a comma-separated list of y locations to move along (x and y values are matched pairs)&lt;br /&gt;
* '''side''': the side of the fake unit, used for team-coloring the fake unit&lt;br /&gt;
* '''gender''': the gender of the fake unit. Example: gender=female&lt;br /&gt;
* '''variation''': the variation of the fake unit. Example: variation=undead&lt;br /&gt;
* '''image_mods''': [[ImagePathFunctionWML|image path functions]] sequence to be applied on the fake unit.&lt;br /&gt;
=== [move_units_fake] ===&lt;br /&gt;
moves multiple images of units along paths on the map. These units are moved in lockstep.&lt;br /&gt;
* '''[fake_unit]''': A fake unit to move&lt;br /&gt;
** '''type''': the type of unit whose image to use&lt;br /&gt;
** '''x''': a comma-separated list of x locations to move along&lt;br /&gt;
** '''y''': a comma-separated list of y locations to move along (x and y values are matched pairs)&lt;br /&gt;
** '''side''': the side of the fake unit, used for team-coloring the fake unit&lt;br /&gt;
** '''skip_steps''': the number of steps to skip before this unit starts moving&lt;br /&gt;
=== [hide_unit] ===&lt;br /&gt;
Temporarily prevents the engine from displaying the given unit. The unit does not become invisible, as it would be with the '''[hides]''' ability; it is still the same plain unit, but without an image. Useful in conjunction with '''[move_unit_fake]''': to move a leader unit into position on-screen. Until 1.8 each '''[hide_unit]''' tag only hides one unit.&lt;br /&gt;
* [[StandardUnitFilter]]: All matching units will be hidden&lt;br /&gt;
&lt;br /&gt;
=== [unhide_unit] ===&lt;br /&gt;
Stops the currently hidden units from being hidden.&lt;br /&gt;
* [[StandardUnitFilter]]: Only the matching units will be unhidden&lt;br /&gt;
&lt;br /&gt;
=== [lock_view] ===&lt;br /&gt;
{{DevFeature1.11}} Locks gamemap view scrolling for human players, so they cannot scroll the gamemap view until it is unlocked. WML or Lua actions such as '''[scroll_to]''' will continue to work normally, as they ignore this restriction; the locked/unlocked state is preserved when saving the current game.&lt;br /&gt;
&lt;br /&gt;
This feature is generally intended to be used in cutscenes to prevent the player scrolling away from scripted actions. &lt;br /&gt;
&lt;br /&gt;
=== [unlock_view] ===&lt;br /&gt;
{{DevFeature1.11}} Unlocks gamemap view scrolling for human players.&lt;br /&gt;
&lt;br /&gt;
=== [scroll] ===&lt;br /&gt;
Scroll a certain number of pixels in a given direction. Useful for earthquake/shaking effects.&lt;br /&gt;
* '''x''', '''y''': the number of pixels to scroll along the x and y axis&lt;br /&gt;
=== '''[scroll_to]''' ===&lt;br /&gt;
Scroll to a given hex&lt;br /&gt;
* '''x''', '''y''': the hex to scroll to&lt;br /&gt;
* {{DevFeature1.11}} [[StandardLocationFilter]], do not use a [filter_location] sub-tag. If more than one location matches the filter, only the first matching location will be used.&lt;br /&gt;
* '''check_fogged''': whether to scroll even to locations covered in fog or shroud. Possible values ''true'' (don't scroll to fog) and ''false'' (scroll even to fog), with ''false'' as the default.&lt;br /&gt;
* {{DevFeature1.11}} '''immediate''': whether to instantly warp to the target hex regardless of the scroll speed setting in Preferences (defaults to ''false'').&lt;br /&gt;
&lt;br /&gt;
=== [scroll_to_unit] ===&lt;br /&gt;
Scroll to a given unit&lt;br /&gt;
* [[StandardUnitFilter]]&lt;br /&gt;
* '''check_fogged''': whether to scroll even to locations covered in fog or shroud. Possible values ''true'' (don't scroll to fog) and ''false'' (scroll even to fog), with ''false'' as the default.&lt;br /&gt;
* {{DevFeature1.11}} '''immediate''': whether to instantly warp to the target hex regardless of the scroll speed setting in Preferences (defaults to ''false'').&lt;br /&gt;
=== [select_unit] ===&lt;br /&gt;
Selects a given unit.&lt;br /&gt;
* [[StandardUnitFilter]]: The first unit found will be selected.&lt;br /&gt;
* '''fire_event''': whether a ''select'' event should be triggered or not (def. ''no''). (Note that select events aren't multiplayer save.)&lt;br /&gt;
* '''highlight''': whether the unit's current hex should be highlighted (def. ''yes'').&lt;br /&gt;
&lt;br /&gt;
=== [sound]===&lt;br /&gt;
Plays a sound&lt;br /&gt;
* '''name''': the filename of the sound to play (in ''sounds/'' as .wav or .ogg)&lt;br /&gt;
* '''repeat''': repeats the sound for a specified additional number of times (default=0)&lt;br /&gt;
=== [sound_source] ===&lt;br /&gt;
Creates a sound source. &amp;quot;Sound sources&amp;quot; is a general name for a mechanism which makes possible for map elements to emit sounds according to some rules, where &amp;quot;map elements&amp;quot; can be specific locations or terrain types. For now, only sound sources tied to locations are supported.&lt;br /&gt;
* '''id''': a unique identification key of the sound source&lt;br /&gt;
* '''sounds''': a list of comma separated, randomly played sounds associated with the sound source&lt;br /&gt;
* '''delay''': a numerical value (in milliseconds) of the minimal delay between two playbacks of the source's sound if the source remains visible on the screen; if one scrolls out and back in, the source will be considered as ready to play&lt;br /&gt;
* '''chance''': a percentage (a value from 0 to 100) describing the chance of the source being activated every second after the delay has passed or when the source's location appears on the screen (note that it cannot play more than one file at the same time)&lt;br /&gt;
* '''check_fogged''': possible values &amp;quot;true&amp;quot; and &amp;quot;false&amp;quot; - if true the source will not play if its locations are fogged&lt;br /&gt;
* '''check_shrouded''': possible values &amp;quot;true&amp;quot; and &amp;quot;false&amp;quot; - if true the source will not play if its locations are shrouded&lt;br /&gt;
* '''x,y''': similar to x,y as found in a [[StandardLocationFilter]], these are the locations associated with the sound source&lt;br /&gt;
* '''fade_range''' (default = 3): distance in hexes that determines a &amp;quot;circular&amp;quot; area around the one specified by '''full_range''' where sound volume fades out linearly&lt;br /&gt;
* '''full_range''' (default = 14): distance in hexes that determines a &amp;quot;circular&amp;quot; area where source plays with full volume, relative to screen center&lt;br /&gt;
* '''loop''': number of times a sound sample should be looped if it stays visible. -1 means infinite (~65000)&lt;br /&gt;
&lt;br /&gt;
=== [remove_sound_source] ===&lt;br /&gt;
Removes a previously defined sound source.&lt;br /&gt;
* '''id''': the identification key of the sound source to remove&lt;br /&gt;
&lt;br /&gt;
=== [music]===&lt;br /&gt;
Switches to playing different music&lt;br /&gt;
* '''name''': the filename of the music to play (in ''music/'' as .ogg)&lt;br /&gt;
* see [[MusicListWML]] for the correct syntax&lt;br /&gt;
===[volume]===&lt;br /&gt;
Changes the game volume to a percent of the preferences volume for the game being played. Values can go from 0 to 100:  &lt;br /&gt;
* '''music''':  Changes the music volume.&lt;br /&gt;
* '''sound''':  Changes the sound volume.&lt;br /&gt;
=== [color_adjust]===&lt;br /&gt;
Tints the color of the screen.&lt;br /&gt;
* '''red''', '''green''', '''blue''': values from -255 to 255, the amount to tint by for each color&lt;br /&gt;
=== [delay] ===&lt;br /&gt;
Pauses the game.&lt;br /&gt;
* '''time''': the time to pause in milliseconds&lt;br /&gt;
=== [redraw] ===&lt;br /&gt;
Redraws the screen (this normally isn't done during events, although some of the other interface actions cause the screen or parts of it to be redrawn).&lt;br /&gt;
* '''clear_shroud''' (boolean yes|no, default no): If yes, clears fog and shroud around existing units. Useful if you, for example, spawn friendly units in the middle of an event and want the shroud to update accordingly (otherwise units that spawn inside fog would remain invisible for the duration of the event, since the fog would not automatically get cleared around them).&lt;br /&gt;
* '''[[StandardSideFilter]]''': the sides for which to recalculate fog and shroud.&lt;br /&gt;
* '''side''': If used (forces clear_shroud=yes), clears fog and shroud for that side.&lt;br /&gt;
&lt;br /&gt;
=== [unit_overlay] ===&lt;br /&gt;
Sets an image that will be drawn over a particular unit, and follow it around&lt;br /&gt;
* [[StandardUnitFilter]]: All matching units will get the overlay (do not use [filter])&lt;br /&gt;
* '''image''': the image to place on the unit&lt;br /&gt;
&lt;br /&gt;
=== [remove_unit_overlay] ===&lt;br /&gt;
removes a particular overlayed image from a unit&lt;br /&gt;
* [[StandardUnitFilter]]: The overlay will get removed from all matching units (do not use [filter])&lt;br /&gt;
* '''image''': the image to remove from the unit&lt;br /&gt;
&lt;br /&gt;
=== [animate_unit] ===&lt;br /&gt;
Uses an animation of a unit to animate it on screen (if the unit has the corresponding animation).&lt;br /&gt;
* '''flag''': The key to find the custom animation in the unit description (see the '''[extra_anim]''' description in [[AnimationWML]]). Standard animations can be triggered with the following keywords: ''leading recruited standing idling levelout levelin healing healed poisoned movement defend attack death victory pre_teleport post_teleport''&lt;br /&gt;
* '''[filter]''' with a [[StandardUnitFilter]] as argument, see [[FilterWML]]. By default, the unit at the event location will be animated. You can use this tag to choose any other unit to animate.&lt;br /&gt;
* '''[primary_attack]''': If this tag is not present, the filter for animation will be triggered with no attack. If it is here, all attacks from the unit will be filtered, and a matching one will be used to filter the animation. Takes a weapon filter as argument, see [[FilterWML]].&lt;br /&gt;
* '''[secondary_attack]''': Similar to '''[primary_attack]'''. May be needed to trigger a defense animation correctly, if there are more than one animations available for the defending unit.&lt;br /&gt;
* '''hits''': yes/no/hit/miss/kill: which according variation of a attack/defense animation shall be chosen (required)&lt;br /&gt;
* '''text''': a text to hover during the animation &lt;br /&gt;
* '''red''': red value for the text color (0-255)&lt;br /&gt;
* '''green''': green value for the text color&lt;br /&gt;
* '''blue''': blue value for the text color&lt;br /&gt;
* '''with_bars''': yes/no: whether to display the status bars during the animation (e.g. the hitpoint bar)&lt;br /&gt;
* '''[animate]''': a sub block with the same syntax as '''[animate_unit]''' except that the '''[filter]''' block is mandatory to find the unit. This block will find and animate another unit simultaneously.&lt;br /&gt;
* '''[facing]''': a [[StandardLocationFilter]] specifying what direction the unit should be facing when animated&lt;br /&gt;
&lt;br /&gt;
=== [label] ===&lt;br /&gt;
Places a label on the map.&lt;br /&gt;
* '''x''', '''y''': the location of the label&lt;br /&gt;
* '''text''': what the label should say&lt;br /&gt;
* '''team_name''': if specified, the label will only be visible to the given team.&lt;br /&gt;
* '''color''': color of the label. The format is r,g,b; r, g and b are numbers between 0 and 255.&lt;br /&gt;
* '''visible_in_fog''': whether the label should be visible through fog or not. Default yes.&lt;br /&gt;
* '''visible_in_shroud''': whether the label should be visible through shroud or not. Default no.&lt;br /&gt;
* '''immutable''': whether this label is protected from being removed or changed by players. Default yes.&lt;br /&gt;
=== [floating_text]===&lt;br /&gt;
Floats text (similar to the damage and healing numbers) on the given locations.&lt;br /&gt;
* [[StandardLocationFilter]]: the text will be floated on all matching locations simultaneously.&lt;br /&gt;
* '''text''': the text to display.&lt;br /&gt;
&lt;br /&gt;
The default text color is &amp;lt;span style=&amp;quot;color: #6b8cff;&amp;quot;&amp;gt;'''#6b8cff'''&amp;lt;/span&amp;gt;. To change the color, use [[#Formatting|Pango markup]]. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Float some golden yellow text at 20,20.&lt;br /&gt;
[floating_text]&lt;br /&gt;
   x,y=20,20&lt;br /&gt;
   text=&amp;quot;&amp;lt;span color='#cccc33'&amp;gt;&amp;quot; + _ &amp;quot;Your text here&amp;quot; + &amp;quot;&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
[/floating_text]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [deprecated_message] ===&lt;br /&gt;
Shows a deprecated message in the message area, this feature is only intended to be used to warn about deprecated macros in mainline. The message is not translatable.&lt;br /&gt;
* '''message''': the message to show.&lt;br /&gt;
=== [wml_message] ===&lt;br /&gt;
Outputs a message to Wesnoth's console output. Intended for campaign designers to output silent text to the console, without annoying the player; then, that text might contain information useful for later bug-reporting. The log domain for it is '''wml''', and the '''debug/dbg''' log level is available for use with the '''logger''' attribute. Depending on the current log level ('''error''' by default), which may be changed with the in-game :log command, or the --log-&amp;lt;level&amp;gt;=wml command line switch, the messages are echoed to the in-game chat.&lt;br /&gt;
* '''message''': the message to show.&lt;br /&gt;
* '''logger''': the Wesnoth engine output logger that should catch the text; this might be 'err' (the errors log level), 'warn'/'wrn' (the warnings log level) or anything else (the information log level). Not all information will be displayed depending on the log level chosen when starting Wesnoth.&lt;br /&gt;
&lt;br /&gt;
Note: As of 1.9.4/1.9.5 (r48805) the following &amp;quot;loggers&amp;quot; should work: If in [wml_message]: err/error, warn/wrn/warning, debug/dbg; using the :log command: Only the long forms error, warning, info and debug (this part gathered by trying rather than source inspecting). The long forms are most likely also the only ones working when starting wesnoth with --log-&amp;lt;level&amp;gt;=wml.&lt;br /&gt;
For log level warning or error (as during normal play), only wml_messages with logger error or warning display (for both). With logger info or debug, additionally wml_messages with logger info or debug display (for both).&lt;br /&gt;
&lt;br /&gt;
=== [open_help] ===&lt;br /&gt;
Opens the in-game help.&lt;br /&gt;
* '''topic''': the id of the topic to open&lt;br /&gt;
=== [show_objectives] ===&lt;br /&gt;
refreshes the objectives defined by [objectives] and its [show_if] tags, and displays them. (It is also called whenever the user explicitly asks for the objectives; this matters only if the tag was overridden by a [[LuaWML#register_wml_action|Lua]] script.)&lt;br /&gt;
* '''side''': the side to show the objectives. If not set, all sides are used.&lt;br /&gt;
* '''[[StandardSideFilter]]''' {{DevFeature1.11}} tags and keys: Tag affects the matching sides instead of just all or the one given by the integer value of the side= key.&lt;br /&gt;
&lt;br /&gt;
=== [chat] ===&lt;br /&gt;
Displays a message in the chat area.&lt;br /&gt;
* '''speaker''': (default=&amp;quot;WML&amp;quot;) A string for the name of the sender of the message.&lt;br /&gt;
* '''message''': The message that should be displayed.&lt;br /&gt;
* '''[[StandardSideFilter]]''' tags and keys as argument; if the same client controls multiple sides that match, then the message will only be displayed once.&lt;br /&gt;
&lt;br /&gt;
== Useful Macros ==&lt;br /&gt;
There are some predefined macros that you find useful for interface actions. You can find a complete list along with a detailed explanation of how they work [http://www.wesnoth.org/macro-reference.xhtml here].&lt;br /&gt;
* '''{HIGHLIGHT_UNIT}''' Highlight a unit on the map. Use this to show important units&lt;br /&gt;
* '''{HIGHLIGHT_IMAGE}''' Places and highlights an image on the map. Use this to show important items or locations&lt;br /&gt;
* '''{SET_IMAGE}''' Places an image on the map which has no other function.&lt;br /&gt;
* '''{QUAKE &amp;lt;soundfile&amp;gt;}''' Creates a tremor-like screenshake and plays &amp;lt;soundfile&amp;gt;. For example, '''{QUAKE (rumble.ogg)}'''.&lt;br /&gt;
* '''{FLASH_WHITE}''' Flash the screen white momentarily. You can also replace WHITE with RED, BLUE or GREEN for a different colour.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[DirectActionsWML]]&lt;br /&gt;
* [[InternalActionsWML]]&lt;br /&gt;
* [[EventWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;br /&gt;
[[Category: ActionsWML]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=InterfaceActionsWML&amp;diff=48429</id>
		<title>InterfaceActionsWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=InterfaceActionsWML&amp;diff=48429"/>
		<updated>2013-01-27T09:08:14Z</updated>

		<summary type="html">&lt;p&gt;Coffee: /* [item] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
== Interface actions ==&lt;br /&gt;
&lt;br /&gt;
Part of [[ActionWML]], interface actions are actions that do not have a direct effect on gameplay;&lt;br /&gt;
instead, they show something to the player.  The main interface tags&lt;br /&gt;
are '''[message]''' and '''[objectives]''', but several other tags affect&lt;br /&gt;
the interface also.&lt;br /&gt;
&lt;br /&gt;
== [inspect] ==&lt;br /&gt;
This user interface action only works in debug mode. It displays the gamestate inspector dialog (the same one which can be brought up with '':inspect'' ), which can be used to inspect the values of WML variables, AI configuration, recall lists, and more.&lt;br /&gt;
&lt;br /&gt;
* '''name''': optional attribute to specify the name of this gamestate inspector dialog. It is just a label to help differentiate between different invocations of gamestate inspector dialog.&lt;br /&gt;
&lt;br /&gt;
== [message] ==&lt;br /&gt;
The most commonly used interface action is [message], which displays a message to the user in a dialog box. It can also be used to take input from the user.&lt;br /&gt;
&lt;br /&gt;
The following key/tags are accepted for [message]:&lt;br /&gt;
* [[StandardUnitFilter]]: The unit whose profile and name are displayed. Do not use a [filter] tag. If no unit matching this filter is found, the message is not displayed (The unit has probably been killed).&amp;lt;br&amp;gt;'''[message]''' elements should be constructed so that it is either guaranteed that a certain unit is alive, or so that dialog flows smoothly even if the message isn't displayed.&lt;br /&gt;
&lt;br /&gt;
* '''speaker''': an alternative to standard unit filter. You may specify as the value of the speaker attribute a unit id or any of the following special values:&lt;br /&gt;
** '''narrator''': the dialog box is displayed without a caption for the unit speaking or a unit image&lt;br /&gt;
** '''unit''': the primary unit for the event is speaking&lt;br /&gt;
** '''second_unit''': the secondary unit for the event is speaking&lt;br /&gt;
&lt;br /&gt;
* '''message''': (translatable) the text to display to the right of the image. ''message'' is sometimes multiple lines; if it is, be sure to use quotes(''' ' ''' or ''' &amp;quot; ''')&lt;br /&gt;
* '''[show_if]''': if present then this message will only be displayed if the conditional statement in this tag is passed (see [[ConditionalActionsWML#Condition_Tags|ConditionalActionsWML]])&lt;br /&gt;
* '''side_for''': (default: all sides) comma-separated list of sides for who message is shown.&lt;br /&gt;
* '''image''': (default: profile image of speaker) the image to display next to the message. Append ~RIGHT() if you want the image to appear on the right side.&lt;br /&gt;
* '''caption''': (default: name of speaker) the caption to display beside the image. Name to be displayed. Note: use a translation mark to avoid wmllint errors.&lt;br /&gt;
* '''scroll''': Boolean specifying whether the game view should scroll to the speaking unit. Defaults to ''yes''.&lt;br /&gt;
* '''duration''': (default: 10) the minimum number of frames for this message to be displayed. (A frame lasts about 30 milliseconds.) During this time any dialog decisions will be disregarded.&lt;br /&gt;
* '''sound''': a sound effect (wav file) to play as the message is displayed. This can be a comma-separated list, from which one will be randomly chosen.&lt;br /&gt;
* '''[option]''': No '''[option]''' elements have to be used. If '''[option]''' elements are present, then each option will be displayed in a menu for the user to select one option.&lt;br /&gt;
** '''message''': (translatable) the text displayed for the option (see [[DescriptionWML]])&lt;br /&gt;
** '''[show_if]''': if present then this option will only be displayed if the conditional statement in this tag is passed (see [[ConditionalActionsWML#Condition_Tags|ConditionalActionsWML]])&lt;br /&gt;
** '''[command]''': an element containing actions which are executed if the option is selected.&lt;br /&gt;
* '''[text_input]''': there can be only one [text_input] tag. this adds a text input field to the message.&lt;br /&gt;
** '''variable''': the variable that the user's input will be written to&lt;br /&gt;
** '''label''': a text label to the left of the input field&lt;br /&gt;
** '''max_length''': the maximum number of characters that may be typed into the field&lt;br /&gt;
** '''text''': text that is written into the field in the beginning&lt;br /&gt;
* Check [[EventWML#Multiplayer_safety]] to find out in which events you can safely use '''[option]''' and '''[text_input]''' without causing OOS.&lt;br /&gt;
&lt;br /&gt;
=== Formatting ===&lt;br /&gt;
In 1.8, [http://developer.gnome.org/pango/unstable/PangoMarkupFormat.html Pango markup formatting codes] have been adopted for '''[message]'''. These can also be used in unit names (user_description), objectives, and such. Note that you'll probably want to use a single quote ' instead of a double quote &amp;quot; as double quotes cannot be escaped, otherwise the string will appear fragmented and you may also encounter errors. Running wmllint on your campaign will up-convert it, warning you about unusual cases you must fix by hand.&lt;br /&gt;
&lt;br /&gt;
For example, if you wanted to write &amp;quot;You are victorious!&amp;quot; in large, italic, gold letters, you might write it this way:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;span color='#BCB088' size='large' font-style='italic'&amp;gt;You are victorious!&amp;lt;/span&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
These are the codes taken from the Pango markup formatting guide:&lt;br /&gt;
&lt;br /&gt;
*'''font''', '''font_desc''': A font description string, such as &amp;quot;Sans Italic 12&amp;quot;.&lt;br /&gt;
*'''font_family''', '''face''': A font family name.&lt;br /&gt;
*'''font_size''', '''size''': Font size in 1024ths of a point, or one of the absolute sizes 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', or one of the relative sizes 'smaller' or 'larger'.&lt;br /&gt;
*'''font_style''', '''style''': One of 'normal', 'oblique', 'italic'.&lt;br /&gt;
*'''font_weight''', '''weight''': One of 'ultralight', 'light', 'normal', 'bold', 'ultrabold', 'heavy', or a numeric weight.&lt;br /&gt;
*'''font_variant''', '''variant''': One of 'normal' or 'smallcaps'.&lt;br /&gt;
*'''font_stretch''', '''stretch''': One of 'ultracondensed', 'extracondensed', 'condensed', 'semicondensed', 'normal', 'semiexpanded', 'expanded', 'extraexpanded', 'ultraexpanded'.&lt;br /&gt;
*'''foreground''', '''fgcolor''', '''color''': An RGB color specification such as '#00FF00' or a color name such as 'red'.&lt;br /&gt;
*'''background, bgcolor''': An RGB color specification such as '#00FF00' or a color name such as 'red'.&lt;br /&gt;
*'''underline''': One of 'none', 'single', 'double', 'low', 'error'.&lt;br /&gt;
*'''underline_color''': The color of underlines; an RGB color specification such as '#00FF00' or a color name such as 'red'.&lt;br /&gt;
*'''rise''': Vertical displacement, in 10000ths of an em. Can be negative for subscript, positive for superscript.&lt;br /&gt;
*'''strikethrough''': 'true' or 'false' whether to strike through the text.&lt;br /&gt;
*'''strikethrough_color''': The color of strikethrough lines; an RGB color specification such as '#00FF00' or a color name such as 'red'&lt;br /&gt;
*'''fallback''': 'true' or 'false' whether to enable fallback. If disabled, then characters will only be used from the closest matching font on the system. No fallback will be done to other fonts on the system that might contain the characters in the text. Fallback is enabled by default. Most applications should not disable fallback.&lt;br /&gt;
*'''letter_spacing''': Inter-letter spacing in 1024ths of a point.&lt;br /&gt;
*'''gravity''': One of 'south', 'east', 'north', 'west', 'auto'.&lt;br /&gt;
*'''gravity_hint''': One of 'natural', 'strong', 'line'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In 1.6, Wesnoth uses older text formatting options&lt;br /&gt;
* A tilde (~) as the first character causes the line to be boldfaced.&lt;br /&gt;
* An at symbol (@) as the first character causes the line to be green, as done with victory conditions.&lt;br /&gt;
* A pound symbol (#) as the first character causes the line to be red, as done with defeat conditions.&lt;br /&gt;
* An asterisk (*) as the first character causes the line to be bigger.&lt;br /&gt;
* A backquote (`) as the first character causes the line to be smaller.&lt;br /&gt;
* If used, the caption key text is boldfaced.&lt;br /&gt;
* An RGB colour code in the beginning causes the line to be the given colour. This can still be preceded by the above characters. Example: ''message=_&amp;quot;&amp;lt;255,0,0&amp;gt;Red!&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
== [objectives] ==&lt;br /&gt;
The other tag used for plot development is '''[objectives]'''.&lt;br /&gt;
The '''[objectives]''' tag overwrites any previously set objectives,&lt;br /&gt;
and displays text which should describe the objectives of the scenario.&lt;br /&gt;
Scenario objectives are displayed on the player's first turn after the tag is used,&lt;br /&gt;
or as part of the event if it triggers during that player's turn.&lt;br /&gt;
Objectives can also be accessed at any time in a scenario using the&lt;br /&gt;
&amp;quot;Scenario Objectives&amp;quot; game menu option, making this tag useful for&lt;br /&gt;
scenario-specific information that the player may need to refer to during play.&lt;br /&gt;
&lt;br /&gt;
Attributes of '''[objectives]''':&lt;br /&gt;
* '''side''': Default '0'. The side to set the objectives for. A value of 0 sets objectives for all sides. note: There are side-specific objectives and default objectives, which are used in case a side doesn't have specific ones. Specifying 0 sets the default ones.&lt;br /&gt;
* '''[[StandardSideFilter]]''' {{DevFeature1.11}} tags and keys: Sets the objectives of all matching sides to these passed specifications (the rest of this [objectives] tag). If no sides (such as when passing side=0) or all sides match, sets the default objectives, and the side specific ones for the matching sides otherwise.&lt;br /&gt;
* '''bullet''': Default '• '. Replaces the default bullet, with whatever is passed, for all objectives, gold carryover notes, and notes defined with [note].&lt;br /&gt;
* '''summary''': Displayed first in the objectives text, this should describe the basic objective for the overall scenario.  Can be omitted.&lt;br /&gt;
* '''note''': Displayed last in the objectives text, this is sometimes used for hints or additional information.  Can be omitted.&lt;br /&gt;
* '''victory_string''': Default ' _ &amp;quot;Victory:&amp;quot;', this text precedes the victory objectives.&lt;br /&gt;
* '''defeat_string''': Default ' _ &amp;quot;Defeat:&amp;quot;', this text precedes the defeat objectives.&lt;br /&gt;
* '''gold_carryover_string''': Default ' _ &amp;quot;Gold carryover:&amp;quot;', this text precedes the gold carryover information.&lt;br /&gt;
* '''notes_string''': Default ' _ &amp;quot;Notes:&amp;quot;', this text precedes the notes.&lt;br /&gt;
* '''silent''': Default: not present. If set to &amp;quot;yes&amp;quot;, the objectives are silently changed. Else, they will be shown to the user when appropriate.&lt;br /&gt;
&lt;br /&gt;
Tags of '''[objectives]''':&lt;br /&gt;
* '''[objective]''': describes a win or loss condition. Most scenarios have multiple win or loss conditions, so use a separate [objective] subtag for each line; this helps with translations.&lt;br /&gt;
** '''bullet''': Default '• ' or whatever is set in the parent [objectives] block. Replaces the default bullet, with whatever is provided, for the objective defined by the [objective] block.&lt;br /&gt;
** '''red''': Default '0' for winning objectives, '255' for losing objectives. Overrides the default red coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''green''': Default '255' for winning objectives, '0' for losing objectives. Overrides the default green coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''blue''': Default '0'. Overrides the default blue coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''description''': text for the specific win or loss condition.&lt;br /&gt;
** '''condition''': The color and placement of the text. Values are 'win'(colored green, placed after ''victory_string'') and 'lose'(colored red, placed after ''defeat_string'')&lt;br /&gt;
** '''show_turn_counter''': If set to yes, displays the number of turns remaining in the scenario. Default is no.&lt;br /&gt;
** '''[show_if]''': A condition that disables the objective if it doesn't hold. Conditional objectives are refreshed at '''[show_objectives]''' time only.&lt;br /&gt;
* '''[gold_carryover]''': describes how the gold carryover works in this scenario. This is intended to be a more convenient way of displaying carryover information than using the note= key in [objectives].&lt;br /&gt;
** '''bullet''': Default '• ' or whatever is set in the parent [objectives] block. Replaces the default bullet with whatever is provided.&lt;br /&gt;
** '''red''': Default '255'. Overrides the default red coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''green''': Default '255'. Overrides the default green coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''blue''': Default '192'. Overrides the default blue coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''bonus''' (boolean): whether an early finish bonus is granted. If omitted, early finish bonus is not mentioned.&lt;br /&gt;
** '''carryover_percentage''': the amount of carryover gold. If omitted, the amount is not mentioned.&lt;br /&gt;
* '''[note]''': describes a note, usually used for hints or additional information. This is an easier way of adding several notes than concatenating them together into a single string to use with the ''note='' key.&lt;br /&gt;
** '''bullet''': Default '• ' or whatever is set in the parent [objectives] block. Replaces the default bullet with whatever is provided for the note defined by the [note] block.&lt;br /&gt;
** '''red''': Default '255'. Overrides the default red coloring of the entire note, including the bullet.&lt;br /&gt;
** '''green''': Default '255'. Overrides the default green coloring of the entire note, including the bullet.&lt;br /&gt;
** '''blue''': Default '255'. Overrides the default blue coloring of the entire note, including the bullet.&lt;br /&gt;
** '''description''': the text of the note.&lt;br /&gt;
** {{DevFeature1.11}} '''[show_if]''': The note will not be shown if the specified condition isn't met. Conditional notes are refreshed at '''[show_objectives]''' time only.&lt;br /&gt;
&lt;br /&gt;
== [set_menu_item] ==&lt;br /&gt;
This tag is used to add a custom option in the right-click context menu which can then be used to trigger arbitrary WML commands.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Due to limitations in portable devices where there are no scroll bars for context menus, there is a hard-coded limit of 7 custom WML menu items. If you really need to have more than 7 menu items, try combining some of them in a submenu.&lt;br /&gt;
&lt;br /&gt;
* '''id''': the unique id for this menu item. If a menu item with this id already exists, it allows you to set specific changes to that item.&lt;br /&gt;
* '''description''': the in-game text that will appear for this item in the menu.&lt;br /&gt;
* '''image''': the image to display next to this item.&lt;br /&gt;
* '''needs_select''': if ''yes'' (default ''no''), then the latest select event (see [[EventWML]]) that triggered before this menu item was chosen will be transmitted over the network before this menu item action will be. This only has any effect in networked multiplayer, and is intended to allow more elaborate menu item behaviour there without causing out of sync errors. If you don't know what this means, just leave it false.&lt;br /&gt;
* '''[show_if]''': If present, the menu item will only be available if the conditional statement (see [[ConditionalActionsWML#Condition_Tags|ConditionalActionsWML]]) within evaluates to true. When this is evaluated, the WML variables ''$x1'' and ''$y1'' will point to the location on which the context menu was invoked, so it's possible to for example only enable the option on empty hexes or on a particular unit.&lt;br /&gt;
* '''[filter_location]''': contains a location filter similar to the one found inside Single Unit Filters (see [[FilterWML]]). The menu item will only be available on matching locations.&lt;br /&gt;
* '''[command]''': contains the WML actions to be executed when the menu item is selected. Again, the WML variables ''$x1'' and ''$y1'' will point to the location on which the context menu was invoked on.&lt;br /&gt;
** '''delayed_variable_substitution ''' {{DevFeature1.11}} (boolean yes|no, default: yes): If no, forces a variable substitution run onto the wml included in this [command] block. Use this, if you want variables which are to substitute to get the values they have at execution time of the event where this set_menu_item appears. Other than that, they get the values they have at invocation time of the menu item.&lt;br /&gt;
&lt;br /&gt;
== [clear_menu_item] ==&lt;br /&gt;
{{DevFeature1.11}}&lt;br /&gt;
&lt;br /&gt;
Removes a menu item from the scenario.&lt;br /&gt;
Normally menu items are, including all their defining wml, automatically carried over between scenarios. This tag prevents this. (The behavior is comparable to set_variable/clear_variable).&lt;br /&gt;
* '''id''': (string): id of the menu item to clear. Can be a comma-separated list.&lt;br /&gt;
&lt;br /&gt;
== Other interface tags ==&lt;br /&gt;
&lt;br /&gt;
The following tags are also action tags:&lt;br /&gt;
=== [item] ===&lt;br /&gt;
Makes a graphical item appear on a certain hex. Note this only places the graphics for an item. It does not make the item do anything. Use a moveto event to make moving onto the item do something. &amp;lt;tt&amp;gt;''('''Hint:''' There are a number of predefined items that are used in various campaigns that you can make use of. You can find [http://www.wesnoth.org/macro-reference.xhtml#file:items.cfg a list of them] if you look into the items.cfg file in the wesnoth install directory (under /data/core/macros).)''&amp;lt;/tt&amp;gt;&lt;br /&gt;
* '''x''', '''y''': the location to place the item. (only for [event][item]: full [[StandardLocationFilter|SLF]] support)&lt;br /&gt;
* '''image''': the image (in ''images/'' as .png) to place on the hex. This image is aligned with the top-left of the hex (which is 72 pixels wide and 72 pixels tall). It is drawn underneath units. ''('''Hint:''' If using an image smaller than 72x72, then it might be useful to [[ImagePathFunctionWML#Blit_Function|BLIT]] the image onto &amp;lt;tt&amp;gt;misc/blank-hex.png&amp;lt;/tt&amp;gt; (a blank 72x72 image).)''&lt;br /&gt;
* '''halo''': an image to place centered on the hex. It is drawn on top of units. Use this instead of ''image'' if the image is bigger than the hex or if you want to animate an image.&lt;br /&gt;
''Example (where the integer after the colon is the duration of each frame or suqare bracket expansion as per AnimationWML is used): halo=scenery/fire1.png:100,scenery/fire2.png:100,scenery/fire3.png:100,scenery/fire4.png:100,scenery/fire5.png:100,scenery/fire6.png:100,scenery/fire7.png:100,scenery/fire8.png:100&lt;br /&gt;
or equivalently:&lt;br /&gt;
halo=scenery/fire[1-8].png:100''&lt;br /&gt;
* '''team_name''': name of the team for which the item is to be displayed (hidden for others). For multiple teams just put all the names in one string, for example separated by commas.&lt;br /&gt;
* '''visible_in_fog''': whether the item should be visible through fog or not. Default yes.&lt;br /&gt;
* '''redraw''': {{DevFeature1.11}}(boolean yes|no, default: yes): If no, disables implicit calls to [[InterfaceActionsWML#.5Bredraw.5D|[redraw]]] when placing the items.&lt;br /&gt;
&lt;br /&gt;
=== [remove_item] ===&lt;br /&gt;
Removes any graphical items on a given hex.&lt;br /&gt;
* [[StandardLocationFilter]]: the hexes to remove items off&lt;br /&gt;
* '''image''' if specified, only removes the given image item (This image name must include any [[ImagePathFunctionWML|image path functions]] appended to the original image name.)&lt;br /&gt;
&lt;br /&gt;
=== [print] ===&lt;br /&gt;
Displays a message across the screen. The message will disappear after a certain time.&lt;br /&gt;
* '''text''': (translatable) the text to display.&lt;br /&gt;
* '''size''': (default=12) the pointsize of the font to use&lt;br /&gt;
* '''duration''': (default=50) the length of time to display the text for. This is measured in the number of 'frames'. A frame in Wesnoth is usually displayed for around 30ms.&lt;br /&gt;
* '''red''', '''green''', '''blue''': (default=0,0,0) the color to display the text in. Values vary from 0-255.&lt;br /&gt;
=== [move_unit_fake] ===&lt;br /&gt;
Moves an image of a unit along a certain path on the map. The path does not need to be a continuous list of adjacent hexes, so for example only the start and end points can be given, in which case the straightest line between those points will be calculated and used.&lt;br /&gt;
* '''type''': the type of the unit whose image to use&lt;br /&gt;
* '''x''': a comma-separated list of x locations to move along&lt;br /&gt;
* '''y''': a comma-separated list of y locations to move along (x and y values are matched pairs)&lt;br /&gt;
* '''side''': the side of the fake unit, used for team-coloring the fake unit&lt;br /&gt;
* '''gender''': the gender of the fake unit. Example: gender=female&lt;br /&gt;
* '''variation''': the variation of the fake unit. Example: variation=undead&lt;br /&gt;
* '''image_mods''': [[ImagePathFunctionWML|image path functions]] sequence to be applied on the fake unit.&lt;br /&gt;
=== [move_units_fake] ===&lt;br /&gt;
moves multiple images of units along paths on the map. These units are moved in lockstep.&lt;br /&gt;
* '''[fake_unit]''': A fake unit to move&lt;br /&gt;
** '''type''': the type of unit whose image to use&lt;br /&gt;
** '''x''': a comma-separated list of x locations to move along&lt;br /&gt;
** '''y''': a comma-separated list of y locations to move along (x and y values are matched pairs)&lt;br /&gt;
** '''side''': the side of the fake unit, used for team-coloring the fake unit&lt;br /&gt;
** '''skip_steps''': the number of steps to skip before this unit starts moving&lt;br /&gt;
=== [hide_unit] ===&lt;br /&gt;
Temporarily prevents the engine from displaying the given unit. The unit does not become invisible, as it would be with the '''[hides]''' ability; it is still the same plain unit, but without an image. Useful in conjunction with '''[move_unit_fake]''': to move a leader unit into position on-screen. Until 1.8 each '''[hide_unit]''' tag only hides one unit.&lt;br /&gt;
* [[StandardUnitFilter]]: All matching units will be hidden&lt;br /&gt;
&lt;br /&gt;
=== [unhide_unit] ===&lt;br /&gt;
Stops the currently hidden units from being hidden.&lt;br /&gt;
* [[StandardUnitFilter]]: Only the matching units will be unhidden&lt;br /&gt;
&lt;br /&gt;
=== [lock_view] ===&lt;br /&gt;
{{DevFeature1.11}} Locks gamemap view scrolling for human players, so they cannot scroll the gamemap view until it is unlocked. WML or Lua actions such as '''[scroll_to]''' will continue to work normally, as they ignore this restriction; the locked/unlocked state is preserved when saving the current game.&lt;br /&gt;
&lt;br /&gt;
This feature is generally intended to be used in cutscenes to prevent the player scrolling away from scripted actions. &lt;br /&gt;
&lt;br /&gt;
=== [unlock_view] ===&lt;br /&gt;
{{DevFeature1.11}} Unlocks gamemap view scrolling for human players.&lt;br /&gt;
&lt;br /&gt;
=== [scroll] ===&lt;br /&gt;
Scroll a certain number of pixels in a given direction. Useful for earthquake/shaking effects.&lt;br /&gt;
* '''x''', '''y''': the number of pixels to scroll along the x and y axis&lt;br /&gt;
=== '''[scroll_to]''' ===&lt;br /&gt;
Scroll to a given hex&lt;br /&gt;
* '''x''', '''y''': the hex to scroll to&lt;br /&gt;
* {{DevFeature1.11}} [[StandardLocationFilter]], do not use a [filter_location] sub-tag. If more than one location matches the filter, only the first matching location will be used.&lt;br /&gt;
* '''check_fogged''': whether to scroll even to locations covered in fog or shroud. Possible values ''true'' (don't scroll to fog) and ''false'' (scroll even to fog), with ''false'' as the default.&lt;br /&gt;
* {{DevFeature1.11}} '''immediate''': whether to instantly warp to the target hex regardless of the scroll speed setting in Preferences (defaults to ''false'').&lt;br /&gt;
&lt;br /&gt;
=== [scroll_to_unit] ===&lt;br /&gt;
Scroll to a given unit&lt;br /&gt;
* [[StandardUnitFilter]]&lt;br /&gt;
* '''check_fogged''': whether to scroll even to locations covered in fog or shroud. Possible values ''true'' (don't scroll to fog) and ''false'' (scroll even to fog), with ''false'' as the default.&lt;br /&gt;
* {{DevFeature1.11}} '''immediate''': whether to instantly warp to the target hex regardless of the scroll speed setting in Preferences (defaults to ''false'').&lt;br /&gt;
=== [select_unit] ===&lt;br /&gt;
Selects a given unit.&lt;br /&gt;
* [[StandardUnitFilter]]: The first unit found will be selected.&lt;br /&gt;
* '''fire_event''': whether a ''select'' event should be triggered or not (def. ''no''). (Note that select events aren't multiplayer save.)&lt;br /&gt;
* '''highlight''': whether the unit's current hex should be highlighted (def. ''yes'').&lt;br /&gt;
&lt;br /&gt;
=== [sound]===&lt;br /&gt;
Plays a sound&lt;br /&gt;
* '''name''': the filename of the sound to play (in ''sounds/'' as .wav or .ogg)&lt;br /&gt;
* '''repeat''': repeats the sound for a specified additional number of times (default=0)&lt;br /&gt;
=== [sound_source] ===&lt;br /&gt;
Creates a sound source. &amp;quot;Sound sources&amp;quot; is a general name for a mechanism which makes possible for map elements to emit sounds according to some rules, where &amp;quot;map elements&amp;quot; can be specific locations or terrain types. For now, only sound sources tied to locations are supported.&lt;br /&gt;
* '''id''': a unique identification key of the sound source&lt;br /&gt;
* '''sounds''': a list of comma separated, randomly played sounds associated with the sound source&lt;br /&gt;
* '''delay''': a numerical value (in milliseconds) of the minimal delay between two playbacks of the source's sound if the source remains visible on the screen; if one scrolls out and back in, the source will be considered as ready to play&lt;br /&gt;
* '''chance''': a percentage (a value from 0 to 100) describing the chance of the source being activated every second after the delay has passed or when the source's location appears on the screen (note that it cannot play more than one file at the same time)&lt;br /&gt;
* '''check_fogged''': possible values &amp;quot;true&amp;quot; and &amp;quot;false&amp;quot; - if true the source will not play if its locations are fogged&lt;br /&gt;
* '''check_shrouded''': possible values &amp;quot;true&amp;quot; and &amp;quot;false&amp;quot; - if true the source will not play if its locations are shrouded&lt;br /&gt;
* '''x,y''': similar to x,y as found in a [[StandardLocationFilter]], these are the locations associated with the sound source&lt;br /&gt;
* '''fade_range''' (default = 3): distance in hexes that determines a &amp;quot;circular&amp;quot; area around the one specified by '''full_range''' where sound volume fades out linearly&lt;br /&gt;
* '''full_range''' (default = 14): distance in hexes that determines a &amp;quot;circular&amp;quot; area where source plays with full volume, relative to screen center&lt;br /&gt;
* '''loop''': number of times a sound sample should be looped if it stays visible. -1 means infinite (~65000)&lt;br /&gt;
&lt;br /&gt;
=== [remove_sound_source] ===&lt;br /&gt;
Removes a previously defined sound source.&lt;br /&gt;
* '''id''': the identification key of the sound source to remove&lt;br /&gt;
&lt;br /&gt;
=== [music]===&lt;br /&gt;
Switches to playing different music&lt;br /&gt;
* '''name''': the filename of the music to play (in ''music/'' as .ogg)&lt;br /&gt;
* see [[MusicListWML]] for the correct syntax&lt;br /&gt;
===[volume]===&lt;br /&gt;
Changes the game volume to a percent of the preferences volume for the game being played. Values can go from 0 to 100:  &lt;br /&gt;
* '''music''':  Changes the music volume.&lt;br /&gt;
* '''sound''':  Changes the sound volume.&lt;br /&gt;
=== [color_adjust]===&lt;br /&gt;
Tints the color of the screen.&lt;br /&gt;
* '''red''', '''green''', '''blue''': values from -255 to 255, the amount to tint by for each color&lt;br /&gt;
=== [delay] ===&lt;br /&gt;
Pauses the game.&lt;br /&gt;
* '''time''': the time to pause in milliseconds&lt;br /&gt;
=== [redraw] ===&lt;br /&gt;
Redraws the screen (this normally isn't done during events, although some of the other interface actions cause the screen or parts of it to be redrawn).&lt;br /&gt;
* '''clear_shroud''' (boolean yes|no, default no): If yes, clears fog and shroud around existing units. Useful if you, for example, spawn friendly units in the middle of an event and want the shroud to update accordingly (otherwise units that spawn inside fog would remain invisible for the duration of the event, since the fog would not automatically get cleared around them).&lt;br /&gt;
* '''[[StandardSideFilter]]''': the sides for which to recalculate fog and shroud.&lt;br /&gt;
* '''side''': If used (forces clear_shroud=yes), clears fog and shroud for that side.&lt;br /&gt;
&lt;br /&gt;
=== [unit_overlay] ===&lt;br /&gt;
Sets an image that will be drawn over a particular unit, and follow it around&lt;br /&gt;
* [[StandardUnitFilter]]: All matching units will get the overlay (do not use [filter])&lt;br /&gt;
* '''image''': the image to place on the unit&lt;br /&gt;
&lt;br /&gt;
=== [remove_unit_overlay] ===&lt;br /&gt;
removes a particular overlayed image from a unit&lt;br /&gt;
* [[StandardUnitFilter]]: The overlay will get removed from all matching units (do not use [filter])&lt;br /&gt;
* '''image''': the image to remove from the unit&lt;br /&gt;
&lt;br /&gt;
=== [animate_unit] ===&lt;br /&gt;
Uses an animation of a unit to animate it on screen (if the unit has the corresponding animation).&lt;br /&gt;
* '''flag''': The key to find the custom animation in the unit description (see the '''[extra_anim]''' description in [[AnimationWML]]). Standard animations can be triggered with the following keywords: ''leading recruited standing idling levelout levelin healing healed poisoned movement defend attack death victory pre_teleport post_teleport''&lt;br /&gt;
* '''[filter]''' with a [[StandardUnitFilter]] as argument, see [[FilterWML]]. By default, the unit at the event location will be animated. You can use this tag to choose any other unit to animate.&lt;br /&gt;
* '''[primary_attack]''': If this tag is not present, the filter for animation will be triggered with no attack. If it is here, all attacks from the unit will be filtered, and a matching one will be used to filter the animation. Takes a weapon filter as argument, see [[FilterWML]].&lt;br /&gt;
* '''[secondary_attack]''': Similar to '''[primary_attack]'''. May be needed to trigger a defense animation correctly, if there are more than one animations available for the defending unit.&lt;br /&gt;
* '''hits''': yes/no/hit/miss/kill: which according variation of a attack/defense animation shall be chosen (required)&lt;br /&gt;
* '''text''': a text to hover during the animation &lt;br /&gt;
* '''red''': red value for the text color (0-255)&lt;br /&gt;
* '''green''': green value for the text color&lt;br /&gt;
* '''blue''': blue value for the text color&lt;br /&gt;
* '''with_bars''': yes/no: whether to display the status bars during the animation (e.g. the hitpoint bar)&lt;br /&gt;
* '''[animate]''': a sub block with the same syntax as '''[animate_unit]''' except that the '''[filter]''' block is mandatory to find the unit. This block will find and animate another unit simultaneously.&lt;br /&gt;
* '''[facing]''': a [[StandardLocationFilter]] specifying what direction the unit should be facing when animated&lt;br /&gt;
&lt;br /&gt;
=== [label] ===&lt;br /&gt;
Places a label on the map.&lt;br /&gt;
* '''x''', '''y''': the location of the label&lt;br /&gt;
* '''text''': what the label should say&lt;br /&gt;
* '''team_name''': if specified, the label will only be visible to the given team.&lt;br /&gt;
* '''color''': color of the label. The format is r,g,b; r, g and b are numbers between 0 and 255.&lt;br /&gt;
* '''visible_in_fog''': whether the label should be visible through fog or not. Default yes.&lt;br /&gt;
* '''visible_in_shroud''': whether the label should be visible through shroud or not. Default no.&lt;br /&gt;
* '''immutable''': whether this label is protected from being removed or changed by players. Default yes.&lt;br /&gt;
=== [floating_text]===&lt;br /&gt;
Floats text (similar to the damage and healing numbers) on the given locations.&lt;br /&gt;
* [[StandardLocationFilter]]: the text will be floated on all matching locations simultaneously.&lt;br /&gt;
* '''text''': the text to display.&lt;br /&gt;
&lt;br /&gt;
The default text color is &amp;lt;span style=&amp;quot;color: #6b8cff;&amp;quot;&amp;gt;'''#6b8cff'''&amp;lt;/span&amp;gt;. To change the color, use [[#Formatting|Pango markup]]. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Float some golden yellow text at 20,20.&lt;br /&gt;
[floating_text]&lt;br /&gt;
   x,y=20,20&lt;br /&gt;
   text=&amp;quot;&amp;lt;span color='#cccc33'&amp;gt;&amp;quot; + _ &amp;quot;Your text here&amp;quot; + &amp;quot;&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
[/floating_text]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [deprecated_message] ===&lt;br /&gt;
Shows a deprecated message in the message area, this feature is only intended to be used to warn about deprecated macros in mainline. The message is not translatable.&lt;br /&gt;
* '''message''': the message to show.&lt;br /&gt;
=== [wml_message] ===&lt;br /&gt;
Outputs a message to Wesnoth's console output. Intended for campaign designers to output silent text to the console, without annoying the player; then, that text might contain information useful for later bug-reporting. The log domain for it is '''wml''', and the '''debug/dbg''' log level is available for use with the '''logger''' attribute. Depending on the current log level ('''error''' by default), which may be changed with the in-game :log command, or the --log-&amp;lt;level&amp;gt;=wml command line switch, the messages are echoed to the in-game chat.&lt;br /&gt;
* '''message''': the message to show.&lt;br /&gt;
* '''logger''': the Wesnoth engine output logger that should catch the text; this might be 'err' (the errors log level), 'warn'/'wrn' (the warnings log level) or anything else (the information log level). Not all information will be displayed depending on the log level chosen when starting Wesnoth.&lt;br /&gt;
&lt;br /&gt;
Note: As of 1.9.4/1.9.5 (r48805) the following &amp;quot;loggers&amp;quot; should work: If in [wml_message]: err/error, warn/wrn/warning, debug/dbg; using the :log command: Only the long forms error, warning, info and debug (this part gathered by trying rather than source inspecting). The long forms are most likely also the only ones working when starting wesnoth with --log-&amp;lt;level&amp;gt;=wml.&lt;br /&gt;
For log level warning or error (as during normal play), only wml_messages with logger error or warning display (for both). With logger info or debug, additionally wml_messages with logger info or debug display (for both).&lt;br /&gt;
&lt;br /&gt;
=== [open_help] ===&lt;br /&gt;
Opens the in-game help.&lt;br /&gt;
* '''topic''': the id of the topic to open&lt;br /&gt;
=== [show_objectives] ===&lt;br /&gt;
refreshes the objectives defined by [objectives] and its [show_if] tags, and displays them. (It is also called whenever the user explicitly asks for the objectives; this matters only if the tag was overridden by a [[LuaWML#register_wml_action|Lua]] script.)&lt;br /&gt;
* '''side''': the side to show the objectives. If not set, all sides are used.&lt;br /&gt;
* '''[[StandardSideFilter]]''' {{DevFeature1.11}} tags and keys: Tag affects the matching sides instead of just all or the one given by the integer value of the side= key.&lt;br /&gt;
&lt;br /&gt;
=== [chat] ===&lt;br /&gt;
Displays a message in the chat area.&lt;br /&gt;
* '''speaker''': (default=&amp;quot;WML&amp;quot;) A string for the name of the sender of the message.&lt;br /&gt;
* '''message''': The message that should be displayed.&lt;br /&gt;
* '''[[StandardSideFilter]]''' tags and keys as argument; if the same client controls multiple sides that match, then the message will only be displayed once.&lt;br /&gt;
&lt;br /&gt;
== Useful Macros ==&lt;br /&gt;
There are some predefined macros that you find useful for interface actions. You can find a complete list along with a detailed explanation of how they work [http://www.wesnoth.org/macro-reference.xhtml here].&lt;br /&gt;
* '''{HIGHLIGHT_UNIT}''' Highlight a unit on the map. Use this to show important units&lt;br /&gt;
* '''{HIGHLIGHT_IMAGE}''' Places and highlights an image on the map. Use this to show important items or locations&lt;br /&gt;
* '''{SET_IMAGE}''' Places an image on the map which has no other function.&lt;br /&gt;
* '''{QUAKE &amp;lt;soundfile&amp;gt;}''' Creates a tremor-like screenshake and plays &amp;lt;soundfile&amp;gt;. For example, '''{QUAKE (rumble.ogg)}'''.&lt;br /&gt;
* '''{FLASH_WHITE}''' Flash the screen white momentarily. You can also replace WHITE with RED, BLUE or GREEN for a different colour.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[DirectActionsWML]]&lt;br /&gt;
* [[InternalActionsWML]]&lt;br /&gt;
* [[EventWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;br /&gt;
[[Category: ActionsWML]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=InterfaceActionsWML&amp;diff=48428</id>
		<title>InterfaceActionsWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=InterfaceActionsWML&amp;diff=48428"/>
		<updated>2013-01-27T09:07:21Z</updated>

		<summary type="html">&lt;p&gt;Coffee: /* [item] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
== Interface actions ==&lt;br /&gt;
&lt;br /&gt;
Part of [[ActionWML]], interface actions are actions that do not have a direct effect on gameplay;&lt;br /&gt;
instead, they show something to the player.  The main interface tags&lt;br /&gt;
are '''[message]''' and '''[objectives]''', but several other tags affect&lt;br /&gt;
the interface also.&lt;br /&gt;
&lt;br /&gt;
== [inspect] ==&lt;br /&gt;
This user interface action only works in debug mode. It displays the gamestate inspector dialog (the same one which can be brought up with '':inspect'' ), which can be used to inspect the values of WML variables, AI configuration, recall lists, and more.&lt;br /&gt;
&lt;br /&gt;
* '''name''': optional attribute to specify the name of this gamestate inspector dialog. It is just a label to help differentiate between different invocations of gamestate inspector dialog.&lt;br /&gt;
&lt;br /&gt;
== [message] ==&lt;br /&gt;
The most commonly used interface action is [message], which displays a message to the user in a dialog box. It can also be used to take input from the user.&lt;br /&gt;
&lt;br /&gt;
The following key/tags are accepted for [message]:&lt;br /&gt;
* [[StandardUnitFilter]]: The unit whose profile and name are displayed. Do not use a [filter] tag. If no unit matching this filter is found, the message is not displayed (The unit has probably been killed).&amp;lt;br&amp;gt;'''[message]''' elements should be constructed so that it is either guaranteed that a certain unit is alive, or so that dialog flows smoothly even if the message isn't displayed.&lt;br /&gt;
&lt;br /&gt;
* '''speaker''': an alternative to standard unit filter. You may specify as the value of the speaker attribute a unit id or any of the following special values:&lt;br /&gt;
** '''narrator''': the dialog box is displayed without a caption for the unit speaking or a unit image&lt;br /&gt;
** '''unit''': the primary unit for the event is speaking&lt;br /&gt;
** '''second_unit''': the secondary unit for the event is speaking&lt;br /&gt;
&lt;br /&gt;
* '''message''': (translatable) the text to display to the right of the image. ''message'' is sometimes multiple lines; if it is, be sure to use quotes(''' ' ''' or ''' &amp;quot; ''')&lt;br /&gt;
* '''[show_if]''': if present then this message will only be displayed if the conditional statement in this tag is passed (see [[ConditionalActionsWML#Condition_Tags|ConditionalActionsWML]])&lt;br /&gt;
* '''side_for''': (default: all sides) comma-separated list of sides for who message is shown.&lt;br /&gt;
* '''image''': (default: profile image of speaker) the image to display next to the message. Append ~RIGHT() if you want the image to appear on the right side.&lt;br /&gt;
* '''caption''': (default: name of speaker) the caption to display beside the image. Name to be displayed. Note: use a translation mark to avoid wmllint errors.&lt;br /&gt;
* '''scroll''': Boolean specifying whether the game view should scroll to the speaking unit. Defaults to ''yes''.&lt;br /&gt;
* '''duration''': (default: 10) the minimum number of frames for this message to be displayed. (A frame lasts about 30 milliseconds.) During this time any dialog decisions will be disregarded.&lt;br /&gt;
* '''sound''': a sound effect (wav file) to play as the message is displayed. This can be a comma-separated list, from which one will be randomly chosen.&lt;br /&gt;
* '''[option]''': No '''[option]''' elements have to be used. If '''[option]''' elements are present, then each option will be displayed in a menu for the user to select one option.&lt;br /&gt;
** '''message''': (translatable) the text displayed for the option (see [[DescriptionWML]])&lt;br /&gt;
** '''[show_if]''': if present then this option will only be displayed if the conditional statement in this tag is passed (see [[ConditionalActionsWML#Condition_Tags|ConditionalActionsWML]])&lt;br /&gt;
** '''[command]''': an element containing actions which are executed if the option is selected.&lt;br /&gt;
* '''[text_input]''': there can be only one [text_input] tag. this adds a text input field to the message.&lt;br /&gt;
** '''variable''': the variable that the user's input will be written to&lt;br /&gt;
** '''label''': a text label to the left of the input field&lt;br /&gt;
** '''max_length''': the maximum number of characters that may be typed into the field&lt;br /&gt;
** '''text''': text that is written into the field in the beginning&lt;br /&gt;
* Check [[EventWML#Multiplayer_safety]] to find out in which events you can safely use '''[option]''' and '''[text_input]''' without causing OOS.&lt;br /&gt;
&lt;br /&gt;
=== Formatting ===&lt;br /&gt;
In 1.8, [http://developer.gnome.org/pango/unstable/PangoMarkupFormat.html Pango markup formatting codes] have been adopted for '''[message]'''. These can also be used in unit names (user_description), objectives, and such. Note that you'll probably want to use a single quote ' instead of a double quote &amp;quot; as double quotes cannot be escaped, otherwise the string will appear fragmented and you may also encounter errors. Running wmllint on your campaign will up-convert it, warning you about unusual cases you must fix by hand.&lt;br /&gt;
&lt;br /&gt;
For example, if you wanted to write &amp;quot;You are victorious!&amp;quot; in large, italic, gold letters, you might write it this way:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;span color='#BCB088' size='large' font-style='italic'&amp;gt;You are victorious!&amp;lt;/span&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
These are the codes taken from the Pango markup formatting guide:&lt;br /&gt;
&lt;br /&gt;
*'''font''', '''font_desc''': A font description string, such as &amp;quot;Sans Italic 12&amp;quot;.&lt;br /&gt;
*'''font_family''', '''face''': A font family name.&lt;br /&gt;
*'''font_size''', '''size''': Font size in 1024ths of a point, or one of the absolute sizes 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', or one of the relative sizes 'smaller' or 'larger'.&lt;br /&gt;
*'''font_style''', '''style''': One of 'normal', 'oblique', 'italic'.&lt;br /&gt;
*'''font_weight''', '''weight''': One of 'ultralight', 'light', 'normal', 'bold', 'ultrabold', 'heavy', or a numeric weight.&lt;br /&gt;
*'''font_variant''', '''variant''': One of 'normal' or 'smallcaps'.&lt;br /&gt;
*'''font_stretch''', '''stretch''': One of 'ultracondensed', 'extracondensed', 'condensed', 'semicondensed', 'normal', 'semiexpanded', 'expanded', 'extraexpanded', 'ultraexpanded'.&lt;br /&gt;
*'''foreground''', '''fgcolor''', '''color''': An RGB color specification such as '#00FF00' or a color name such as 'red'.&lt;br /&gt;
*'''background, bgcolor''': An RGB color specification such as '#00FF00' or a color name such as 'red'.&lt;br /&gt;
*'''underline''': One of 'none', 'single', 'double', 'low', 'error'.&lt;br /&gt;
*'''underline_color''': The color of underlines; an RGB color specification such as '#00FF00' or a color name such as 'red'.&lt;br /&gt;
*'''rise''': Vertical displacement, in 10000ths of an em. Can be negative for subscript, positive for superscript.&lt;br /&gt;
*'''strikethrough''': 'true' or 'false' whether to strike through the text.&lt;br /&gt;
*'''strikethrough_color''': The color of strikethrough lines; an RGB color specification such as '#00FF00' or a color name such as 'red'&lt;br /&gt;
*'''fallback''': 'true' or 'false' whether to enable fallback. If disabled, then characters will only be used from the closest matching font on the system. No fallback will be done to other fonts on the system that might contain the characters in the text. Fallback is enabled by default. Most applications should not disable fallback.&lt;br /&gt;
*'''letter_spacing''': Inter-letter spacing in 1024ths of a point.&lt;br /&gt;
*'''gravity''': One of 'south', 'east', 'north', 'west', 'auto'.&lt;br /&gt;
*'''gravity_hint''': One of 'natural', 'strong', 'line'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In 1.6, Wesnoth uses older text formatting options&lt;br /&gt;
* A tilde (~) as the first character causes the line to be boldfaced.&lt;br /&gt;
* An at symbol (@) as the first character causes the line to be green, as done with victory conditions.&lt;br /&gt;
* A pound symbol (#) as the first character causes the line to be red, as done with defeat conditions.&lt;br /&gt;
* An asterisk (*) as the first character causes the line to be bigger.&lt;br /&gt;
* A backquote (`) as the first character causes the line to be smaller.&lt;br /&gt;
* If used, the caption key text is boldfaced.&lt;br /&gt;
* An RGB colour code in the beginning causes the line to be the given colour. This can still be preceded by the above characters. Example: ''message=_&amp;quot;&amp;lt;255,0,0&amp;gt;Red!&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
== [objectives] ==&lt;br /&gt;
The other tag used for plot development is '''[objectives]'''.&lt;br /&gt;
The '''[objectives]''' tag overwrites any previously set objectives,&lt;br /&gt;
and displays text which should describe the objectives of the scenario.&lt;br /&gt;
Scenario objectives are displayed on the player's first turn after the tag is used,&lt;br /&gt;
or as part of the event if it triggers during that player's turn.&lt;br /&gt;
Objectives can also be accessed at any time in a scenario using the&lt;br /&gt;
&amp;quot;Scenario Objectives&amp;quot; game menu option, making this tag useful for&lt;br /&gt;
scenario-specific information that the player may need to refer to during play.&lt;br /&gt;
&lt;br /&gt;
Attributes of '''[objectives]''':&lt;br /&gt;
* '''side''': Default '0'. The side to set the objectives for. A value of 0 sets objectives for all sides. note: There are side-specific objectives and default objectives, which are used in case a side doesn't have specific ones. Specifying 0 sets the default ones.&lt;br /&gt;
* '''[[StandardSideFilter]]''' {{DevFeature1.11}} tags and keys: Sets the objectives of all matching sides to these passed specifications (the rest of this [objectives] tag). If no sides (such as when passing side=0) or all sides match, sets the default objectives, and the side specific ones for the matching sides otherwise.&lt;br /&gt;
* '''bullet''': Default '• '. Replaces the default bullet, with whatever is passed, for all objectives, gold carryover notes, and notes defined with [note].&lt;br /&gt;
* '''summary''': Displayed first in the objectives text, this should describe the basic objective for the overall scenario.  Can be omitted.&lt;br /&gt;
* '''note''': Displayed last in the objectives text, this is sometimes used for hints or additional information.  Can be omitted.&lt;br /&gt;
* '''victory_string''': Default ' _ &amp;quot;Victory:&amp;quot;', this text precedes the victory objectives.&lt;br /&gt;
* '''defeat_string''': Default ' _ &amp;quot;Defeat:&amp;quot;', this text precedes the defeat objectives.&lt;br /&gt;
* '''gold_carryover_string''': Default ' _ &amp;quot;Gold carryover:&amp;quot;', this text precedes the gold carryover information.&lt;br /&gt;
* '''notes_string''': Default ' _ &amp;quot;Notes:&amp;quot;', this text precedes the notes.&lt;br /&gt;
* '''silent''': Default: not present. If set to &amp;quot;yes&amp;quot;, the objectives are silently changed. Else, they will be shown to the user when appropriate.&lt;br /&gt;
&lt;br /&gt;
Tags of '''[objectives]''':&lt;br /&gt;
* '''[objective]''': describes a win or loss condition. Most scenarios have multiple win or loss conditions, so use a separate [objective] subtag for each line; this helps with translations.&lt;br /&gt;
** '''bullet''': Default '• ' or whatever is set in the parent [objectives] block. Replaces the default bullet, with whatever is provided, for the objective defined by the [objective] block.&lt;br /&gt;
** '''red''': Default '0' for winning objectives, '255' for losing objectives. Overrides the default red coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''green''': Default '255' for winning objectives, '0' for losing objectives. Overrides the default green coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''blue''': Default '0'. Overrides the default blue coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''description''': text for the specific win or loss condition.&lt;br /&gt;
** '''condition''': The color and placement of the text. Values are 'win'(colored green, placed after ''victory_string'') and 'lose'(colored red, placed after ''defeat_string'')&lt;br /&gt;
** '''show_turn_counter''': If set to yes, displays the number of turns remaining in the scenario. Default is no.&lt;br /&gt;
** '''[show_if]''': A condition that disables the objective if it doesn't hold. Conditional objectives are refreshed at '''[show_objectives]''' time only.&lt;br /&gt;
* '''[gold_carryover]''': describes how the gold carryover works in this scenario. This is intended to be a more convenient way of displaying carryover information than using the note= key in [objectives].&lt;br /&gt;
** '''bullet''': Default '• ' or whatever is set in the parent [objectives] block. Replaces the default bullet with whatever is provided.&lt;br /&gt;
** '''red''': Default '255'. Overrides the default red coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''green''': Default '255'. Overrides the default green coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''blue''': Default '192'. Overrides the default blue coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''bonus''' (boolean): whether an early finish bonus is granted. If omitted, early finish bonus is not mentioned.&lt;br /&gt;
** '''carryover_percentage''': the amount of carryover gold. If omitted, the amount is not mentioned.&lt;br /&gt;
* '''[note]''': describes a note, usually used for hints or additional information. This is an easier way of adding several notes than concatenating them together into a single string to use with the ''note='' key.&lt;br /&gt;
** '''bullet''': Default '• ' or whatever is set in the parent [objectives] block. Replaces the default bullet with whatever is provided for the note defined by the [note] block.&lt;br /&gt;
** '''red''': Default '255'. Overrides the default red coloring of the entire note, including the bullet.&lt;br /&gt;
** '''green''': Default '255'. Overrides the default green coloring of the entire note, including the bullet.&lt;br /&gt;
** '''blue''': Default '255'. Overrides the default blue coloring of the entire note, including the bullet.&lt;br /&gt;
** '''description''': the text of the note.&lt;br /&gt;
** {{DevFeature1.11}} '''[show_if]''': The note will not be shown if the specified condition isn't met. Conditional notes are refreshed at '''[show_objectives]''' time only.&lt;br /&gt;
&lt;br /&gt;
== [set_menu_item] ==&lt;br /&gt;
This tag is used to add a custom option in the right-click context menu which can then be used to trigger arbitrary WML commands.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Due to limitations in portable devices where there are no scroll bars for context menus, there is a hard-coded limit of 7 custom WML menu items. If you really need to have more than 7 menu items, try combining some of them in a submenu.&lt;br /&gt;
&lt;br /&gt;
* '''id''': the unique id for this menu item. If a menu item with this id already exists, it allows you to set specific changes to that item.&lt;br /&gt;
* '''description''': the in-game text that will appear for this item in the menu.&lt;br /&gt;
* '''image''': the image to display next to this item.&lt;br /&gt;
* '''needs_select''': if ''yes'' (default ''no''), then the latest select event (see [[EventWML]]) that triggered before this menu item was chosen will be transmitted over the network before this menu item action will be. This only has any effect in networked multiplayer, and is intended to allow more elaborate menu item behaviour there without causing out of sync errors. If you don't know what this means, just leave it false.&lt;br /&gt;
* '''[show_if]''': If present, the menu item will only be available if the conditional statement (see [[ConditionalActionsWML#Condition_Tags|ConditionalActionsWML]]) within evaluates to true. When this is evaluated, the WML variables ''$x1'' and ''$y1'' will point to the location on which the context menu was invoked, so it's possible to for example only enable the option on empty hexes or on a particular unit.&lt;br /&gt;
* '''[filter_location]''': contains a location filter similar to the one found inside Single Unit Filters (see [[FilterWML]]). The menu item will only be available on matching locations.&lt;br /&gt;
* '''[command]''': contains the WML actions to be executed when the menu item is selected. Again, the WML variables ''$x1'' and ''$y1'' will point to the location on which the context menu was invoked on.&lt;br /&gt;
** '''delayed_variable_substitution ''' {{DevFeature1.11}} (boolean yes|no, default: yes): If no, forces a variable substitution run onto the wml included in this [command] block. Use this, if you want variables which are to substitute to get the values they have at execution time of the event where this set_menu_item appears. Other than that, they get the values they have at invocation time of the menu item.&lt;br /&gt;
&lt;br /&gt;
== [clear_menu_item] ==&lt;br /&gt;
{{DevFeature1.11}}&lt;br /&gt;
&lt;br /&gt;
Removes a menu item from the scenario.&lt;br /&gt;
Normally menu items are, including all their defining wml, automatically carried over between scenarios. This tag prevents this. (The behavior is comparable to set_variable/clear_variable).&lt;br /&gt;
* '''id''': (string): id of the menu item to clear. Can be a comma-separated list.&lt;br /&gt;
&lt;br /&gt;
== Other interface tags ==&lt;br /&gt;
&lt;br /&gt;
The following tags are also action tags:&lt;br /&gt;
=== [item] ===&lt;br /&gt;
Makes a graphical item appear on a certain hex. Note this only places the graphics for an item. It does not make the item do anything. Use a moveto event to make moving onto the item do something. &amp;lt;tt&amp;gt;''('''Hint:''' There are a number of predefined items that are used in various campaigns that you can make use of. You can find [http://www.wesnoth.org/macro-reference.xhtml#file:items.cfg a list of them] if you look into the items.cfg file in the wesnoth install directory (under /data/core/macros).)''&amp;lt;/tt&amp;gt;&lt;br /&gt;
* '''x''', '''y''': the location to place the item. (only for [event][item]: full [[StandardLocationFilter|SLF]] support)&lt;br /&gt;
* '''image''': the image (in ''images/'' as .png) to place on the hex. This image is aligned with the top-left of the hex (which is 72 pixels wide and 72 pixels tall). It is drawn underneath units. ''('''Hint:''' If using an image smaller than 72x72, then it might be useful to [[ImagePathFunctionWML#Blit_Function|BLIT]] the image onto &amp;lt;tt&amp;gt;misc/blank-hex.png&amp;lt;/tt&amp;gt; (a blank 72x72 image).)''&lt;br /&gt;
* '''halo''': an image to place centered on the hex. It is drawn on top of units. Use this instead of ''image'' if the image is bigger than the hex or if you want to animate an image.&lt;br /&gt;
''Example (where the integer after the colon is the duration of each frame or suqare bracket expansion as per AnimationWML is used): halo=scenery/fire1.png:100,scenery/fire2.png:100,scenery/fire3.png:100,scenery/fire4.png:100,scenery/fire5.png:100,scenery/fire6.png:100,scenery/fire7.png:100,scenery/fire8.png:100''&lt;br /&gt;
or equivalently:&lt;br /&gt;
''halo=scenery/fire[1-8].png:100''&lt;br /&gt;
* '''team_name''': name of the team for which the item is to be displayed (hidden for others). For multiple teams just put all the names in one string, for example separated by commas.&lt;br /&gt;
* '''visible_in_fog''': whether the item should be visible through fog or not. Default yes.&lt;br /&gt;
* '''redraw''': {{DevFeature1.11}}(boolean yes|no, default: yes): If no, disables implicit calls to [[InterfaceActionsWML#.5Bredraw.5D|[redraw]]] when placing the items.&lt;br /&gt;
&lt;br /&gt;
=== [remove_item] ===&lt;br /&gt;
Removes any graphical items on a given hex.&lt;br /&gt;
* [[StandardLocationFilter]]: the hexes to remove items off&lt;br /&gt;
* '''image''' if specified, only removes the given image item (This image name must include any [[ImagePathFunctionWML|image path functions]] appended to the original image name.)&lt;br /&gt;
&lt;br /&gt;
=== [print] ===&lt;br /&gt;
Displays a message across the screen. The message will disappear after a certain time.&lt;br /&gt;
* '''text''': (translatable) the text to display.&lt;br /&gt;
* '''size''': (default=12) the pointsize of the font to use&lt;br /&gt;
* '''duration''': (default=50) the length of time to display the text for. This is measured in the number of 'frames'. A frame in Wesnoth is usually displayed for around 30ms.&lt;br /&gt;
* '''red''', '''green''', '''blue''': (default=0,0,0) the color to display the text in. Values vary from 0-255.&lt;br /&gt;
=== [move_unit_fake] ===&lt;br /&gt;
Moves an image of a unit along a certain path on the map. The path does not need to be a continuous list of adjacent hexes, so for example only the start and end points can be given, in which case the straightest line between those points will be calculated and used.&lt;br /&gt;
* '''type''': the type of the unit whose image to use&lt;br /&gt;
* '''x''': a comma-separated list of x locations to move along&lt;br /&gt;
* '''y''': a comma-separated list of y locations to move along (x and y values are matched pairs)&lt;br /&gt;
* '''side''': the side of the fake unit, used for team-coloring the fake unit&lt;br /&gt;
* '''gender''': the gender of the fake unit. Example: gender=female&lt;br /&gt;
* '''variation''': the variation of the fake unit. Example: variation=undead&lt;br /&gt;
* '''image_mods''': [[ImagePathFunctionWML|image path functions]] sequence to be applied on the fake unit.&lt;br /&gt;
=== [move_units_fake] ===&lt;br /&gt;
moves multiple images of units along paths on the map. These units are moved in lockstep.&lt;br /&gt;
* '''[fake_unit]''': A fake unit to move&lt;br /&gt;
** '''type''': the type of unit whose image to use&lt;br /&gt;
** '''x''': a comma-separated list of x locations to move along&lt;br /&gt;
** '''y''': a comma-separated list of y locations to move along (x and y values are matched pairs)&lt;br /&gt;
** '''side''': the side of the fake unit, used for team-coloring the fake unit&lt;br /&gt;
** '''skip_steps''': the number of steps to skip before this unit starts moving&lt;br /&gt;
=== [hide_unit] ===&lt;br /&gt;
Temporarily prevents the engine from displaying the given unit. The unit does not become invisible, as it would be with the '''[hides]''' ability; it is still the same plain unit, but without an image. Useful in conjunction with '''[move_unit_fake]''': to move a leader unit into position on-screen. Until 1.8 each '''[hide_unit]''' tag only hides one unit.&lt;br /&gt;
* [[StandardUnitFilter]]: All matching units will be hidden&lt;br /&gt;
&lt;br /&gt;
=== [unhide_unit] ===&lt;br /&gt;
Stops the currently hidden units from being hidden.&lt;br /&gt;
* [[StandardUnitFilter]]: Only the matching units will be unhidden&lt;br /&gt;
&lt;br /&gt;
=== [lock_view] ===&lt;br /&gt;
{{DevFeature1.11}} Locks gamemap view scrolling for human players, so they cannot scroll the gamemap view until it is unlocked. WML or Lua actions such as '''[scroll_to]''' will continue to work normally, as they ignore this restriction; the locked/unlocked state is preserved when saving the current game.&lt;br /&gt;
&lt;br /&gt;
This feature is generally intended to be used in cutscenes to prevent the player scrolling away from scripted actions. &lt;br /&gt;
&lt;br /&gt;
=== [unlock_view] ===&lt;br /&gt;
{{DevFeature1.11}} Unlocks gamemap view scrolling for human players.&lt;br /&gt;
&lt;br /&gt;
=== [scroll] ===&lt;br /&gt;
Scroll a certain number of pixels in a given direction. Useful for earthquake/shaking effects.&lt;br /&gt;
* '''x''', '''y''': the number of pixels to scroll along the x and y axis&lt;br /&gt;
=== '''[scroll_to]''' ===&lt;br /&gt;
Scroll to a given hex&lt;br /&gt;
* '''x''', '''y''': the hex to scroll to&lt;br /&gt;
* {{DevFeature1.11}} [[StandardLocationFilter]], do not use a [filter_location] sub-tag. If more than one location matches the filter, only the first matching location will be used.&lt;br /&gt;
* '''check_fogged''': whether to scroll even to locations covered in fog or shroud. Possible values ''true'' (don't scroll to fog) and ''false'' (scroll even to fog), with ''false'' as the default.&lt;br /&gt;
* {{DevFeature1.11}} '''immediate''': whether to instantly warp to the target hex regardless of the scroll speed setting in Preferences (defaults to ''false'').&lt;br /&gt;
&lt;br /&gt;
=== [scroll_to_unit] ===&lt;br /&gt;
Scroll to a given unit&lt;br /&gt;
* [[StandardUnitFilter]]&lt;br /&gt;
* '''check_fogged''': whether to scroll even to locations covered in fog or shroud. Possible values ''true'' (don't scroll to fog) and ''false'' (scroll even to fog), with ''false'' as the default.&lt;br /&gt;
* {{DevFeature1.11}} '''immediate''': whether to instantly warp to the target hex regardless of the scroll speed setting in Preferences (defaults to ''false'').&lt;br /&gt;
=== [select_unit] ===&lt;br /&gt;
Selects a given unit.&lt;br /&gt;
* [[StandardUnitFilter]]: The first unit found will be selected.&lt;br /&gt;
* '''fire_event''': whether a ''select'' event should be triggered or not (def. ''no''). (Note that select events aren't multiplayer save.)&lt;br /&gt;
* '''highlight''': whether the unit's current hex should be highlighted (def. ''yes'').&lt;br /&gt;
&lt;br /&gt;
=== [sound]===&lt;br /&gt;
Plays a sound&lt;br /&gt;
* '''name''': the filename of the sound to play (in ''sounds/'' as .wav or .ogg)&lt;br /&gt;
* '''repeat''': repeats the sound for a specified additional number of times (default=0)&lt;br /&gt;
=== [sound_source] ===&lt;br /&gt;
Creates a sound source. &amp;quot;Sound sources&amp;quot; is a general name for a mechanism which makes possible for map elements to emit sounds according to some rules, where &amp;quot;map elements&amp;quot; can be specific locations or terrain types. For now, only sound sources tied to locations are supported.&lt;br /&gt;
* '''id''': a unique identification key of the sound source&lt;br /&gt;
* '''sounds''': a list of comma separated, randomly played sounds associated with the sound source&lt;br /&gt;
* '''delay''': a numerical value (in milliseconds) of the minimal delay between two playbacks of the source's sound if the source remains visible on the screen; if one scrolls out and back in, the source will be considered as ready to play&lt;br /&gt;
* '''chance''': a percentage (a value from 0 to 100) describing the chance of the source being activated every second after the delay has passed or when the source's location appears on the screen (note that it cannot play more than one file at the same time)&lt;br /&gt;
* '''check_fogged''': possible values &amp;quot;true&amp;quot; and &amp;quot;false&amp;quot; - if true the source will not play if its locations are fogged&lt;br /&gt;
* '''check_shrouded''': possible values &amp;quot;true&amp;quot; and &amp;quot;false&amp;quot; - if true the source will not play if its locations are shrouded&lt;br /&gt;
* '''x,y''': similar to x,y as found in a [[StandardLocationFilter]], these are the locations associated with the sound source&lt;br /&gt;
* '''fade_range''' (default = 3): distance in hexes that determines a &amp;quot;circular&amp;quot; area around the one specified by '''full_range''' where sound volume fades out linearly&lt;br /&gt;
* '''full_range''' (default = 14): distance in hexes that determines a &amp;quot;circular&amp;quot; area where source plays with full volume, relative to screen center&lt;br /&gt;
* '''loop''': number of times a sound sample should be looped if it stays visible. -1 means infinite (~65000)&lt;br /&gt;
&lt;br /&gt;
=== [remove_sound_source] ===&lt;br /&gt;
Removes a previously defined sound source.&lt;br /&gt;
* '''id''': the identification key of the sound source to remove&lt;br /&gt;
&lt;br /&gt;
=== [music]===&lt;br /&gt;
Switches to playing different music&lt;br /&gt;
* '''name''': the filename of the music to play (in ''music/'' as .ogg)&lt;br /&gt;
* see [[MusicListWML]] for the correct syntax&lt;br /&gt;
===[volume]===&lt;br /&gt;
Changes the game volume to a percent of the preferences volume for the game being played. Values can go from 0 to 100:  &lt;br /&gt;
* '''music''':  Changes the music volume.&lt;br /&gt;
* '''sound''':  Changes the sound volume.&lt;br /&gt;
=== [color_adjust]===&lt;br /&gt;
Tints the color of the screen.&lt;br /&gt;
* '''red''', '''green''', '''blue''': values from -255 to 255, the amount to tint by for each color&lt;br /&gt;
=== [delay] ===&lt;br /&gt;
Pauses the game.&lt;br /&gt;
* '''time''': the time to pause in milliseconds&lt;br /&gt;
=== [redraw] ===&lt;br /&gt;
Redraws the screen (this normally isn't done during events, although some of the other interface actions cause the screen or parts of it to be redrawn).&lt;br /&gt;
* '''clear_shroud''' (boolean yes|no, default no): If yes, clears fog and shroud around existing units. Useful if you, for example, spawn friendly units in the middle of an event and want the shroud to update accordingly (otherwise units that spawn inside fog would remain invisible for the duration of the event, since the fog would not automatically get cleared around them).&lt;br /&gt;
* '''[[StandardSideFilter]]''': the sides for which to recalculate fog and shroud.&lt;br /&gt;
* '''side''': If used (forces clear_shroud=yes), clears fog and shroud for that side.&lt;br /&gt;
&lt;br /&gt;
=== [unit_overlay] ===&lt;br /&gt;
Sets an image that will be drawn over a particular unit, and follow it around&lt;br /&gt;
* [[StandardUnitFilter]]: All matching units will get the overlay (do not use [filter])&lt;br /&gt;
* '''image''': the image to place on the unit&lt;br /&gt;
&lt;br /&gt;
=== [remove_unit_overlay] ===&lt;br /&gt;
removes a particular overlayed image from a unit&lt;br /&gt;
* [[StandardUnitFilter]]: The overlay will get removed from all matching units (do not use [filter])&lt;br /&gt;
* '''image''': the image to remove from the unit&lt;br /&gt;
&lt;br /&gt;
=== [animate_unit] ===&lt;br /&gt;
Uses an animation of a unit to animate it on screen (if the unit has the corresponding animation).&lt;br /&gt;
* '''flag''': The key to find the custom animation in the unit description (see the '''[extra_anim]''' description in [[AnimationWML]]). Standard animations can be triggered with the following keywords: ''leading recruited standing idling levelout levelin healing healed poisoned movement defend attack death victory pre_teleport post_teleport''&lt;br /&gt;
* '''[filter]''' with a [[StandardUnitFilter]] as argument, see [[FilterWML]]. By default, the unit at the event location will be animated. You can use this tag to choose any other unit to animate.&lt;br /&gt;
* '''[primary_attack]''': If this tag is not present, the filter for animation will be triggered with no attack. If it is here, all attacks from the unit will be filtered, and a matching one will be used to filter the animation. Takes a weapon filter as argument, see [[FilterWML]].&lt;br /&gt;
* '''[secondary_attack]''': Similar to '''[primary_attack]'''. May be needed to trigger a defense animation correctly, if there are more than one animations available for the defending unit.&lt;br /&gt;
* '''hits''': yes/no/hit/miss/kill: which according variation of a attack/defense animation shall be chosen (required)&lt;br /&gt;
* '''text''': a text to hover during the animation &lt;br /&gt;
* '''red''': red value for the text color (0-255)&lt;br /&gt;
* '''green''': green value for the text color&lt;br /&gt;
* '''blue''': blue value for the text color&lt;br /&gt;
* '''with_bars''': yes/no: whether to display the status bars during the animation (e.g. the hitpoint bar)&lt;br /&gt;
* '''[animate]''': a sub block with the same syntax as '''[animate_unit]''' except that the '''[filter]''' block is mandatory to find the unit. This block will find and animate another unit simultaneously.&lt;br /&gt;
* '''[facing]''': a [[StandardLocationFilter]] specifying what direction the unit should be facing when animated&lt;br /&gt;
&lt;br /&gt;
=== [label] ===&lt;br /&gt;
Places a label on the map.&lt;br /&gt;
* '''x''', '''y''': the location of the label&lt;br /&gt;
* '''text''': what the label should say&lt;br /&gt;
* '''team_name''': if specified, the label will only be visible to the given team.&lt;br /&gt;
* '''color''': color of the label. The format is r,g,b; r, g and b are numbers between 0 and 255.&lt;br /&gt;
* '''visible_in_fog''': whether the label should be visible through fog or not. Default yes.&lt;br /&gt;
* '''visible_in_shroud''': whether the label should be visible through shroud or not. Default no.&lt;br /&gt;
* '''immutable''': whether this label is protected from being removed or changed by players. Default yes.&lt;br /&gt;
=== [floating_text]===&lt;br /&gt;
Floats text (similar to the damage and healing numbers) on the given locations.&lt;br /&gt;
* [[StandardLocationFilter]]: the text will be floated on all matching locations simultaneously.&lt;br /&gt;
* '''text''': the text to display.&lt;br /&gt;
&lt;br /&gt;
The default text color is &amp;lt;span style=&amp;quot;color: #6b8cff;&amp;quot;&amp;gt;'''#6b8cff'''&amp;lt;/span&amp;gt;. To change the color, use [[#Formatting|Pango markup]]. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Float some golden yellow text at 20,20.&lt;br /&gt;
[floating_text]&lt;br /&gt;
   x,y=20,20&lt;br /&gt;
   text=&amp;quot;&amp;lt;span color='#cccc33'&amp;gt;&amp;quot; + _ &amp;quot;Your text here&amp;quot; + &amp;quot;&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
[/floating_text]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [deprecated_message] ===&lt;br /&gt;
Shows a deprecated message in the message area, this feature is only intended to be used to warn about deprecated macros in mainline. The message is not translatable.&lt;br /&gt;
* '''message''': the message to show.&lt;br /&gt;
=== [wml_message] ===&lt;br /&gt;
Outputs a message to Wesnoth's console output. Intended for campaign designers to output silent text to the console, without annoying the player; then, that text might contain information useful for later bug-reporting. The log domain for it is '''wml''', and the '''debug/dbg''' log level is available for use with the '''logger''' attribute. Depending on the current log level ('''error''' by default), which may be changed with the in-game :log command, or the --log-&amp;lt;level&amp;gt;=wml command line switch, the messages are echoed to the in-game chat.&lt;br /&gt;
* '''message''': the message to show.&lt;br /&gt;
* '''logger''': the Wesnoth engine output logger that should catch the text; this might be 'err' (the errors log level), 'warn'/'wrn' (the warnings log level) or anything else (the information log level). Not all information will be displayed depending on the log level chosen when starting Wesnoth.&lt;br /&gt;
&lt;br /&gt;
Note: As of 1.9.4/1.9.5 (r48805) the following &amp;quot;loggers&amp;quot; should work: If in [wml_message]: err/error, warn/wrn/warning, debug/dbg; using the :log command: Only the long forms error, warning, info and debug (this part gathered by trying rather than source inspecting). The long forms are most likely also the only ones working when starting wesnoth with --log-&amp;lt;level&amp;gt;=wml.&lt;br /&gt;
For log level warning or error (as during normal play), only wml_messages with logger error or warning display (for both). With logger info or debug, additionally wml_messages with logger info or debug display (for both).&lt;br /&gt;
&lt;br /&gt;
=== [open_help] ===&lt;br /&gt;
Opens the in-game help.&lt;br /&gt;
* '''topic''': the id of the topic to open&lt;br /&gt;
=== [show_objectives] ===&lt;br /&gt;
refreshes the objectives defined by [objectives] and its [show_if] tags, and displays them. (It is also called whenever the user explicitly asks for the objectives; this matters only if the tag was overridden by a [[LuaWML#register_wml_action|Lua]] script.)&lt;br /&gt;
* '''side''': the side to show the objectives. If not set, all sides are used.&lt;br /&gt;
* '''[[StandardSideFilter]]''' {{DevFeature1.11}} tags and keys: Tag affects the matching sides instead of just all or the one given by the integer value of the side= key.&lt;br /&gt;
&lt;br /&gt;
=== [chat] ===&lt;br /&gt;
Displays a message in the chat area.&lt;br /&gt;
* '''speaker''': (default=&amp;quot;WML&amp;quot;) A string for the name of the sender of the message.&lt;br /&gt;
* '''message''': The message that should be displayed.&lt;br /&gt;
* '''[[StandardSideFilter]]''' tags and keys as argument; if the same client controls multiple sides that match, then the message will only be displayed once.&lt;br /&gt;
&lt;br /&gt;
== Useful Macros ==&lt;br /&gt;
There are some predefined macros that you find useful for interface actions. You can find a complete list along with a detailed explanation of how they work [http://www.wesnoth.org/macro-reference.xhtml here].&lt;br /&gt;
* '''{HIGHLIGHT_UNIT}''' Highlight a unit on the map. Use this to show important units&lt;br /&gt;
* '''{HIGHLIGHT_IMAGE}''' Places and highlights an image on the map. Use this to show important items or locations&lt;br /&gt;
* '''{SET_IMAGE}''' Places an image on the map which has no other function.&lt;br /&gt;
* '''{QUAKE &amp;lt;soundfile&amp;gt;}''' Creates a tremor-like screenshake and plays &amp;lt;soundfile&amp;gt;. For example, '''{QUAKE (rumble.ogg)}'''.&lt;br /&gt;
* '''{FLASH_WHITE}''' Flash the screen white momentarily. You can also replace WHITE with RED, BLUE or GREEN for a different colour.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[DirectActionsWML]]&lt;br /&gt;
* [[InternalActionsWML]]&lt;br /&gt;
* [[EventWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;br /&gt;
[[Category: ActionsWML]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=InterfaceActionsWML&amp;diff=48427</id>
		<title>InterfaceActionsWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=InterfaceActionsWML&amp;diff=48427"/>
		<updated>2013-01-27T09:06:46Z</updated>

		<summary type="html">&lt;p&gt;Coffee: /* [item] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
== Interface actions ==&lt;br /&gt;
&lt;br /&gt;
Part of [[ActionWML]], interface actions are actions that do not have a direct effect on gameplay;&lt;br /&gt;
instead, they show something to the player.  The main interface tags&lt;br /&gt;
are '''[message]''' and '''[objectives]''', but several other tags affect&lt;br /&gt;
the interface also.&lt;br /&gt;
&lt;br /&gt;
== [inspect] ==&lt;br /&gt;
This user interface action only works in debug mode. It displays the gamestate inspector dialog (the same one which can be brought up with '':inspect'' ), which can be used to inspect the values of WML variables, AI configuration, recall lists, and more.&lt;br /&gt;
&lt;br /&gt;
* '''name''': optional attribute to specify the name of this gamestate inspector dialog. It is just a label to help differentiate between different invocations of gamestate inspector dialog.&lt;br /&gt;
&lt;br /&gt;
== [message] ==&lt;br /&gt;
The most commonly used interface action is [message], which displays a message to the user in a dialog box. It can also be used to take input from the user.&lt;br /&gt;
&lt;br /&gt;
The following key/tags are accepted for [message]:&lt;br /&gt;
* [[StandardUnitFilter]]: The unit whose profile and name are displayed. Do not use a [filter] tag. If no unit matching this filter is found, the message is not displayed (The unit has probably been killed).&amp;lt;br&amp;gt;'''[message]''' elements should be constructed so that it is either guaranteed that a certain unit is alive, or so that dialog flows smoothly even if the message isn't displayed.&lt;br /&gt;
&lt;br /&gt;
* '''speaker''': an alternative to standard unit filter. You may specify as the value of the speaker attribute a unit id or any of the following special values:&lt;br /&gt;
** '''narrator''': the dialog box is displayed without a caption for the unit speaking or a unit image&lt;br /&gt;
** '''unit''': the primary unit for the event is speaking&lt;br /&gt;
** '''second_unit''': the secondary unit for the event is speaking&lt;br /&gt;
&lt;br /&gt;
* '''message''': (translatable) the text to display to the right of the image. ''message'' is sometimes multiple lines; if it is, be sure to use quotes(''' ' ''' or ''' &amp;quot; ''')&lt;br /&gt;
* '''[show_if]''': if present then this message will only be displayed if the conditional statement in this tag is passed (see [[ConditionalActionsWML#Condition_Tags|ConditionalActionsWML]])&lt;br /&gt;
* '''side_for''': (default: all sides) comma-separated list of sides for who message is shown.&lt;br /&gt;
* '''image''': (default: profile image of speaker) the image to display next to the message. Append ~RIGHT() if you want the image to appear on the right side.&lt;br /&gt;
* '''caption''': (default: name of speaker) the caption to display beside the image. Name to be displayed. Note: use a translation mark to avoid wmllint errors.&lt;br /&gt;
* '''scroll''': Boolean specifying whether the game view should scroll to the speaking unit. Defaults to ''yes''.&lt;br /&gt;
* '''duration''': (default: 10) the minimum number of frames for this message to be displayed. (A frame lasts about 30 milliseconds.) During this time any dialog decisions will be disregarded.&lt;br /&gt;
* '''sound''': a sound effect (wav file) to play as the message is displayed. This can be a comma-separated list, from which one will be randomly chosen.&lt;br /&gt;
* '''[option]''': No '''[option]''' elements have to be used. If '''[option]''' elements are present, then each option will be displayed in a menu for the user to select one option.&lt;br /&gt;
** '''message''': (translatable) the text displayed for the option (see [[DescriptionWML]])&lt;br /&gt;
** '''[show_if]''': if present then this option will only be displayed if the conditional statement in this tag is passed (see [[ConditionalActionsWML#Condition_Tags|ConditionalActionsWML]])&lt;br /&gt;
** '''[command]''': an element containing actions which are executed if the option is selected.&lt;br /&gt;
* '''[text_input]''': there can be only one [text_input] tag. this adds a text input field to the message.&lt;br /&gt;
** '''variable''': the variable that the user's input will be written to&lt;br /&gt;
** '''label''': a text label to the left of the input field&lt;br /&gt;
** '''max_length''': the maximum number of characters that may be typed into the field&lt;br /&gt;
** '''text''': text that is written into the field in the beginning&lt;br /&gt;
* Check [[EventWML#Multiplayer_safety]] to find out in which events you can safely use '''[option]''' and '''[text_input]''' without causing OOS.&lt;br /&gt;
&lt;br /&gt;
=== Formatting ===&lt;br /&gt;
In 1.8, [http://developer.gnome.org/pango/unstable/PangoMarkupFormat.html Pango markup formatting codes] have been adopted for '''[message]'''. These can also be used in unit names (user_description), objectives, and such. Note that you'll probably want to use a single quote ' instead of a double quote &amp;quot; as double quotes cannot be escaped, otherwise the string will appear fragmented and you may also encounter errors. Running wmllint on your campaign will up-convert it, warning you about unusual cases you must fix by hand.&lt;br /&gt;
&lt;br /&gt;
For example, if you wanted to write &amp;quot;You are victorious!&amp;quot; in large, italic, gold letters, you might write it this way:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;span color='#BCB088' size='large' font-style='italic'&amp;gt;You are victorious!&amp;lt;/span&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
These are the codes taken from the Pango markup formatting guide:&lt;br /&gt;
&lt;br /&gt;
*'''font''', '''font_desc''': A font description string, such as &amp;quot;Sans Italic 12&amp;quot;.&lt;br /&gt;
*'''font_family''', '''face''': A font family name.&lt;br /&gt;
*'''font_size''', '''size''': Font size in 1024ths of a point, or one of the absolute sizes 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', or one of the relative sizes 'smaller' or 'larger'.&lt;br /&gt;
*'''font_style''', '''style''': One of 'normal', 'oblique', 'italic'.&lt;br /&gt;
*'''font_weight''', '''weight''': One of 'ultralight', 'light', 'normal', 'bold', 'ultrabold', 'heavy', or a numeric weight.&lt;br /&gt;
*'''font_variant''', '''variant''': One of 'normal' or 'smallcaps'.&lt;br /&gt;
*'''font_stretch''', '''stretch''': One of 'ultracondensed', 'extracondensed', 'condensed', 'semicondensed', 'normal', 'semiexpanded', 'expanded', 'extraexpanded', 'ultraexpanded'.&lt;br /&gt;
*'''foreground''', '''fgcolor''', '''color''': An RGB color specification such as '#00FF00' or a color name such as 'red'.&lt;br /&gt;
*'''background, bgcolor''': An RGB color specification such as '#00FF00' or a color name such as 'red'.&lt;br /&gt;
*'''underline''': One of 'none', 'single', 'double', 'low', 'error'.&lt;br /&gt;
*'''underline_color''': The color of underlines; an RGB color specification such as '#00FF00' or a color name such as 'red'.&lt;br /&gt;
*'''rise''': Vertical displacement, in 10000ths of an em. Can be negative for subscript, positive for superscript.&lt;br /&gt;
*'''strikethrough''': 'true' or 'false' whether to strike through the text.&lt;br /&gt;
*'''strikethrough_color''': The color of strikethrough lines; an RGB color specification such as '#00FF00' or a color name such as 'red'&lt;br /&gt;
*'''fallback''': 'true' or 'false' whether to enable fallback. If disabled, then characters will only be used from the closest matching font on the system. No fallback will be done to other fonts on the system that might contain the characters in the text. Fallback is enabled by default. Most applications should not disable fallback.&lt;br /&gt;
*'''letter_spacing''': Inter-letter spacing in 1024ths of a point.&lt;br /&gt;
*'''gravity''': One of 'south', 'east', 'north', 'west', 'auto'.&lt;br /&gt;
*'''gravity_hint''': One of 'natural', 'strong', 'line'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In 1.6, Wesnoth uses older text formatting options&lt;br /&gt;
* A tilde (~) as the first character causes the line to be boldfaced.&lt;br /&gt;
* An at symbol (@) as the first character causes the line to be green, as done with victory conditions.&lt;br /&gt;
* A pound symbol (#) as the first character causes the line to be red, as done with defeat conditions.&lt;br /&gt;
* An asterisk (*) as the first character causes the line to be bigger.&lt;br /&gt;
* A backquote (`) as the first character causes the line to be smaller.&lt;br /&gt;
* If used, the caption key text is boldfaced.&lt;br /&gt;
* An RGB colour code in the beginning causes the line to be the given colour. This can still be preceded by the above characters. Example: ''message=_&amp;quot;&amp;lt;255,0,0&amp;gt;Red!&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
== [objectives] ==&lt;br /&gt;
The other tag used for plot development is '''[objectives]'''.&lt;br /&gt;
The '''[objectives]''' tag overwrites any previously set objectives,&lt;br /&gt;
and displays text which should describe the objectives of the scenario.&lt;br /&gt;
Scenario objectives are displayed on the player's first turn after the tag is used,&lt;br /&gt;
or as part of the event if it triggers during that player's turn.&lt;br /&gt;
Objectives can also be accessed at any time in a scenario using the&lt;br /&gt;
&amp;quot;Scenario Objectives&amp;quot; game menu option, making this tag useful for&lt;br /&gt;
scenario-specific information that the player may need to refer to during play.&lt;br /&gt;
&lt;br /&gt;
Attributes of '''[objectives]''':&lt;br /&gt;
* '''side''': Default '0'. The side to set the objectives for. A value of 0 sets objectives for all sides. note: There are side-specific objectives and default objectives, which are used in case a side doesn't have specific ones. Specifying 0 sets the default ones.&lt;br /&gt;
* '''[[StandardSideFilter]]''' {{DevFeature1.11}} tags and keys: Sets the objectives of all matching sides to these passed specifications (the rest of this [objectives] tag). If no sides (such as when passing side=0) or all sides match, sets the default objectives, and the side specific ones for the matching sides otherwise.&lt;br /&gt;
* '''bullet''': Default '• '. Replaces the default bullet, with whatever is passed, for all objectives, gold carryover notes, and notes defined with [note].&lt;br /&gt;
* '''summary''': Displayed first in the objectives text, this should describe the basic objective for the overall scenario.  Can be omitted.&lt;br /&gt;
* '''note''': Displayed last in the objectives text, this is sometimes used for hints or additional information.  Can be omitted.&lt;br /&gt;
* '''victory_string''': Default ' _ &amp;quot;Victory:&amp;quot;', this text precedes the victory objectives.&lt;br /&gt;
* '''defeat_string''': Default ' _ &amp;quot;Defeat:&amp;quot;', this text precedes the defeat objectives.&lt;br /&gt;
* '''gold_carryover_string''': Default ' _ &amp;quot;Gold carryover:&amp;quot;', this text precedes the gold carryover information.&lt;br /&gt;
* '''notes_string''': Default ' _ &amp;quot;Notes:&amp;quot;', this text precedes the notes.&lt;br /&gt;
* '''silent''': Default: not present. If set to &amp;quot;yes&amp;quot;, the objectives are silently changed. Else, they will be shown to the user when appropriate.&lt;br /&gt;
&lt;br /&gt;
Tags of '''[objectives]''':&lt;br /&gt;
* '''[objective]''': describes a win or loss condition. Most scenarios have multiple win or loss conditions, so use a separate [objective] subtag for each line; this helps with translations.&lt;br /&gt;
** '''bullet''': Default '• ' or whatever is set in the parent [objectives] block. Replaces the default bullet, with whatever is provided, for the objective defined by the [objective] block.&lt;br /&gt;
** '''red''': Default '0' for winning objectives, '255' for losing objectives. Overrides the default red coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''green''': Default '255' for winning objectives, '0' for losing objectives. Overrides the default green coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''blue''': Default '0'. Overrides the default blue coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''description''': text for the specific win or loss condition.&lt;br /&gt;
** '''condition''': The color and placement of the text. Values are 'win'(colored green, placed after ''victory_string'') and 'lose'(colored red, placed after ''defeat_string'')&lt;br /&gt;
** '''show_turn_counter''': If set to yes, displays the number of turns remaining in the scenario. Default is no.&lt;br /&gt;
** '''[show_if]''': A condition that disables the objective if it doesn't hold. Conditional objectives are refreshed at '''[show_objectives]''' time only.&lt;br /&gt;
* '''[gold_carryover]''': describes how the gold carryover works in this scenario. This is intended to be a more convenient way of displaying carryover information than using the note= key in [objectives].&lt;br /&gt;
** '''bullet''': Default '• ' or whatever is set in the parent [objectives] block. Replaces the default bullet with whatever is provided.&lt;br /&gt;
** '''red''': Default '255'. Overrides the default red coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''green''': Default '255'. Overrides the default green coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''blue''': Default '192'. Overrides the default blue coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''bonus''' (boolean): whether an early finish bonus is granted. If omitted, early finish bonus is not mentioned.&lt;br /&gt;
** '''carryover_percentage''': the amount of carryover gold. If omitted, the amount is not mentioned.&lt;br /&gt;
* '''[note]''': describes a note, usually used for hints or additional information. This is an easier way of adding several notes than concatenating them together into a single string to use with the ''note='' key.&lt;br /&gt;
** '''bullet''': Default '• ' or whatever is set in the parent [objectives] block. Replaces the default bullet with whatever is provided for the note defined by the [note] block.&lt;br /&gt;
** '''red''': Default '255'. Overrides the default red coloring of the entire note, including the bullet.&lt;br /&gt;
** '''green''': Default '255'. Overrides the default green coloring of the entire note, including the bullet.&lt;br /&gt;
** '''blue''': Default '255'. Overrides the default blue coloring of the entire note, including the bullet.&lt;br /&gt;
** '''description''': the text of the note.&lt;br /&gt;
** {{DevFeature1.11}} '''[show_if]''': The note will not be shown if the specified condition isn't met. Conditional notes are refreshed at '''[show_objectives]''' time only.&lt;br /&gt;
&lt;br /&gt;
== [set_menu_item] ==&lt;br /&gt;
This tag is used to add a custom option in the right-click context menu which can then be used to trigger arbitrary WML commands.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Due to limitations in portable devices where there are no scroll bars for context menus, there is a hard-coded limit of 7 custom WML menu items. If you really need to have more than 7 menu items, try combining some of them in a submenu.&lt;br /&gt;
&lt;br /&gt;
* '''id''': the unique id for this menu item. If a menu item with this id already exists, it allows you to set specific changes to that item.&lt;br /&gt;
* '''description''': the in-game text that will appear for this item in the menu.&lt;br /&gt;
* '''image''': the image to display next to this item.&lt;br /&gt;
* '''needs_select''': if ''yes'' (default ''no''), then the latest select event (see [[EventWML]]) that triggered before this menu item was chosen will be transmitted over the network before this menu item action will be. This only has any effect in networked multiplayer, and is intended to allow more elaborate menu item behaviour there without causing out of sync errors. If you don't know what this means, just leave it false.&lt;br /&gt;
* '''[show_if]''': If present, the menu item will only be available if the conditional statement (see [[ConditionalActionsWML#Condition_Tags|ConditionalActionsWML]]) within evaluates to true. When this is evaluated, the WML variables ''$x1'' and ''$y1'' will point to the location on which the context menu was invoked, so it's possible to for example only enable the option on empty hexes or on a particular unit.&lt;br /&gt;
* '''[filter_location]''': contains a location filter similar to the one found inside Single Unit Filters (see [[FilterWML]]). The menu item will only be available on matching locations.&lt;br /&gt;
* '''[command]''': contains the WML actions to be executed when the menu item is selected. Again, the WML variables ''$x1'' and ''$y1'' will point to the location on which the context menu was invoked on.&lt;br /&gt;
** '''delayed_variable_substitution ''' {{DevFeature1.11}} (boolean yes|no, default: yes): If no, forces a variable substitution run onto the wml included in this [command] block. Use this, if you want variables which are to substitute to get the values they have at execution time of the event where this set_menu_item appears. Other than that, they get the values they have at invocation time of the menu item.&lt;br /&gt;
&lt;br /&gt;
== [clear_menu_item] ==&lt;br /&gt;
{{DevFeature1.11}}&lt;br /&gt;
&lt;br /&gt;
Removes a menu item from the scenario.&lt;br /&gt;
Normally menu items are, including all their defining wml, automatically carried over between scenarios. This tag prevents this. (The behavior is comparable to set_variable/clear_variable).&lt;br /&gt;
* '''id''': (string): id of the menu item to clear. Can be a comma-separated list.&lt;br /&gt;
&lt;br /&gt;
== Other interface tags ==&lt;br /&gt;
&lt;br /&gt;
The following tags are also action tags:&lt;br /&gt;
=== [item] ===&lt;br /&gt;
Makes a graphical item appear on a certain hex. Note this only places the graphics for an item. It does not make the item do anything. Use a moveto event to make moving onto the item do something. &amp;lt;tt&amp;gt;''('''Hint:''' There are a number of predefined items that are used in various campaigns that you can make use of. You can find [http://www.wesnoth.org/macro-reference.xhtml#file:items.cfg a list of them] if you look into the items.cfg file in the wesnoth install directory (under /data/core/macros).)''&amp;lt;/tt&amp;gt;&lt;br /&gt;
* '''x''', '''y''': the location to place the item. (only for [event][item]: full [[StandardLocationFilter|SLF]] support)&lt;br /&gt;
* '''image''': the image (in ''images/'' as .png) to place on the hex. This image is aligned with the top-left of the hex (which is 72 pixels wide and 72 pixels tall). It is drawn underneath units. ''('''Hint:''' If using an image smaller than 72x72, then it might be useful to [[ImagePathFunctionWML#Blit_Function|BLIT]] the image onto &amp;lt;tt&amp;gt;misc/blank-hex.png&amp;lt;/tt&amp;gt; (a blank 72x72 image).)''&lt;br /&gt;
* '''halo''': an image to place centered on the hex. It is drawn on top of units. Use this instead of ''image'' if the image is bigger than the hex or if you want to animate an image.&lt;br /&gt;
''Example (where the integer after the colon is the duration of each frame or suqare bracket expansion as per AnimationWML is used): halo=scenery/fire1.png:100,scenery/fire2.png:100,scenery/fire3.png:100,scenery/fire4.png:100,scenery/fire5.png:100,scenery/fire6.png:100,scenery/fire7.png:100,scenery/fire8.png:100&lt;br /&gt;
or equivalently:&lt;br /&gt;
halo=scenery/fire[1-8].png:100''&lt;br /&gt;
* '''team_name''': name of the team for which the item is to be displayed (hidden for others). For multiple teams just put all the names in one string, for example separated by commas.&lt;br /&gt;
* '''visible_in_fog''': whether the item should be visible through fog or not. Default yes.&lt;br /&gt;
* '''redraw''': {{DevFeature1.11}}(boolean yes|no, default: yes): If no, disables implicit calls to [[InterfaceActionsWML#.5Bredraw.5D|[redraw]]] when placing the items.&lt;br /&gt;
&lt;br /&gt;
=== [remove_item] ===&lt;br /&gt;
Removes any graphical items on a given hex.&lt;br /&gt;
* [[StandardLocationFilter]]: the hexes to remove items off&lt;br /&gt;
* '''image''' if specified, only removes the given image item (This image name must include any [[ImagePathFunctionWML|image path functions]] appended to the original image name.)&lt;br /&gt;
&lt;br /&gt;
=== [print] ===&lt;br /&gt;
Displays a message across the screen. The message will disappear after a certain time.&lt;br /&gt;
* '''text''': (translatable) the text to display.&lt;br /&gt;
* '''size''': (default=12) the pointsize of the font to use&lt;br /&gt;
* '''duration''': (default=50) the length of time to display the text for. This is measured in the number of 'frames'. A frame in Wesnoth is usually displayed for around 30ms.&lt;br /&gt;
* '''red''', '''green''', '''blue''': (default=0,0,0) the color to display the text in. Values vary from 0-255.&lt;br /&gt;
=== [move_unit_fake] ===&lt;br /&gt;
Moves an image of a unit along a certain path on the map. The path does not need to be a continuous list of adjacent hexes, so for example only the start and end points can be given, in which case the straightest line between those points will be calculated and used.&lt;br /&gt;
* '''type''': the type of the unit whose image to use&lt;br /&gt;
* '''x''': a comma-separated list of x locations to move along&lt;br /&gt;
* '''y''': a comma-separated list of y locations to move along (x and y values are matched pairs)&lt;br /&gt;
* '''side''': the side of the fake unit, used for team-coloring the fake unit&lt;br /&gt;
* '''gender''': the gender of the fake unit. Example: gender=female&lt;br /&gt;
* '''variation''': the variation of the fake unit. Example: variation=undead&lt;br /&gt;
* '''image_mods''': [[ImagePathFunctionWML|image path functions]] sequence to be applied on the fake unit.&lt;br /&gt;
=== [move_units_fake] ===&lt;br /&gt;
moves multiple images of units along paths on the map. These units are moved in lockstep.&lt;br /&gt;
* '''[fake_unit]''': A fake unit to move&lt;br /&gt;
** '''type''': the type of unit whose image to use&lt;br /&gt;
** '''x''': a comma-separated list of x locations to move along&lt;br /&gt;
** '''y''': a comma-separated list of y locations to move along (x and y values are matched pairs)&lt;br /&gt;
** '''side''': the side of the fake unit, used for team-coloring the fake unit&lt;br /&gt;
** '''skip_steps''': the number of steps to skip before this unit starts moving&lt;br /&gt;
=== [hide_unit] ===&lt;br /&gt;
Temporarily prevents the engine from displaying the given unit. The unit does not become invisible, as it would be with the '''[hides]''' ability; it is still the same plain unit, but without an image. Useful in conjunction with '''[move_unit_fake]''': to move a leader unit into position on-screen. Until 1.8 each '''[hide_unit]''' tag only hides one unit.&lt;br /&gt;
* [[StandardUnitFilter]]: All matching units will be hidden&lt;br /&gt;
&lt;br /&gt;
=== [unhide_unit] ===&lt;br /&gt;
Stops the currently hidden units from being hidden.&lt;br /&gt;
* [[StandardUnitFilter]]: Only the matching units will be unhidden&lt;br /&gt;
&lt;br /&gt;
=== [lock_view] ===&lt;br /&gt;
{{DevFeature1.11}} Locks gamemap view scrolling for human players, so they cannot scroll the gamemap view until it is unlocked. WML or Lua actions such as '''[scroll_to]''' will continue to work normally, as they ignore this restriction; the locked/unlocked state is preserved when saving the current game.&lt;br /&gt;
&lt;br /&gt;
This feature is generally intended to be used in cutscenes to prevent the player scrolling away from scripted actions. &lt;br /&gt;
&lt;br /&gt;
=== [unlock_view] ===&lt;br /&gt;
{{DevFeature1.11}} Unlocks gamemap view scrolling for human players.&lt;br /&gt;
&lt;br /&gt;
=== [scroll] ===&lt;br /&gt;
Scroll a certain number of pixels in a given direction. Useful for earthquake/shaking effects.&lt;br /&gt;
* '''x''', '''y''': the number of pixels to scroll along the x and y axis&lt;br /&gt;
=== '''[scroll_to]''' ===&lt;br /&gt;
Scroll to a given hex&lt;br /&gt;
* '''x''', '''y''': the hex to scroll to&lt;br /&gt;
* {{DevFeature1.11}} [[StandardLocationFilter]], do not use a [filter_location] sub-tag. If more than one location matches the filter, only the first matching location will be used.&lt;br /&gt;
* '''check_fogged''': whether to scroll even to locations covered in fog or shroud. Possible values ''true'' (don't scroll to fog) and ''false'' (scroll even to fog), with ''false'' as the default.&lt;br /&gt;
* {{DevFeature1.11}} '''immediate''': whether to instantly warp to the target hex regardless of the scroll speed setting in Preferences (defaults to ''false'').&lt;br /&gt;
&lt;br /&gt;
=== [scroll_to_unit] ===&lt;br /&gt;
Scroll to a given unit&lt;br /&gt;
* [[StandardUnitFilter]]&lt;br /&gt;
* '''check_fogged''': whether to scroll even to locations covered in fog or shroud. Possible values ''true'' (don't scroll to fog) and ''false'' (scroll even to fog), with ''false'' as the default.&lt;br /&gt;
* {{DevFeature1.11}} '''immediate''': whether to instantly warp to the target hex regardless of the scroll speed setting in Preferences (defaults to ''false'').&lt;br /&gt;
=== [select_unit] ===&lt;br /&gt;
Selects a given unit.&lt;br /&gt;
* [[StandardUnitFilter]]: The first unit found will be selected.&lt;br /&gt;
* '''fire_event''': whether a ''select'' event should be triggered or not (def. ''no''). (Note that select events aren't multiplayer save.)&lt;br /&gt;
* '''highlight''': whether the unit's current hex should be highlighted (def. ''yes'').&lt;br /&gt;
&lt;br /&gt;
=== [sound]===&lt;br /&gt;
Plays a sound&lt;br /&gt;
* '''name''': the filename of the sound to play (in ''sounds/'' as .wav or .ogg)&lt;br /&gt;
* '''repeat''': repeats the sound for a specified additional number of times (default=0)&lt;br /&gt;
=== [sound_source] ===&lt;br /&gt;
Creates a sound source. &amp;quot;Sound sources&amp;quot; is a general name for a mechanism which makes possible for map elements to emit sounds according to some rules, where &amp;quot;map elements&amp;quot; can be specific locations or terrain types. For now, only sound sources tied to locations are supported.&lt;br /&gt;
* '''id''': a unique identification key of the sound source&lt;br /&gt;
* '''sounds''': a list of comma separated, randomly played sounds associated with the sound source&lt;br /&gt;
* '''delay''': a numerical value (in milliseconds) of the minimal delay between two playbacks of the source's sound if the source remains visible on the screen; if one scrolls out and back in, the source will be considered as ready to play&lt;br /&gt;
* '''chance''': a percentage (a value from 0 to 100) describing the chance of the source being activated every second after the delay has passed or when the source's location appears on the screen (note that it cannot play more than one file at the same time)&lt;br /&gt;
* '''check_fogged''': possible values &amp;quot;true&amp;quot; and &amp;quot;false&amp;quot; - if true the source will not play if its locations are fogged&lt;br /&gt;
* '''check_shrouded''': possible values &amp;quot;true&amp;quot; and &amp;quot;false&amp;quot; - if true the source will not play if its locations are shrouded&lt;br /&gt;
* '''x,y''': similar to x,y as found in a [[StandardLocationFilter]], these are the locations associated with the sound source&lt;br /&gt;
* '''fade_range''' (default = 3): distance in hexes that determines a &amp;quot;circular&amp;quot; area around the one specified by '''full_range''' where sound volume fades out linearly&lt;br /&gt;
* '''full_range''' (default = 14): distance in hexes that determines a &amp;quot;circular&amp;quot; area where source plays with full volume, relative to screen center&lt;br /&gt;
* '''loop''': number of times a sound sample should be looped if it stays visible. -1 means infinite (~65000)&lt;br /&gt;
&lt;br /&gt;
=== [remove_sound_source] ===&lt;br /&gt;
Removes a previously defined sound source.&lt;br /&gt;
* '''id''': the identification key of the sound source to remove&lt;br /&gt;
&lt;br /&gt;
=== [music]===&lt;br /&gt;
Switches to playing different music&lt;br /&gt;
* '''name''': the filename of the music to play (in ''music/'' as .ogg)&lt;br /&gt;
* see [[MusicListWML]] for the correct syntax&lt;br /&gt;
===[volume]===&lt;br /&gt;
Changes the game volume to a percent of the preferences volume for the game being played. Values can go from 0 to 100:  &lt;br /&gt;
* '''music''':  Changes the music volume.&lt;br /&gt;
* '''sound''':  Changes the sound volume.&lt;br /&gt;
=== [color_adjust]===&lt;br /&gt;
Tints the color of the screen.&lt;br /&gt;
* '''red''', '''green''', '''blue''': values from -255 to 255, the amount to tint by for each color&lt;br /&gt;
=== [delay] ===&lt;br /&gt;
Pauses the game.&lt;br /&gt;
* '''time''': the time to pause in milliseconds&lt;br /&gt;
=== [redraw] ===&lt;br /&gt;
Redraws the screen (this normally isn't done during events, although some of the other interface actions cause the screen or parts of it to be redrawn).&lt;br /&gt;
* '''clear_shroud''' (boolean yes|no, default no): If yes, clears fog and shroud around existing units. Useful if you, for example, spawn friendly units in the middle of an event and want the shroud to update accordingly (otherwise units that spawn inside fog would remain invisible for the duration of the event, since the fog would not automatically get cleared around them).&lt;br /&gt;
* '''[[StandardSideFilter]]''': the sides for which to recalculate fog and shroud.&lt;br /&gt;
* '''side''': If used (forces clear_shroud=yes), clears fog and shroud for that side.&lt;br /&gt;
&lt;br /&gt;
=== [unit_overlay] ===&lt;br /&gt;
Sets an image that will be drawn over a particular unit, and follow it around&lt;br /&gt;
* [[StandardUnitFilter]]: All matching units will get the overlay (do not use [filter])&lt;br /&gt;
* '''image''': the image to place on the unit&lt;br /&gt;
&lt;br /&gt;
=== [remove_unit_overlay] ===&lt;br /&gt;
removes a particular overlayed image from a unit&lt;br /&gt;
* [[StandardUnitFilter]]: The overlay will get removed from all matching units (do not use [filter])&lt;br /&gt;
* '''image''': the image to remove from the unit&lt;br /&gt;
&lt;br /&gt;
=== [animate_unit] ===&lt;br /&gt;
Uses an animation of a unit to animate it on screen (if the unit has the corresponding animation).&lt;br /&gt;
* '''flag''': The key to find the custom animation in the unit description (see the '''[extra_anim]''' description in [[AnimationWML]]). Standard animations can be triggered with the following keywords: ''leading recruited standing idling levelout levelin healing healed poisoned movement defend attack death victory pre_teleport post_teleport''&lt;br /&gt;
* '''[filter]''' with a [[StandardUnitFilter]] as argument, see [[FilterWML]]. By default, the unit at the event location will be animated. You can use this tag to choose any other unit to animate.&lt;br /&gt;
* '''[primary_attack]''': If this tag is not present, the filter for animation will be triggered with no attack. If it is here, all attacks from the unit will be filtered, and a matching one will be used to filter the animation. Takes a weapon filter as argument, see [[FilterWML]].&lt;br /&gt;
* '''[secondary_attack]''': Similar to '''[primary_attack]'''. May be needed to trigger a defense animation correctly, if there are more than one animations available for the defending unit.&lt;br /&gt;
* '''hits''': yes/no/hit/miss/kill: which according variation of a attack/defense animation shall be chosen (required)&lt;br /&gt;
* '''text''': a text to hover during the animation &lt;br /&gt;
* '''red''': red value for the text color (0-255)&lt;br /&gt;
* '''green''': green value for the text color&lt;br /&gt;
* '''blue''': blue value for the text color&lt;br /&gt;
* '''with_bars''': yes/no: whether to display the status bars during the animation (e.g. the hitpoint bar)&lt;br /&gt;
* '''[animate]''': a sub block with the same syntax as '''[animate_unit]''' except that the '''[filter]''' block is mandatory to find the unit. This block will find and animate another unit simultaneously.&lt;br /&gt;
* '''[facing]''': a [[StandardLocationFilter]] specifying what direction the unit should be facing when animated&lt;br /&gt;
&lt;br /&gt;
=== [label] ===&lt;br /&gt;
Places a label on the map.&lt;br /&gt;
* '''x''', '''y''': the location of the label&lt;br /&gt;
* '''text''': what the label should say&lt;br /&gt;
* '''team_name''': if specified, the label will only be visible to the given team.&lt;br /&gt;
* '''color''': color of the label. The format is r,g,b; r, g and b are numbers between 0 and 255.&lt;br /&gt;
* '''visible_in_fog''': whether the label should be visible through fog or not. Default yes.&lt;br /&gt;
* '''visible_in_shroud''': whether the label should be visible through shroud or not. Default no.&lt;br /&gt;
* '''immutable''': whether this label is protected from being removed or changed by players. Default yes.&lt;br /&gt;
=== [floating_text]===&lt;br /&gt;
Floats text (similar to the damage and healing numbers) on the given locations.&lt;br /&gt;
* [[StandardLocationFilter]]: the text will be floated on all matching locations simultaneously.&lt;br /&gt;
* '''text''': the text to display.&lt;br /&gt;
&lt;br /&gt;
The default text color is &amp;lt;span style=&amp;quot;color: #6b8cff;&amp;quot;&amp;gt;'''#6b8cff'''&amp;lt;/span&amp;gt;. To change the color, use [[#Formatting|Pango markup]]. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Float some golden yellow text at 20,20.&lt;br /&gt;
[floating_text]&lt;br /&gt;
   x,y=20,20&lt;br /&gt;
   text=&amp;quot;&amp;lt;span color='#cccc33'&amp;gt;&amp;quot; + _ &amp;quot;Your text here&amp;quot; + &amp;quot;&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
[/floating_text]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [deprecated_message] ===&lt;br /&gt;
Shows a deprecated message in the message area, this feature is only intended to be used to warn about deprecated macros in mainline. The message is not translatable.&lt;br /&gt;
* '''message''': the message to show.&lt;br /&gt;
=== [wml_message] ===&lt;br /&gt;
Outputs a message to Wesnoth's console output. Intended for campaign designers to output silent text to the console, without annoying the player; then, that text might contain information useful for later bug-reporting. The log domain for it is '''wml''', and the '''debug/dbg''' log level is available for use with the '''logger''' attribute. Depending on the current log level ('''error''' by default), which may be changed with the in-game :log command, or the --log-&amp;lt;level&amp;gt;=wml command line switch, the messages are echoed to the in-game chat.&lt;br /&gt;
* '''message''': the message to show.&lt;br /&gt;
* '''logger''': the Wesnoth engine output logger that should catch the text; this might be 'err' (the errors log level), 'warn'/'wrn' (the warnings log level) or anything else (the information log level). Not all information will be displayed depending on the log level chosen when starting Wesnoth.&lt;br /&gt;
&lt;br /&gt;
Note: As of 1.9.4/1.9.5 (r48805) the following &amp;quot;loggers&amp;quot; should work: If in [wml_message]: err/error, warn/wrn/warning, debug/dbg; using the :log command: Only the long forms error, warning, info and debug (this part gathered by trying rather than source inspecting). The long forms are most likely also the only ones working when starting wesnoth with --log-&amp;lt;level&amp;gt;=wml.&lt;br /&gt;
For log level warning or error (as during normal play), only wml_messages with logger error or warning display (for both). With logger info or debug, additionally wml_messages with logger info or debug display (for both).&lt;br /&gt;
&lt;br /&gt;
=== [open_help] ===&lt;br /&gt;
Opens the in-game help.&lt;br /&gt;
* '''topic''': the id of the topic to open&lt;br /&gt;
=== [show_objectives] ===&lt;br /&gt;
refreshes the objectives defined by [objectives] and its [show_if] tags, and displays them. (It is also called whenever the user explicitly asks for the objectives; this matters only if the tag was overridden by a [[LuaWML#register_wml_action|Lua]] script.)&lt;br /&gt;
* '''side''': the side to show the objectives. If not set, all sides are used.&lt;br /&gt;
* '''[[StandardSideFilter]]''' {{DevFeature1.11}} tags and keys: Tag affects the matching sides instead of just all or the one given by the integer value of the side= key.&lt;br /&gt;
&lt;br /&gt;
=== [chat] ===&lt;br /&gt;
Displays a message in the chat area.&lt;br /&gt;
* '''speaker''': (default=&amp;quot;WML&amp;quot;) A string for the name of the sender of the message.&lt;br /&gt;
* '''message''': The message that should be displayed.&lt;br /&gt;
* '''[[StandardSideFilter]]''' tags and keys as argument; if the same client controls multiple sides that match, then the message will only be displayed once.&lt;br /&gt;
&lt;br /&gt;
== Useful Macros ==&lt;br /&gt;
There are some predefined macros that you find useful for interface actions. You can find a complete list along with a detailed explanation of how they work [http://www.wesnoth.org/macro-reference.xhtml here].&lt;br /&gt;
* '''{HIGHLIGHT_UNIT}''' Highlight a unit on the map. Use this to show important units&lt;br /&gt;
* '''{HIGHLIGHT_IMAGE}''' Places and highlights an image on the map. Use this to show important items or locations&lt;br /&gt;
* '''{SET_IMAGE}''' Places an image on the map which has no other function.&lt;br /&gt;
* '''{QUAKE &amp;lt;soundfile&amp;gt;}''' Creates a tremor-like screenshake and plays &amp;lt;soundfile&amp;gt;. For example, '''{QUAKE (rumble.ogg)}'''.&lt;br /&gt;
* '''{FLASH_WHITE}''' Flash the screen white momentarily. You can also replace WHITE with RED, BLUE or GREEN for a different colour.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[DirectActionsWML]]&lt;br /&gt;
* [[InternalActionsWML]]&lt;br /&gt;
* [[EventWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;br /&gt;
[[Category: ActionsWML]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=InterfaceActionsWML&amp;diff=48426</id>
		<title>InterfaceActionsWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=InterfaceActionsWML&amp;diff=48426"/>
		<updated>2013-01-27T09:06:08Z</updated>

		<summary type="html">&lt;p&gt;Coffee: /* [item] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
== Interface actions ==&lt;br /&gt;
&lt;br /&gt;
Part of [[ActionWML]], interface actions are actions that do not have a direct effect on gameplay;&lt;br /&gt;
instead, they show something to the player.  The main interface tags&lt;br /&gt;
are '''[message]''' and '''[objectives]''', but several other tags affect&lt;br /&gt;
the interface also.&lt;br /&gt;
&lt;br /&gt;
== [inspect] ==&lt;br /&gt;
This user interface action only works in debug mode. It displays the gamestate inspector dialog (the same one which can be brought up with '':inspect'' ), which can be used to inspect the values of WML variables, AI configuration, recall lists, and more.&lt;br /&gt;
&lt;br /&gt;
* '''name''': optional attribute to specify the name of this gamestate inspector dialog. It is just a label to help differentiate between different invocations of gamestate inspector dialog.&lt;br /&gt;
&lt;br /&gt;
== [message] ==&lt;br /&gt;
The most commonly used interface action is [message], which displays a message to the user in a dialog box. It can also be used to take input from the user.&lt;br /&gt;
&lt;br /&gt;
The following key/tags are accepted for [message]:&lt;br /&gt;
* [[StandardUnitFilter]]: The unit whose profile and name are displayed. Do not use a [filter] tag. If no unit matching this filter is found, the message is not displayed (The unit has probably been killed).&amp;lt;br&amp;gt;'''[message]''' elements should be constructed so that it is either guaranteed that a certain unit is alive, or so that dialog flows smoothly even if the message isn't displayed.&lt;br /&gt;
&lt;br /&gt;
* '''speaker''': an alternative to standard unit filter. You may specify as the value of the speaker attribute a unit id or any of the following special values:&lt;br /&gt;
** '''narrator''': the dialog box is displayed without a caption for the unit speaking or a unit image&lt;br /&gt;
** '''unit''': the primary unit for the event is speaking&lt;br /&gt;
** '''second_unit''': the secondary unit for the event is speaking&lt;br /&gt;
&lt;br /&gt;
* '''message''': (translatable) the text to display to the right of the image. ''message'' is sometimes multiple lines; if it is, be sure to use quotes(''' ' ''' or ''' &amp;quot; ''')&lt;br /&gt;
* '''[show_if]''': if present then this message will only be displayed if the conditional statement in this tag is passed (see [[ConditionalActionsWML#Condition_Tags|ConditionalActionsWML]])&lt;br /&gt;
* '''side_for''': (default: all sides) comma-separated list of sides for who message is shown.&lt;br /&gt;
* '''image''': (default: profile image of speaker) the image to display next to the message. Append ~RIGHT() if you want the image to appear on the right side.&lt;br /&gt;
* '''caption''': (default: name of speaker) the caption to display beside the image. Name to be displayed. Note: use a translation mark to avoid wmllint errors.&lt;br /&gt;
* '''scroll''': Boolean specifying whether the game view should scroll to the speaking unit. Defaults to ''yes''.&lt;br /&gt;
* '''duration''': (default: 10) the minimum number of frames for this message to be displayed. (A frame lasts about 30 milliseconds.) During this time any dialog decisions will be disregarded.&lt;br /&gt;
* '''sound''': a sound effect (wav file) to play as the message is displayed. This can be a comma-separated list, from which one will be randomly chosen.&lt;br /&gt;
* '''[option]''': No '''[option]''' elements have to be used. If '''[option]''' elements are present, then each option will be displayed in a menu for the user to select one option.&lt;br /&gt;
** '''message''': (translatable) the text displayed for the option (see [[DescriptionWML]])&lt;br /&gt;
** '''[show_if]''': if present then this option will only be displayed if the conditional statement in this tag is passed (see [[ConditionalActionsWML#Condition_Tags|ConditionalActionsWML]])&lt;br /&gt;
** '''[command]''': an element containing actions which are executed if the option is selected.&lt;br /&gt;
* '''[text_input]''': there can be only one [text_input] tag. this adds a text input field to the message.&lt;br /&gt;
** '''variable''': the variable that the user's input will be written to&lt;br /&gt;
** '''label''': a text label to the left of the input field&lt;br /&gt;
** '''max_length''': the maximum number of characters that may be typed into the field&lt;br /&gt;
** '''text''': text that is written into the field in the beginning&lt;br /&gt;
* Check [[EventWML#Multiplayer_safety]] to find out in which events you can safely use '''[option]''' and '''[text_input]''' without causing OOS.&lt;br /&gt;
&lt;br /&gt;
=== Formatting ===&lt;br /&gt;
In 1.8, [http://developer.gnome.org/pango/unstable/PangoMarkupFormat.html Pango markup formatting codes] have been adopted for '''[message]'''. These can also be used in unit names (user_description), objectives, and such. Note that you'll probably want to use a single quote ' instead of a double quote &amp;quot; as double quotes cannot be escaped, otherwise the string will appear fragmented and you may also encounter errors. Running wmllint on your campaign will up-convert it, warning you about unusual cases you must fix by hand.&lt;br /&gt;
&lt;br /&gt;
For example, if you wanted to write &amp;quot;You are victorious!&amp;quot; in large, italic, gold letters, you might write it this way:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;span color='#BCB088' size='large' font-style='italic'&amp;gt;You are victorious!&amp;lt;/span&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
These are the codes taken from the Pango markup formatting guide:&lt;br /&gt;
&lt;br /&gt;
*'''font''', '''font_desc''': A font description string, such as &amp;quot;Sans Italic 12&amp;quot;.&lt;br /&gt;
*'''font_family''', '''face''': A font family name.&lt;br /&gt;
*'''font_size''', '''size''': Font size in 1024ths of a point, or one of the absolute sizes 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', or one of the relative sizes 'smaller' or 'larger'.&lt;br /&gt;
*'''font_style''', '''style''': One of 'normal', 'oblique', 'italic'.&lt;br /&gt;
*'''font_weight''', '''weight''': One of 'ultralight', 'light', 'normal', 'bold', 'ultrabold', 'heavy', or a numeric weight.&lt;br /&gt;
*'''font_variant''', '''variant''': One of 'normal' or 'smallcaps'.&lt;br /&gt;
*'''font_stretch''', '''stretch''': One of 'ultracondensed', 'extracondensed', 'condensed', 'semicondensed', 'normal', 'semiexpanded', 'expanded', 'extraexpanded', 'ultraexpanded'.&lt;br /&gt;
*'''foreground''', '''fgcolor''', '''color''': An RGB color specification such as '#00FF00' or a color name such as 'red'.&lt;br /&gt;
*'''background, bgcolor''': An RGB color specification such as '#00FF00' or a color name such as 'red'.&lt;br /&gt;
*'''underline''': One of 'none', 'single', 'double', 'low', 'error'.&lt;br /&gt;
*'''underline_color''': The color of underlines; an RGB color specification such as '#00FF00' or a color name such as 'red'.&lt;br /&gt;
*'''rise''': Vertical displacement, in 10000ths of an em. Can be negative for subscript, positive for superscript.&lt;br /&gt;
*'''strikethrough''': 'true' or 'false' whether to strike through the text.&lt;br /&gt;
*'''strikethrough_color''': The color of strikethrough lines; an RGB color specification such as '#00FF00' or a color name such as 'red'&lt;br /&gt;
*'''fallback''': 'true' or 'false' whether to enable fallback. If disabled, then characters will only be used from the closest matching font on the system. No fallback will be done to other fonts on the system that might contain the characters in the text. Fallback is enabled by default. Most applications should not disable fallback.&lt;br /&gt;
*'''letter_spacing''': Inter-letter spacing in 1024ths of a point.&lt;br /&gt;
*'''gravity''': One of 'south', 'east', 'north', 'west', 'auto'.&lt;br /&gt;
*'''gravity_hint''': One of 'natural', 'strong', 'line'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In 1.6, Wesnoth uses older text formatting options&lt;br /&gt;
* A tilde (~) as the first character causes the line to be boldfaced.&lt;br /&gt;
* An at symbol (@) as the first character causes the line to be green, as done with victory conditions.&lt;br /&gt;
* A pound symbol (#) as the first character causes the line to be red, as done with defeat conditions.&lt;br /&gt;
* An asterisk (*) as the first character causes the line to be bigger.&lt;br /&gt;
* A backquote (`) as the first character causes the line to be smaller.&lt;br /&gt;
* If used, the caption key text is boldfaced.&lt;br /&gt;
* An RGB colour code in the beginning causes the line to be the given colour. This can still be preceded by the above characters. Example: ''message=_&amp;quot;&amp;lt;255,0,0&amp;gt;Red!&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
== [objectives] ==&lt;br /&gt;
The other tag used for plot development is '''[objectives]'''.&lt;br /&gt;
The '''[objectives]''' tag overwrites any previously set objectives,&lt;br /&gt;
and displays text which should describe the objectives of the scenario.&lt;br /&gt;
Scenario objectives are displayed on the player's first turn after the tag is used,&lt;br /&gt;
or as part of the event if it triggers during that player's turn.&lt;br /&gt;
Objectives can also be accessed at any time in a scenario using the&lt;br /&gt;
&amp;quot;Scenario Objectives&amp;quot; game menu option, making this tag useful for&lt;br /&gt;
scenario-specific information that the player may need to refer to during play.&lt;br /&gt;
&lt;br /&gt;
Attributes of '''[objectives]''':&lt;br /&gt;
* '''side''': Default '0'. The side to set the objectives for. A value of 0 sets objectives for all sides. note: There are side-specific objectives and default objectives, which are used in case a side doesn't have specific ones. Specifying 0 sets the default ones.&lt;br /&gt;
* '''[[StandardSideFilter]]''' {{DevFeature1.11}} tags and keys: Sets the objectives of all matching sides to these passed specifications (the rest of this [objectives] tag). If no sides (such as when passing side=0) or all sides match, sets the default objectives, and the side specific ones for the matching sides otherwise.&lt;br /&gt;
* '''bullet''': Default '• '. Replaces the default bullet, with whatever is passed, for all objectives, gold carryover notes, and notes defined with [note].&lt;br /&gt;
* '''summary''': Displayed first in the objectives text, this should describe the basic objective for the overall scenario.  Can be omitted.&lt;br /&gt;
* '''note''': Displayed last in the objectives text, this is sometimes used for hints or additional information.  Can be omitted.&lt;br /&gt;
* '''victory_string''': Default ' _ &amp;quot;Victory:&amp;quot;', this text precedes the victory objectives.&lt;br /&gt;
* '''defeat_string''': Default ' _ &amp;quot;Defeat:&amp;quot;', this text precedes the defeat objectives.&lt;br /&gt;
* '''gold_carryover_string''': Default ' _ &amp;quot;Gold carryover:&amp;quot;', this text precedes the gold carryover information.&lt;br /&gt;
* '''notes_string''': Default ' _ &amp;quot;Notes:&amp;quot;', this text precedes the notes.&lt;br /&gt;
* '''silent''': Default: not present. If set to &amp;quot;yes&amp;quot;, the objectives are silently changed. Else, they will be shown to the user when appropriate.&lt;br /&gt;
&lt;br /&gt;
Tags of '''[objectives]''':&lt;br /&gt;
* '''[objective]''': describes a win or loss condition. Most scenarios have multiple win or loss conditions, so use a separate [objective] subtag for each line; this helps with translations.&lt;br /&gt;
** '''bullet''': Default '• ' or whatever is set in the parent [objectives] block. Replaces the default bullet, with whatever is provided, for the objective defined by the [objective] block.&lt;br /&gt;
** '''red''': Default '0' for winning objectives, '255' for losing objectives. Overrides the default red coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''green''': Default '255' for winning objectives, '0' for losing objectives. Overrides the default green coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''blue''': Default '0'. Overrides the default blue coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''description''': text for the specific win or loss condition.&lt;br /&gt;
** '''condition''': The color and placement of the text. Values are 'win'(colored green, placed after ''victory_string'') and 'lose'(colored red, placed after ''defeat_string'')&lt;br /&gt;
** '''show_turn_counter''': If set to yes, displays the number of turns remaining in the scenario. Default is no.&lt;br /&gt;
** '''[show_if]''': A condition that disables the objective if it doesn't hold. Conditional objectives are refreshed at '''[show_objectives]''' time only.&lt;br /&gt;
* '''[gold_carryover]''': describes how the gold carryover works in this scenario. This is intended to be a more convenient way of displaying carryover information than using the note= key in [objectives].&lt;br /&gt;
** '''bullet''': Default '• ' or whatever is set in the parent [objectives] block. Replaces the default bullet with whatever is provided.&lt;br /&gt;
** '''red''': Default '255'. Overrides the default red coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''green''': Default '255'. Overrides the default green coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''blue''': Default '192'. Overrides the default blue coloring of the entire objective, including the bullet.&lt;br /&gt;
** '''bonus''' (boolean): whether an early finish bonus is granted. If omitted, early finish bonus is not mentioned.&lt;br /&gt;
** '''carryover_percentage''': the amount of carryover gold. If omitted, the amount is not mentioned.&lt;br /&gt;
* '''[note]''': describes a note, usually used for hints or additional information. This is an easier way of adding several notes than concatenating them together into a single string to use with the ''note='' key.&lt;br /&gt;
** '''bullet''': Default '• ' or whatever is set in the parent [objectives] block. Replaces the default bullet with whatever is provided for the note defined by the [note] block.&lt;br /&gt;
** '''red''': Default '255'. Overrides the default red coloring of the entire note, including the bullet.&lt;br /&gt;
** '''green''': Default '255'. Overrides the default green coloring of the entire note, including the bullet.&lt;br /&gt;
** '''blue''': Default '255'. Overrides the default blue coloring of the entire note, including the bullet.&lt;br /&gt;
** '''description''': the text of the note.&lt;br /&gt;
** {{DevFeature1.11}} '''[show_if]''': The note will not be shown if the specified condition isn't met. Conditional notes are refreshed at '''[show_objectives]''' time only.&lt;br /&gt;
&lt;br /&gt;
== [set_menu_item] ==&lt;br /&gt;
This tag is used to add a custom option in the right-click context menu which can then be used to trigger arbitrary WML commands.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Due to limitations in portable devices where there are no scroll bars for context menus, there is a hard-coded limit of 7 custom WML menu items. If you really need to have more than 7 menu items, try combining some of them in a submenu.&lt;br /&gt;
&lt;br /&gt;
* '''id''': the unique id for this menu item. If a menu item with this id already exists, it allows you to set specific changes to that item.&lt;br /&gt;
* '''description''': the in-game text that will appear for this item in the menu.&lt;br /&gt;
* '''image''': the image to display next to this item.&lt;br /&gt;
* '''needs_select''': if ''yes'' (default ''no''), then the latest select event (see [[EventWML]]) that triggered before this menu item was chosen will be transmitted over the network before this menu item action will be. This only has any effect in networked multiplayer, and is intended to allow more elaborate menu item behaviour there without causing out of sync errors. If you don't know what this means, just leave it false.&lt;br /&gt;
* '''[show_if]''': If present, the menu item will only be available if the conditional statement (see [[ConditionalActionsWML#Condition_Tags|ConditionalActionsWML]]) within evaluates to true. When this is evaluated, the WML variables ''$x1'' and ''$y1'' will point to the location on which the context menu was invoked, so it's possible to for example only enable the option on empty hexes or on a particular unit.&lt;br /&gt;
* '''[filter_location]''': contains a location filter similar to the one found inside Single Unit Filters (see [[FilterWML]]). The menu item will only be available on matching locations.&lt;br /&gt;
* '''[command]''': contains the WML actions to be executed when the menu item is selected. Again, the WML variables ''$x1'' and ''$y1'' will point to the location on which the context menu was invoked on.&lt;br /&gt;
** '''delayed_variable_substitution ''' {{DevFeature1.11}} (boolean yes|no, default: yes): If no, forces a variable substitution run onto the wml included in this [command] block. Use this, if you want variables which are to substitute to get the values they have at execution time of the event where this set_menu_item appears. Other than that, they get the values they have at invocation time of the menu item.&lt;br /&gt;
&lt;br /&gt;
== [clear_menu_item] ==&lt;br /&gt;
{{DevFeature1.11}}&lt;br /&gt;
&lt;br /&gt;
Removes a menu item from the scenario.&lt;br /&gt;
Normally menu items are, including all their defining wml, automatically carried over between scenarios. This tag prevents this. (The behavior is comparable to set_variable/clear_variable).&lt;br /&gt;
* '''id''': (string): id of the menu item to clear. Can be a comma-separated list.&lt;br /&gt;
&lt;br /&gt;
== Other interface tags ==&lt;br /&gt;
&lt;br /&gt;
The following tags are also action tags:&lt;br /&gt;
=== [item] ===&lt;br /&gt;
Makes a graphical item appear on a certain hex. Note this only places the graphics for an item. It does not make the item do anything. Use a moveto event to make moving onto the item do something. &amp;lt;tt&amp;gt;''('''Hint:''' There are a number of predefined items that are used in various campaigns that you can make use of. You can find [http://www.wesnoth.org/macro-reference.xhtml#file:items.cfg a list of them] if you look into the items.cfg file in the wesnoth install directory (under /data/core/macros).)''&amp;lt;/tt&amp;gt;&lt;br /&gt;
* '''x''', '''y''': the location to place the item. (only for [event][item]: full [[StandardLocationFilter|SLF]] support)&lt;br /&gt;
* '''image''': the image (in ''images/'' as .png) to place on the hex. This image is aligned with the top-left of the hex (which is 72 pixels wide and 72 pixels tall). It is drawn underneath units. ''('''Hint:''' If using an image smaller than 72x72, then it might be useful to [[ImagePathFunctionWML#Blit_Function|BLIT]] the image onto &amp;lt;tt&amp;gt;misc/blank-hex.png&amp;lt;/tt&amp;gt; (a blank 72x72 image).)''&lt;br /&gt;
* '''halo''': an image to place centered on the hex. It is drawn on top of units. Use this instead of ''image'' if the image is bigger than the hex or if you want to animate an image. ''Example (where the integer after the colon is the duration of each frame or suqare bracket expansion as per AnimationWML is used): halo=scenery/fire1.png:100,scenery/fire2.png:100,scenery/fire3.png:100,scenery/fire4.png:100,scenery/fire5.png:100,scenery/fire6.png:100,scenery/fire7.png:100,scenery/fire8.png:100 or equivalently halo=scenery/fire[1-8].png:100''&lt;br /&gt;
* '''team_name''': name of the team for which the item is to be displayed (hidden for others). For multiple teams just put all the names in one string, for example separated by commas.&lt;br /&gt;
* '''visible_in_fog''': whether the item should be visible through fog or not. Default yes.&lt;br /&gt;
* '''redraw''': {{DevFeature1.11}}(boolean yes|no, default: yes): If no, disables implicit calls to [[InterfaceActionsWML#.5Bredraw.5D|[redraw]]] when placing the items.&lt;br /&gt;
&lt;br /&gt;
=== [remove_item] ===&lt;br /&gt;
Removes any graphical items on a given hex.&lt;br /&gt;
* [[StandardLocationFilter]]: the hexes to remove items off&lt;br /&gt;
* '''image''' if specified, only removes the given image item (This image name must include any [[ImagePathFunctionWML|image path functions]] appended to the original image name.)&lt;br /&gt;
&lt;br /&gt;
=== [print] ===&lt;br /&gt;
Displays a message across the screen. The message will disappear after a certain time.&lt;br /&gt;
* '''text''': (translatable) the text to display.&lt;br /&gt;
* '''size''': (default=12) the pointsize of the font to use&lt;br /&gt;
* '''duration''': (default=50) the length of time to display the text for. This is measured in the number of 'frames'. A frame in Wesnoth is usually displayed for around 30ms.&lt;br /&gt;
* '''red''', '''green''', '''blue''': (default=0,0,0) the color to display the text in. Values vary from 0-255.&lt;br /&gt;
=== [move_unit_fake] ===&lt;br /&gt;
Moves an image of a unit along a certain path on the map. The path does not need to be a continuous list of adjacent hexes, so for example only the start and end points can be given, in which case the straightest line between those points will be calculated and used.&lt;br /&gt;
* '''type''': the type of the unit whose image to use&lt;br /&gt;
* '''x''': a comma-separated list of x locations to move along&lt;br /&gt;
* '''y''': a comma-separated list of y locations to move along (x and y values are matched pairs)&lt;br /&gt;
* '''side''': the side of the fake unit, used for team-coloring the fake unit&lt;br /&gt;
* '''gender''': the gender of the fake unit. Example: gender=female&lt;br /&gt;
* '''variation''': the variation of the fake unit. Example: variation=undead&lt;br /&gt;
* '''image_mods''': [[ImagePathFunctionWML|image path functions]] sequence to be applied on the fake unit.&lt;br /&gt;
=== [move_units_fake] ===&lt;br /&gt;
moves multiple images of units along paths on the map. These units are moved in lockstep.&lt;br /&gt;
* '''[fake_unit]''': A fake unit to move&lt;br /&gt;
** '''type''': the type of unit whose image to use&lt;br /&gt;
** '''x''': a comma-separated list of x locations to move along&lt;br /&gt;
** '''y''': a comma-separated list of y locations to move along (x and y values are matched pairs)&lt;br /&gt;
** '''side''': the side of the fake unit, used for team-coloring the fake unit&lt;br /&gt;
** '''skip_steps''': the number of steps to skip before this unit starts moving&lt;br /&gt;
=== [hide_unit] ===&lt;br /&gt;
Temporarily prevents the engine from displaying the given unit. The unit does not become invisible, as it would be with the '''[hides]''' ability; it is still the same plain unit, but without an image. Useful in conjunction with '''[move_unit_fake]''': to move a leader unit into position on-screen. Until 1.8 each '''[hide_unit]''' tag only hides one unit.&lt;br /&gt;
* [[StandardUnitFilter]]: All matching units will be hidden&lt;br /&gt;
&lt;br /&gt;
=== [unhide_unit] ===&lt;br /&gt;
Stops the currently hidden units from being hidden.&lt;br /&gt;
* [[StandardUnitFilter]]: Only the matching units will be unhidden&lt;br /&gt;
&lt;br /&gt;
=== [lock_view] ===&lt;br /&gt;
{{DevFeature1.11}} Locks gamemap view scrolling for human players, so they cannot scroll the gamemap view until it is unlocked. WML or Lua actions such as '''[scroll_to]''' will continue to work normally, as they ignore this restriction; the locked/unlocked state is preserved when saving the current game.&lt;br /&gt;
&lt;br /&gt;
This feature is generally intended to be used in cutscenes to prevent the player scrolling away from scripted actions. &lt;br /&gt;
&lt;br /&gt;
=== [unlock_view] ===&lt;br /&gt;
{{DevFeature1.11}} Unlocks gamemap view scrolling for human players.&lt;br /&gt;
&lt;br /&gt;
=== [scroll] ===&lt;br /&gt;
Scroll a certain number of pixels in a given direction. Useful for earthquake/shaking effects.&lt;br /&gt;
* '''x''', '''y''': the number of pixels to scroll along the x and y axis&lt;br /&gt;
=== '''[scroll_to]''' ===&lt;br /&gt;
Scroll to a given hex&lt;br /&gt;
* '''x''', '''y''': the hex to scroll to&lt;br /&gt;
* {{DevFeature1.11}} [[StandardLocationFilter]], do not use a [filter_location] sub-tag. If more than one location matches the filter, only the first matching location will be used.&lt;br /&gt;
* '''check_fogged''': whether to scroll even to locations covered in fog or shroud. Possible values ''true'' (don't scroll to fog) and ''false'' (scroll even to fog), with ''false'' as the default.&lt;br /&gt;
* {{DevFeature1.11}} '''immediate''': whether to instantly warp to the target hex regardless of the scroll speed setting in Preferences (defaults to ''false'').&lt;br /&gt;
&lt;br /&gt;
=== [scroll_to_unit] ===&lt;br /&gt;
Scroll to a given unit&lt;br /&gt;
* [[StandardUnitFilter]]&lt;br /&gt;
* '''check_fogged''': whether to scroll even to locations covered in fog or shroud. Possible values ''true'' (don't scroll to fog) and ''false'' (scroll even to fog), with ''false'' as the default.&lt;br /&gt;
* {{DevFeature1.11}} '''immediate''': whether to instantly warp to the target hex regardless of the scroll speed setting in Preferences (defaults to ''false'').&lt;br /&gt;
=== [select_unit] ===&lt;br /&gt;
Selects a given unit.&lt;br /&gt;
* [[StandardUnitFilter]]: The first unit found will be selected.&lt;br /&gt;
* '''fire_event''': whether a ''select'' event should be triggered or not (def. ''no''). (Note that select events aren't multiplayer save.)&lt;br /&gt;
* '''highlight''': whether the unit's current hex should be highlighted (def. ''yes'').&lt;br /&gt;
&lt;br /&gt;
=== [sound]===&lt;br /&gt;
Plays a sound&lt;br /&gt;
* '''name''': the filename of the sound to play (in ''sounds/'' as .wav or .ogg)&lt;br /&gt;
* '''repeat''': repeats the sound for a specified additional number of times (default=0)&lt;br /&gt;
=== [sound_source] ===&lt;br /&gt;
Creates a sound source. &amp;quot;Sound sources&amp;quot; is a general name for a mechanism which makes possible for map elements to emit sounds according to some rules, where &amp;quot;map elements&amp;quot; can be specific locations or terrain types. For now, only sound sources tied to locations are supported.&lt;br /&gt;
* '''id''': a unique identification key of the sound source&lt;br /&gt;
* '''sounds''': a list of comma separated, randomly played sounds associated with the sound source&lt;br /&gt;
* '''delay''': a numerical value (in milliseconds) of the minimal delay between two playbacks of the source's sound if the source remains visible on the screen; if one scrolls out and back in, the source will be considered as ready to play&lt;br /&gt;
* '''chance''': a percentage (a value from 0 to 100) describing the chance of the source being activated every second after the delay has passed or when the source's location appears on the screen (note that it cannot play more than one file at the same time)&lt;br /&gt;
* '''check_fogged''': possible values &amp;quot;true&amp;quot; and &amp;quot;false&amp;quot; - if true the source will not play if its locations are fogged&lt;br /&gt;
* '''check_shrouded''': possible values &amp;quot;true&amp;quot; and &amp;quot;false&amp;quot; - if true the source will not play if its locations are shrouded&lt;br /&gt;
* '''x,y''': similar to x,y as found in a [[StandardLocationFilter]], these are the locations associated with the sound source&lt;br /&gt;
* '''fade_range''' (default = 3): distance in hexes that determines a &amp;quot;circular&amp;quot; area around the one specified by '''full_range''' where sound volume fades out linearly&lt;br /&gt;
* '''full_range''' (default = 14): distance in hexes that determines a &amp;quot;circular&amp;quot; area where source plays with full volume, relative to screen center&lt;br /&gt;
* '''loop''': number of times a sound sample should be looped if it stays visible. -1 means infinite (~65000)&lt;br /&gt;
&lt;br /&gt;
=== [remove_sound_source] ===&lt;br /&gt;
Removes a previously defined sound source.&lt;br /&gt;
* '''id''': the identification key of the sound source to remove&lt;br /&gt;
&lt;br /&gt;
=== [music]===&lt;br /&gt;
Switches to playing different music&lt;br /&gt;
* '''name''': the filename of the music to play (in ''music/'' as .ogg)&lt;br /&gt;
* see [[MusicListWML]] for the correct syntax&lt;br /&gt;
===[volume]===&lt;br /&gt;
Changes the game volume to a percent of the preferences volume for the game being played. Values can go from 0 to 100:  &lt;br /&gt;
* '''music''':  Changes the music volume.&lt;br /&gt;
* '''sound''':  Changes the sound volume.&lt;br /&gt;
=== [color_adjust]===&lt;br /&gt;
Tints the color of the screen.&lt;br /&gt;
* '''red''', '''green''', '''blue''': values from -255 to 255, the amount to tint by for each color&lt;br /&gt;
=== [delay] ===&lt;br /&gt;
Pauses the game.&lt;br /&gt;
* '''time''': the time to pause in milliseconds&lt;br /&gt;
=== [redraw] ===&lt;br /&gt;
Redraws the screen (this normally isn't done during events, although some of the other interface actions cause the screen or parts of it to be redrawn).&lt;br /&gt;
* '''clear_shroud''' (boolean yes|no, default no): If yes, clears fog and shroud around existing units. Useful if you, for example, spawn friendly units in the middle of an event and want the shroud to update accordingly (otherwise units that spawn inside fog would remain invisible for the duration of the event, since the fog would not automatically get cleared around them).&lt;br /&gt;
* '''[[StandardSideFilter]]''': the sides for which to recalculate fog and shroud.&lt;br /&gt;
* '''side''': If used (forces clear_shroud=yes), clears fog and shroud for that side.&lt;br /&gt;
&lt;br /&gt;
=== [unit_overlay] ===&lt;br /&gt;
Sets an image that will be drawn over a particular unit, and follow it around&lt;br /&gt;
* [[StandardUnitFilter]]: All matching units will get the overlay (do not use [filter])&lt;br /&gt;
* '''image''': the image to place on the unit&lt;br /&gt;
&lt;br /&gt;
=== [remove_unit_overlay] ===&lt;br /&gt;
removes a particular overlayed image from a unit&lt;br /&gt;
* [[StandardUnitFilter]]: The overlay will get removed from all matching units (do not use [filter])&lt;br /&gt;
* '''image''': the image to remove from the unit&lt;br /&gt;
&lt;br /&gt;
=== [animate_unit] ===&lt;br /&gt;
Uses an animation of a unit to animate it on screen (if the unit has the corresponding animation).&lt;br /&gt;
* '''flag''': The key to find the custom animation in the unit description (see the '''[extra_anim]''' description in [[AnimationWML]]). Standard animations can be triggered with the following keywords: ''leading recruited standing idling levelout levelin healing healed poisoned movement defend attack death victory pre_teleport post_teleport''&lt;br /&gt;
* '''[filter]''' with a [[StandardUnitFilter]] as argument, see [[FilterWML]]. By default, the unit at the event location will be animated. You can use this tag to choose any other unit to animate.&lt;br /&gt;
* '''[primary_attack]''': If this tag is not present, the filter for animation will be triggered with no attack. If it is here, all attacks from the unit will be filtered, and a matching one will be used to filter the animation. Takes a weapon filter as argument, see [[FilterWML]].&lt;br /&gt;
* '''[secondary_attack]''': Similar to '''[primary_attack]'''. May be needed to trigger a defense animation correctly, if there are more than one animations available for the defending unit.&lt;br /&gt;
* '''hits''': yes/no/hit/miss/kill: which according variation of a attack/defense animation shall be chosen (required)&lt;br /&gt;
* '''text''': a text to hover during the animation &lt;br /&gt;
* '''red''': red value for the text color (0-255)&lt;br /&gt;
* '''green''': green value for the text color&lt;br /&gt;
* '''blue''': blue value for the text color&lt;br /&gt;
* '''with_bars''': yes/no: whether to display the status bars during the animation (e.g. the hitpoint bar)&lt;br /&gt;
* '''[animate]''': a sub block with the same syntax as '''[animate_unit]''' except that the '''[filter]''' block is mandatory to find the unit. This block will find and animate another unit simultaneously.&lt;br /&gt;
* '''[facing]''': a [[StandardLocationFilter]] specifying what direction the unit should be facing when animated&lt;br /&gt;
&lt;br /&gt;
=== [label] ===&lt;br /&gt;
Places a label on the map.&lt;br /&gt;
* '''x''', '''y''': the location of the label&lt;br /&gt;
* '''text''': what the label should say&lt;br /&gt;
* '''team_name''': if specified, the label will only be visible to the given team.&lt;br /&gt;
* '''color''': color of the label. The format is r,g,b; r, g and b are numbers between 0 and 255.&lt;br /&gt;
* '''visible_in_fog''': whether the label should be visible through fog or not. Default yes.&lt;br /&gt;
* '''visible_in_shroud''': whether the label should be visible through shroud or not. Default no.&lt;br /&gt;
* '''immutable''': whether this label is protected from being removed or changed by players. Default yes.&lt;br /&gt;
=== [floating_text]===&lt;br /&gt;
Floats text (similar to the damage and healing numbers) on the given locations.&lt;br /&gt;
* [[StandardLocationFilter]]: the text will be floated on all matching locations simultaneously.&lt;br /&gt;
* '''text''': the text to display.&lt;br /&gt;
&lt;br /&gt;
The default text color is &amp;lt;span style=&amp;quot;color: #6b8cff;&amp;quot;&amp;gt;'''#6b8cff'''&amp;lt;/span&amp;gt;. To change the color, use [[#Formatting|Pango markup]]. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Float some golden yellow text at 20,20.&lt;br /&gt;
[floating_text]&lt;br /&gt;
   x,y=20,20&lt;br /&gt;
   text=&amp;quot;&amp;lt;span color='#cccc33'&amp;gt;&amp;quot; + _ &amp;quot;Your text here&amp;quot; + &amp;quot;&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
[/floating_text]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [deprecated_message] ===&lt;br /&gt;
Shows a deprecated message in the message area, this feature is only intended to be used to warn about deprecated macros in mainline. The message is not translatable.&lt;br /&gt;
* '''message''': the message to show.&lt;br /&gt;
=== [wml_message] ===&lt;br /&gt;
Outputs a message to Wesnoth's console output. Intended for campaign designers to output silent text to the console, without annoying the player; then, that text might contain information useful for later bug-reporting. The log domain for it is '''wml''', and the '''debug/dbg''' log level is available for use with the '''logger''' attribute. Depending on the current log level ('''error''' by default), which may be changed with the in-game :log command, or the --log-&amp;lt;level&amp;gt;=wml command line switch, the messages are echoed to the in-game chat.&lt;br /&gt;
* '''message''': the message to show.&lt;br /&gt;
* '''logger''': the Wesnoth engine output logger that should catch the text; this might be 'err' (the errors log level), 'warn'/'wrn' (the warnings log level) or anything else (the information log level). Not all information will be displayed depending on the log level chosen when starting Wesnoth.&lt;br /&gt;
&lt;br /&gt;
Note: As of 1.9.4/1.9.5 (r48805) the following &amp;quot;loggers&amp;quot; should work: If in [wml_message]: err/error, warn/wrn/warning, debug/dbg; using the :log command: Only the long forms error, warning, info and debug (this part gathered by trying rather than source inspecting). The long forms are most likely also the only ones working when starting wesnoth with --log-&amp;lt;level&amp;gt;=wml.&lt;br /&gt;
For log level warning or error (as during normal play), only wml_messages with logger error or warning display (for both). With logger info or debug, additionally wml_messages with logger info or debug display (for both).&lt;br /&gt;
&lt;br /&gt;
=== [open_help] ===&lt;br /&gt;
Opens the in-game help.&lt;br /&gt;
* '''topic''': the id of the topic to open&lt;br /&gt;
=== [show_objectives] ===&lt;br /&gt;
refreshes the objectives defined by [objectives] and its [show_if] tags, and displays them. (It is also called whenever the user explicitly asks for the objectives; this matters only if the tag was overridden by a [[LuaWML#register_wml_action|Lua]] script.)&lt;br /&gt;
* '''side''': the side to show the objectives. If not set, all sides are used.&lt;br /&gt;
* '''[[StandardSideFilter]]''' {{DevFeature1.11}} tags and keys: Tag affects the matching sides instead of just all or the one given by the integer value of the side= key.&lt;br /&gt;
&lt;br /&gt;
=== [chat] ===&lt;br /&gt;
Displays a message in the chat area.&lt;br /&gt;
* '''speaker''': (default=&amp;quot;WML&amp;quot;) A string for the name of the sender of the message.&lt;br /&gt;
* '''message''': The message that should be displayed.&lt;br /&gt;
* '''[[StandardSideFilter]]''' tags and keys as argument; if the same client controls multiple sides that match, then the message will only be displayed once.&lt;br /&gt;
&lt;br /&gt;
== Useful Macros ==&lt;br /&gt;
There are some predefined macros that you find useful for interface actions. You can find a complete list along with a detailed explanation of how they work [http://www.wesnoth.org/macro-reference.xhtml here].&lt;br /&gt;
* '''{HIGHLIGHT_UNIT}''' Highlight a unit on the map. Use this to show important units&lt;br /&gt;
* '''{HIGHLIGHT_IMAGE}''' Places and highlights an image on the map. Use this to show important items or locations&lt;br /&gt;
* '''{SET_IMAGE}''' Places an image on the map which has no other function.&lt;br /&gt;
* '''{QUAKE &amp;lt;soundfile&amp;gt;}''' Creates a tremor-like screenshake and plays &amp;lt;soundfile&amp;gt;. For example, '''{QUAKE (rumble.ogg)}'''.&lt;br /&gt;
* '''{FLASH_WHITE}''' Flash the screen white momentarily. You can also replace WHITE with RED, BLUE or GREEN for a different colour.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[DirectActionsWML]]&lt;br /&gt;
* [[InternalActionsWML]]&lt;br /&gt;
* [[EventWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;br /&gt;
[[Category: ActionsWML]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=TerrainGraphicsWML&amp;diff=48425</id>
		<title>TerrainGraphicsWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=TerrainGraphicsWML&amp;diff=48425"/>
		<updated>2013-01-27T09:04:17Z</updated>

		<summary type="html">&lt;p&gt;Coffee: /* The toplevel [terrain_graphics] tag */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== The toplevel [terrain_graphics] tag ==&lt;br /&gt;
&lt;br /&gt;
For information about the multi-hex tiling system, see [[MultiHexTutorial]]&lt;br /&gt;
&lt;br /&gt;
In terrain graphics, in Wesnoth 1.8.x all images are assumed to be .png and relative to images/terrain/. For example, writing 'image=grassland' means that the image file is images/terrain/grassland.png.  In Wesnoth 1.9.x the .png extension is required.  This means that TerrainGraphicsWML is incompatible from 1.8.x to 1.9.x.&lt;br /&gt;
&lt;br /&gt;
The multi-hex tiling system adds a new top-level element to WML, [terrain_graphics].&lt;br /&gt;
A building rule is used to specify images to place when terrains are in a certain formation.&lt;br /&gt;
When a building rule is applied to a map, it is applied once to each coordinate on the map;&lt;br /&gt;
when it is applied to a coordinate then that coordinate is considered the ''base''.&lt;br /&gt;
All locations in '''[terrain_graphics]''' are relative to the base.&lt;br /&gt;
&lt;br /&gt;
The following keys/tags are recognized:&lt;br /&gt;
* '''[tile]''': whenever a building rule is applied, each [tile] tag corresponds to a tile on the map. The corresponding tile must match each condition contained in [tile] for the [tile] tag to match. All [tile] tags must match in order for a rule to match. If the rule for a [tile] tag is applied, each action within [tile] will be executed on the tile corresponding to that [tile] tag&lt;br /&gt;
** '''x''','''y''': standard coordinates - the location of the corresponding tile relative to the base.&lt;br /&gt;
** '''pos''': a shortcut to specifying coordinates. Used in combination with ''map''&lt;br /&gt;
** '''type''': a comma-separated list of terrain codes (See [[TerrainWML]], data/terrain.cfg). In order for a tile to match this condition, it must be one of the terrains specified. However, if the string is preceded by &amp;quot;!&amp;quot;, the terrain must not be listed in order to match. If the string is '*', or if it is empty, any tile matches.&lt;br /&gt;
** '''name''': for animated terrain this takes the form of a comma separated list of images with durations specified after ':'. A square bracket expansion can also be used as in AnimationWML (see in example below).&lt;br /&gt;
** '''set_flag''': a comma-separated list of strings. Attaches flags from that list to the corresponding tile if the rule matches. The only difference a flag makes is being detected by ''has_flag'' and ''no_flag'' in [tile]. This is determined by the order of the [terrain_graphics] tags; a tag after another one cannot influence it. See also ''has_flag'', ''no_flag''&lt;br /&gt;
** '''has_flag''': a comma-separated list of strings. Matches if all flags in that list are attached to the corresponding tile. Flags are attached using the ''set_flag'' key.&lt;br /&gt;
** '''no_flag''': a comma-separated list of strings. Matches if none of the flags in that list are attached to the corresponding tile. Flags are attached using the ''set_flag'' key.&lt;br /&gt;
** '''set_no_flag''': helper combining ''set_flag'' and ''no_flag''. Same effect as using them with the same flags. Added because it's the most common use; ''set_flag'' or ''no_flag'' can still be used to add flags in one group only. &lt;br /&gt;
** '''[image]''': images specified as a subtag to '''[tile]''' sets the images for a single tile.&lt;br /&gt;
*** '''layer''': an integer, usually negative. The more negative it is, the earlier it is drawn, and thus the farther &amp;quot;back&amp;quot; it is when compositing the terrain images together.&lt;br /&gt;
*** '''name''': the image to apply on this tile if appropriate&lt;br /&gt;
*** '''random_start''' (default: yes): Tells engine to start animation at random point instead of at the beginning for every tile&lt;br /&gt;
*** '''base''': specifies the point at which the image is considered to be for layering purposes.  ''base'' is specified as '''x,y''' where x and y indicate distances in pixels from the top-left corner of the '''image'''. This is translated to a certain pixel on the map, and all images with the ''base'' attribute are drawn from top-to-bottom in terms of these specified pixel positions '''on the map'''.&lt;br /&gt;
*** '''[variant]''': an alternate image to use for differing times of day&lt;br /&gt;
**** '''tod''': the time of day for which this variant applies. Accepts a comma separated list of times of day.&lt;br /&gt;
**** '''name''': the image to apply on this tile if appropriate&lt;br /&gt;
**** '''random_start''' (default: yes): Tells engine to start animation at random point instead of at the beginning for every tile&lt;br /&gt;
* '''[image]''': image may also be used directly in the rule, to specify multihex images. The following additional attributes are recognized for multihex images (as well as all the ones for images within '''[tile]''').&lt;br /&gt;
** '''center''': specifies the point which the image will be centered on. If it is not specified, the image will instead be aligned with the top left corner of the tile.&lt;br /&gt;
* '''probability''': the percent probability for each position that if the position matches, then the rule will be applied. Default is 100(%).  See [[TerrainGraphicsTutorial#Cumulative_Probabilities|Cumulative_Probabilities]] for mathematical complications.&lt;br /&gt;
* '''rotations''': 6 comma(''',''') separated input strings. A rule that contains this key is not actually checked against the terrain; it instead is used as a template to create 6 new rules, each corresponding to a rotated version of the current rule. Whenever a rotated version is applied, instances of @(at-sign)R0, @R1, ... @R6 in attributes in the [terrain_graphics] tag will be adjusted by the corresponding amount and replaced with the letters specified by that numbered rotation in the ''rotations'' list. Each value corresponds to the rotated version that is -Pi/3 (60° clockwise) from the previous version; the first value corresponds to the unrotated version.&amp;lt;br&amp;gt;For example, if '''rotations=n,ne,se,s,sw,nw''' and it is being rotated 120°, then &amp;quot;@R0&amp;quot;-&amp;gt;&amp;quot;@R2&amp;quot;-&amp;gt;&amp;quot;se&amp;quot;, &amp;quot;@R1&amp;quot;-&amp;gt;&amp;quot;@R3&amp;quot;-&amp;gt;&amp;quot;s&amp;quot;, ... &amp;quot;@R6&amp;quot;-&amp;gt;&amp;quot;@R1&amp;quot;-&amp;gt;&amp;quot;ne&amp;quot;.&amp;lt;br&amp;gt;Basically the important thing is that this lets the rule be applied in any of the six hex-directions, allowing you to adjust the name of the image files automatically.&lt;br /&gt;
* '''set_flag''','''has_flag''', '''no_flag''': shortcuts to putting these in the [tile] subtags; unbound attributes will apply to all [tile] subtags.&lt;br /&gt;
* '''map''': a shortcut for defining [tile] tags with ''type'' conditions. Inputs a multi-line string value visually describing the map. The lines are cut into words of 4 characters, which correspond to [tile] tags. The line types alternate between lines corresponding to relatively even-abciss tiles and lines preceded by two spaces corresponding to relatively odd-abciss tiles. Every two lines represent 1 row on the map.&lt;br /&gt;
&lt;br /&gt;
=== Words ===&lt;br /&gt;
&lt;br /&gt;
A ''word'' is a 4-character shortcut to a [tile] tag. There are different types of words:&lt;br /&gt;
* Usually a word is interpreted as being the input to the ''type'' key of the corresponding [tile]. That is, it creates a [tile] with the attribute '''type=''word'''''.&lt;br /&gt;
* A word can also be a digit followed by 3 spaces. In this case, it is a shortcut to the [tile] with the attribute '''pos=''word'''''. This is called ''anchoring''.&lt;br /&gt;
&lt;br /&gt;
In 1.3, the format is basically the same but the following changes are made&lt;br /&gt;
* A ''word'' no longer needs to be 4 characters but is comma separated and spaces and tabs may be used for padding&lt;br /&gt;
* The 2 spaces for odd lines in no longer used, instead a leading comma is used on these lines (before the comma spaces and tabs are allowed for padding)&lt;br /&gt;
* A ''word'' may only be a dot a star or an anchor. The terrain letter format was not used and hard to support in the new engine, so that support is dropped.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
To define a north-south 2-tile mountain, the following syntax can be used:&lt;br /&gt;
&lt;br /&gt;
 [terrain_graphics]&lt;br /&gt;
     [tile]&lt;br /&gt;
         x=0&lt;br /&gt;
         y=0&lt;br /&gt;
         type=Mm&lt;br /&gt;
         set_no_flag=&amp;quot;base&amp;quot;&lt;br /&gt;
     [/tile]&lt;br /&gt;
     [tile]&lt;br /&gt;
         x=0&lt;br /&gt;
         y=1&lt;br /&gt;
         type=Mm&lt;br /&gt;
         set_no_flag=&amp;quot;base&amp;quot;&lt;br /&gt;
     [/tile]&lt;br /&gt;
     [image]&lt;br /&gt;
          name=&amp;quot;mountain-n-s.png&amp;quot;&lt;br /&gt;
     [/image]&lt;br /&gt;
 [/terrain_graphics]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This represents a tile 1, and its six adjacent tiles 2, in the map notation.&lt;br /&gt;
&lt;br /&gt;
 .,   .,   .,   .&lt;br /&gt;
 ,  .,   2,   .,   .&lt;br /&gt;
 .,   2,   2,   .&lt;br /&gt;
 ,  .,   1,   .,   .&lt;br /&gt;
 .,   2,   2,   .&lt;br /&gt;
 ,  .,   2,   .,   .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To define an animated campfire at coordinates (4,5) with files &amp;quot;misc/fire-A01.png&amp;quot; to &amp;quot;misc/fire-A08.png&amp;quot; with an inter-frame transition time of 140, the following can be placed at the scenario top level (adapted from the CAMPFIRE macro):&lt;br /&gt;
&lt;br /&gt;
 [terrain_graphics]&lt;br /&gt;
     x,y=4,5&lt;br /&gt;
     [tile]&lt;br /&gt;
         x=0&lt;br /&gt;
         y=0&lt;br /&gt;
         [image]&lt;br /&gt;
             layer=0&lt;br /&gt;
             name=&amp;quot;misc/fire-A[01-08].png:140&amp;quot;&lt;br /&gt;
         [/image]&lt;br /&gt;
     [/tile]&lt;br /&gt;
 [/terrain_graphics]&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[MultiHexTutorial]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
* Ayin's [http://www.anathas.org/ayin/wesnoth/doc/terrain_graphics_wml detailed Terrain Graphics document]&lt;br /&gt;
* [[TerrainGraphicsTutorial]] - First half of Ayin's document, wikified&lt;br /&gt;
* [[TerrainGraphicsReference]] - Second (partial) half of Ayin's document, wikified&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=TerrainGraphicsWML&amp;diff=48424</id>
		<title>TerrainGraphicsWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=TerrainGraphicsWML&amp;diff=48424"/>
		<updated>2013-01-27T09:00:19Z</updated>

		<summary type="html">&lt;p&gt;Coffee: /* Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== The toplevel [terrain_graphics] tag ==&lt;br /&gt;
&lt;br /&gt;
For information about the multi-hex tiling system, see [[MultiHexTutorial]]&lt;br /&gt;
&lt;br /&gt;
In terrain graphics, in Wesnoth 1.8.x all images are assumed to be .png and relative to images/terrain/. For example, writing 'image=grassland' means that the image file is images/terrain/grassland.png.  In Wesnoth 1.9.x the .png extension is required.  This means that TerrainGraphicsWML is incompatible from 1.8.x to 1.9.x.&lt;br /&gt;
&lt;br /&gt;
The multi-hex tiling system adds a new top-level element to WML, [terrain_graphics].&lt;br /&gt;
A building rule is used to specify images to place when terrains are in a certain formation.&lt;br /&gt;
When a building rule is applied to a map, it is applied once to each coordinate on the map;&lt;br /&gt;
when it is applied to a coordinate then that coordinate is considered the ''base''.&lt;br /&gt;
All locations in '''[terrain_graphics]''' are relative to the base.&lt;br /&gt;
&lt;br /&gt;
The following keys/tags are recognized:&lt;br /&gt;
* '''[tile]''': whenever a building rule is applied, each [tile] tag corresponds to a tile on the map. The corresponding tile must match each condition contained in [tile] for the [tile] tag to match. All [tile] tags must match in order for a rule to match. If the rule for a [tile] tag is applied, each action within [tile] will be executed on the tile corresponding to that [tile] tag&lt;br /&gt;
** '''x''','''y''': standard coordinates - the location of the corresponding tile relative to the base.&lt;br /&gt;
** '''pos''': a shortcut to specifying coordinates. Used in combination with ''map''&lt;br /&gt;
** '''type''': a comma-separated list of terrain codes (See [[TerrainWML]], data/terrain.cfg). In order for a tile to match this condition, it must be one of the terrains specified. However, if the string is preceded by &amp;quot;!&amp;quot;, the terrain must not be listed in order to match. If the string is '*', or if it is empty, any tile matches. A square bracket expansion, as in animationWML for halos may be used.&lt;br /&gt;
** '''set_flag''': a comma-separated list of strings. Attaches flags from that list to the corresponding tile if the rule matches. The only difference a flag makes is being detected by ''has_flag'' and ''no_flag'' in [tile]. This is determined by the order of the [terrain_graphics] tags; a tag after another one cannot influence it. See also ''has_flag'', ''no_flag''&lt;br /&gt;
** '''has_flag''': a comma-separated list of strings. Matches if all flags in that list are attached to the corresponding tile. Flags are attached using the ''set_flag'' key.&lt;br /&gt;
** '''no_flag''': a comma-separated list of strings. Matches if none of the flags in that list are attached to the corresponding tile. Flags are attached using the ''set_flag'' key.&lt;br /&gt;
** '''set_no_flag''': helper combining ''set_flag'' and ''no_flag''. Same effect as using them with the same flags. Added because it's the most common use; ''set_flag'' or ''no_flag'' can still be used to add flags in one group only. &lt;br /&gt;
** '''[image]''': images specified as a subtag to '''[tile]''' sets the images for a single tile.&lt;br /&gt;
*** '''layer''': an integer, usually negative. The more negative it is, the earlier it is drawn, and thus the farther &amp;quot;back&amp;quot; it is when compositing the terrain images together.&lt;br /&gt;
*** '''name''': the image to apply on this tile if appropriate&lt;br /&gt;
*** '''random_start''' (default: yes): Tells engine to start animation at random point instead of at the beginning for every tile&lt;br /&gt;
*** '''base''': specifies the point at which the image is considered to be for layering purposes.  ''base'' is specified as '''x,y''' where x and y indicate distances in pixels from the top-left corner of the '''image'''. This is translated to a certain pixel on the map, and all images with the ''base'' attribute are drawn from top-to-bottom in terms of these specified pixel positions '''on the map'''.&lt;br /&gt;
*** '''[variant]''': an alternate image to use for differing times of day&lt;br /&gt;
**** '''tod''': the time of day for which this variant applies. Accepts a comma separated list of times of day.&lt;br /&gt;
**** '''name''': the image to apply on this tile if appropriate&lt;br /&gt;
**** '''random_start''' (default: yes): Tells engine to start animation at random point instead of at the beginning for every tile&lt;br /&gt;
* '''[image]''': image may also be used directly in the rule, to specify multihex images. The following additional attributes are recognized for multihex images (as well as all the ones for images within '''[tile]''').&lt;br /&gt;
** '''center''': specifies the point which the image will be centered on. If it is not specified, the image will instead be aligned with the top left corner of the tile.&lt;br /&gt;
* '''probability''': the percent probability for each position that if the position matches, then the rule will be applied. Default is 100(%).  See [[TerrainGraphicsTutorial#Cumulative_Probabilities|Cumulative_Probabilities]] for mathematical complications.&lt;br /&gt;
* '''rotations''': 6 comma(''',''') separated input strings. A rule that contains this key is not actually checked against the terrain; it instead is used as a template to create 6 new rules, each corresponding to a rotated version of the current rule. Whenever a rotated version is applied, instances of @(at-sign)R0, @R1, ... @R6 in attributes in the [terrain_graphics] tag will be adjusted by the corresponding amount and replaced with the letters specified by that numbered rotation in the ''rotations'' list. Each value corresponds to the rotated version that is -Pi/3 (60° clockwise) from the previous version; the first value corresponds to the unrotated version.&amp;lt;br&amp;gt;For example, if '''rotations=n,ne,se,s,sw,nw''' and it is being rotated 120°, then &amp;quot;@R0&amp;quot;-&amp;gt;&amp;quot;@R2&amp;quot;-&amp;gt;&amp;quot;se&amp;quot;, &amp;quot;@R1&amp;quot;-&amp;gt;&amp;quot;@R3&amp;quot;-&amp;gt;&amp;quot;s&amp;quot;, ... &amp;quot;@R6&amp;quot;-&amp;gt;&amp;quot;@R1&amp;quot;-&amp;gt;&amp;quot;ne&amp;quot;.&amp;lt;br&amp;gt;Basically the important thing is that this lets the rule be applied in any of the six hex-directions, allowing you to adjust the name of the image files automatically.&lt;br /&gt;
* '''set_flag''','''has_flag''', '''no_flag''': shortcuts to putting these in the [tile] subtags; unbound attributes will apply to all [tile] subtags.&lt;br /&gt;
* '''map''': a shortcut for defining [tile] tags with ''type'' conditions. Inputs a multi-line string value visually describing the map. The lines are cut into words of 4 characters, which correspond to [tile] tags. The line types alternate between lines corresponding to relatively even-abciss tiles and lines preceded by two spaces corresponding to relatively odd-abciss tiles. Every two lines represent 1 row on the map.&lt;br /&gt;
&lt;br /&gt;
=== Words ===&lt;br /&gt;
&lt;br /&gt;
A ''word'' is a 4-character shortcut to a [tile] tag. There are different types of words:&lt;br /&gt;
* Usually a word is interpreted as being the input to the ''type'' key of the corresponding [tile]. That is, it creates a [tile] with the attribute '''type=''word'''''.&lt;br /&gt;
* A word can also be a digit followed by 3 spaces. In this case, it is a shortcut to the [tile] with the attribute '''pos=''word'''''. This is called ''anchoring''.&lt;br /&gt;
&lt;br /&gt;
In 1.3, the format is basically the same but the following changes are made&lt;br /&gt;
* A ''word'' no longer needs to be 4 characters but is comma separated and spaces and tabs may be used for padding&lt;br /&gt;
* The 2 spaces for odd lines in no longer used, instead a leading comma is used on these lines (before the comma spaces and tabs are allowed for padding)&lt;br /&gt;
* A ''word'' may only be a dot a star or an anchor. The terrain letter format was not used and hard to support in the new engine, so that support is dropped.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
To define a north-south 2-tile mountain, the following syntax can be used:&lt;br /&gt;
&lt;br /&gt;
 [terrain_graphics]&lt;br /&gt;
     [tile]&lt;br /&gt;
         x=0&lt;br /&gt;
         y=0&lt;br /&gt;
         type=Mm&lt;br /&gt;
         set_no_flag=&amp;quot;base&amp;quot;&lt;br /&gt;
     [/tile]&lt;br /&gt;
     [tile]&lt;br /&gt;
         x=0&lt;br /&gt;
         y=1&lt;br /&gt;
         type=Mm&lt;br /&gt;
         set_no_flag=&amp;quot;base&amp;quot;&lt;br /&gt;
     [/tile]&lt;br /&gt;
     [image]&lt;br /&gt;
          name=&amp;quot;mountain-n-s.png&amp;quot;&lt;br /&gt;
     [/image]&lt;br /&gt;
 [/terrain_graphics]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This represents a tile 1, and its six adjacent tiles 2, in the map notation.&lt;br /&gt;
&lt;br /&gt;
 .,   .,   .,   .&lt;br /&gt;
 ,  .,   2,   .,   .&lt;br /&gt;
 .,   2,   2,   .&lt;br /&gt;
 ,  .,   1,   .,   .&lt;br /&gt;
 .,   2,   2,   .&lt;br /&gt;
 ,  .,   2,   .,   .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To define an animated campfire at coordinates (4,5) with files &amp;quot;misc/fire-A01.png&amp;quot; to &amp;quot;misc/fire-A08.png&amp;quot; with an inter-frame transition time of 140, the following can be placed at the scenario top level (adapted from the CAMPFIRE macro):&lt;br /&gt;
&lt;br /&gt;
 [terrain_graphics]&lt;br /&gt;
     x,y=4,5&lt;br /&gt;
     [tile]&lt;br /&gt;
         x=0&lt;br /&gt;
         y=0&lt;br /&gt;
         [image]&lt;br /&gt;
             layer=0&lt;br /&gt;
             name=&amp;quot;misc/fire-A[01-08].png:140&amp;quot;&lt;br /&gt;
         [/image]&lt;br /&gt;
     [/tile]&lt;br /&gt;
 [/terrain_graphics]&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[MultiHexTutorial]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
* Ayin's [http://www.anathas.org/ayin/wesnoth/doc/terrain_graphics_wml detailed Terrain Graphics document]&lt;br /&gt;
* [[TerrainGraphicsTutorial]] - First half of Ayin's document, wikified&lt;br /&gt;
* [[TerrainGraphicsReference]] - Second (partial) half of Ayin's document, wikified&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=TerrainGraphicsWML&amp;diff=48423</id>
		<title>TerrainGraphicsWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=TerrainGraphicsWML&amp;diff=48423"/>
		<updated>2013-01-27T08:59:21Z</updated>

		<summary type="html">&lt;p&gt;Coffee: /* Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== The toplevel [terrain_graphics] tag ==&lt;br /&gt;
&lt;br /&gt;
For information about the multi-hex tiling system, see [[MultiHexTutorial]]&lt;br /&gt;
&lt;br /&gt;
In terrain graphics, in Wesnoth 1.8.x all images are assumed to be .png and relative to images/terrain/. For example, writing 'image=grassland' means that the image file is images/terrain/grassland.png.  In Wesnoth 1.9.x the .png extension is required.  This means that TerrainGraphicsWML is incompatible from 1.8.x to 1.9.x.&lt;br /&gt;
&lt;br /&gt;
The multi-hex tiling system adds a new top-level element to WML, [terrain_graphics].&lt;br /&gt;
A building rule is used to specify images to place when terrains are in a certain formation.&lt;br /&gt;
When a building rule is applied to a map, it is applied once to each coordinate on the map;&lt;br /&gt;
when it is applied to a coordinate then that coordinate is considered the ''base''.&lt;br /&gt;
All locations in '''[terrain_graphics]''' are relative to the base.&lt;br /&gt;
&lt;br /&gt;
The following keys/tags are recognized:&lt;br /&gt;
* '''[tile]''': whenever a building rule is applied, each [tile] tag corresponds to a tile on the map. The corresponding tile must match each condition contained in [tile] for the [tile] tag to match. All [tile] tags must match in order for a rule to match. If the rule for a [tile] tag is applied, each action within [tile] will be executed on the tile corresponding to that [tile] tag&lt;br /&gt;
** '''x''','''y''': standard coordinates - the location of the corresponding tile relative to the base.&lt;br /&gt;
** '''pos''': a shortcut to specifying coordinates. Used in combination with ''map''&lt;br /&gt;
** '''type''': a comma-separated list of terrain codes (See [[TerrainWML]], data/terrain.cfg). In order for a tile to match this condition, it must be one of the terrains specified. However, if the string is preceded by &amp;quot;!&amp;quot;, the terrain must not be listed in order to match. If the string is '*', or if it is empty, any tile matches. A square bracket expansion, as in animationWML for halos may be used.&lt;br /&gt;
** '''set_flag''': a comma-separated list of strings. Attaches flags from that list to the corresponding tile if the rule matches. The only difference a flag makes is being detected by ''has_flag'' and ''no_flag'' in [tile]. This is determined by the order of the [terrain_graphics] tags; a tag after another one cannot influence it. See also ''has_flag'', ''no_flag''&lt;br /&gt;
** '''has_flag''': a comma-separated list of strings. Matches if all flags in that list are attached to the corresponding tile. Flags are attached using the ''set_flag'' key.&lt;br /&gt;
** '''no_flag''': a comma-separated list of strings. Matches if none of the flags in that list are attached to the corresponding tile. Flags are attached using the ''set_flag'' key.&lt;br /&gt;
** '''set_no_flag''': helper combining ''set_flag'' and ''no_flag''. Same effect as using them with the same flags. Added because it's the most common use; ''set_flag'' or ''no_flag'' can still be used to add flags in one group only. &lt;br /&gt;
** '''[image]''': images specified as a subtag to '''[tile]''' sets the images for a single tile.&lt;br /&gt;
*** '''layer''': an integer, usually negative. The more negative it is, the earlier it is drawn, and thus the farther &amp;quot;back&amp;quot; it is when compositing the terrain images together.&lt;br /&gt;
*** '''name''': the image to apply on this tile if appropriate&lt;br /&gt;
*** '''random_start''' (default: yes): Tells engine to start animation at random point instead of at the beginning for every tile&lt;br /&gt;
*** '''base''': specifies the point at which the image is considered to be for layering purposes.  ''base'' is specified as '''x,y''' where x and y indicate distances in pixels from the top-left corner of the '''image'''. This is translated to a certain pixel on the map, and all images with the ''base'' attribute are drawn from top-to-bottom in terms of these specified pixel positions '''on the map'''.&lt;br /&gt;
*** '''[variant]''': an alternate image to use for differing times of day&lt;br /&gt;
**** '''tod''': the time of day for which this variant applies. Accepts a comma separated list of times of day.&lt;br /&gt;
**** '''name''': the image to apply on this tile if appropriate&lt;br /&gt;
**** '''random_start''' (default: yes): Tells engine to start animation at random point instead of at the beginning for every tile&lt;br /&gt;
* '''[image]''': image may also be used directly in the rule, to specify multihex images. The following additional attributes are recognized for multihex images (as well as all the ones for images within '''[tile]''').&lt;br /&gt;
** '''center''': specifies the point which the image will be centered on. If it is not specified, the image will instead be aligned with the top left corner of the tile.&lt;br /&gt;
* '''probability''': the percent probability for each position that if the position matches, then the rule will be applied. Default is 100(%).  See [[TerrainGraphicsTutorial#Cumulative_Probabilities|Cumulative_Probabilities]] for mathematical complications.&lt;br /&gt;
* '''rotations''': 6 comma(''',''') separated input strings. A rule that contains this key is not actually checked against the terrain; it instead is used as a template to create 6 new rules, each corresponding to a rotated version of the current rule. Whenever a rotated version is applied, instances of @(at-sign)R0, @R1, ... @R6 in attributes in the [terrain_graphics] tag will be adjusted by the corresponding amount and replaced with the letters specified by that numbered rotation in the ''rotations'' list. Each value corresponds to the rotated version that is -Pi/3 (60° clockwise) from the previous version; the first value corresponds to the unrotated version.&amp;lt;br&amp;gt;For example, if '''rotations=n,ne,se,s,sw,nw''' and it is being rotated 120°, then &amp;quot;@R0&amp;quot;-&amp;gt;&amp;quot;@R2&amp;quot;-&amp;gt;&amp;quot;se&amp;quot;, &amp;quot;@R1&amp;quot;-&amp;gt;&amp;quot;@R3&amp;quot;-&amp;gt;&amp;quot;s&amp;quot;, ... &amp;quot;@R6&amp;quot;-&amp;gt;&amp;quot;@R1&amp;quot;-&amp;gt;&amp;quot;ne&amp;quot;.&amp;lt;br&amp;gt;Basically the important thing is that this lets the rule be applied in any of the six hex-directions, allowing you to adjust the name of the image files automatically.&lt;br /&gt;
* '''set_flag''','''has_flag''', '''no_flag''': shortcuts to putting these in the [tile] subtags; unbound attributes will apply to all [tile] subtags.&lt;br /&gt;
* '''map''': a shortcut for defining [tile] tags with ''type'' conditions. Inputs a multi-line string value visually describing the map. The lines are cut into words of 4 characters, which correspond to [tile] tags. The line types alternate between lines corresponding to relatively even-abciss tiles and lines preceded by two spaces corresponding to relatively odd-abciss tiles. Every two lines represent 1 row on the map.&lt;br /&gt;
&lt;br /&gt;
=== Words ===&lt;br /&gt;
&lt;br /&gt;
A ''word'' is a 4-character shortcut to a [tile] tag. There are different types of words:&lt;br /&gt;
* Usually a word is interpreted as being the input to the ''type'' key of the corresponding [tile]. That is, it creates a [tile] with the attribute '''type=''word'''''.&lt;br /&gt;
* A word can also be a digit followed by 3 spaces. In this case, it is a shortcut to the [tile] with the attribute '''pos=''word'''''. This is called ''anchoring''.&lt;br /&gt;
&lt;br /&gt;
In 1.3, the format is basically the same but the following changes are made&lt;br /&gt;
* A ''word'' no longer needs to be 4 characters but is comma separated and spaces and tabs may be used for padding&lt;br /&gt;
* The 2 spaces for odd lines in no longer used, instead a leading comma is used on these lines (before the comma spaces and tabs are allowed for padding)&lt;br /&gt;
* A ''word'' may only be a dot a star or an anchor. The terrain letter format was not used and hard to support in the new engine, so that support is dropped.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
To define a north-south 2-tile mountain, the following syntax can be used:&lt;br /&gt;
&lt;br /&gt;
 [terrain_graphics]&lt;br /&gt;
     [tile]&lt;br /&gt;
         x=0&lt;br /&gt;
         y=0&lt;br /&gt;
         type=Mm&lt;br /&gt;
         set_no_flag=&amp;quot;base&amp;quot;&lt;br /&gt;
     [/tile]&lt;br /&gt;
     [tile]&lt;br /&gt;
         x=0&lt;br /&gt;
         y=1&lt;br /&gt;
         type=Mm&lt;br /&gt;
         set_no_flag=&amp;quot;base&amp;quot;&lt;br /&gt;
     [/tile]&lt;br /&gt;
     [image]&lt;br /&gt;
          name=&amp;quot;mountain-n-s.png&amp;quot;&lt;br /&gt;
     [/image]&lt;br /&gt;
 [/terrain_graphics]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This represents a tile 1, and its six adjacent tiles 2, in the map notation.&lt;br /&gt;
&lt;br /&gt;
 .,   .,   .,   .&lt;br /&gt;
 ,  .,   2,   .,   .&lt;br /&gt;
 .,   2,   2,   .&lt;br /&gt;
 ,  .,   1,   .,   .&lt;br /&gt;
 .,   2,   2,   .&lt;br /&gt;
 ,  .,   2,   .,   .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To define an animated campfire at coordinates (4,5) with files &amp;quot;misc/fire-A01.png&amp;quot; to &amp;quot;misc/fire-A08.png&amp;quot; with an inter-frame transition time of 140, the following can be placed at the scenario top level (adapted from the CAMPFIRE macro):&lt;br /&gt;
    [terrain_graphics]&lt;br /&gt;
        x,y=4,5&lt;br /&gt;
        [tile]&lt;br /&gt;
            x=0&lt;br /&gt;
            y=0&lt;br /&gt;
            [image]&lt;br /&gt;
                layer=0&lt;br /&gt;
                name=&amp;quot;misc/fire-A[01-08].png:140&amp;quot;&lt;br /&gt;
            [/image]&lt;br /&gt;
        [/tile]&lt;br /&gt;
    [/terrain_graphics]&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[MultiHexTutorial]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
* Ayin's [http://www.anathas.org/ayin/wesnoth/doc/terrain_graphics_wml detailed Terrain Graphics document]&lt;br /&gt;
* [[TerrainGraphicsTutorial]] - First half of Ayin's document, wikified&lt;br /&gt;
* [[TerrainGraphicsReference]] - Second (partial) half of Ayin's document, wikified&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=TerrainGraphicsWML&amp;diff=48422</id>
		<title>TerrainGraphicsWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=TerrainGraphicsWML&amp;diff=48422"/>
		<updated>2013-01-27T08:59:02Z</updated>

		<summary type="html">&lt;p&gt;Coffee: /* Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== The toplevel [terrain_graphics] tag ==&lt;br /&gt;
&lt;br /&gt;
For information about the multi-hex tiling system, see [[MultiHexTutorial]]&lt;br /&gt;
&lt;br /&gt;
In terrain graphics, in Wesnoth 1.8.x all images are assumed to be .png and relative to images/terrain/. For example, writing 'image=grassland' means that the image file is images/terrain/grassland.png.  In Wesnoth 1.9.x the .png extension is required.  This means that TerrainGraphicsWML is incompatible from 1.8.x to 1.9.x.&lt;br /&gt;
&lt;br /&gt;
The multi-hex tiling system adds a new top-level element to WML, [terrain_graphics].&lt;br /&gt;
A building rule is used to specify images to place when terrains are in a certain formation.&lt;br /&gt;
When a building rule is applied to a map, it is applied once to each coordinate on the map;&lt;br /&gt;
when it is applied to a coordinate then that coordinate is considered the ''base''.&lt;br /&gt;
All locations in '''[terrain_graphics]''' are relative to the base.&lt;br /&gt;
&lt;br /&gt;
The following keys/tags are recognized:&lt;br /&gt;
* '''[tile]''': whenever a building rule is applied, each [tile] tag corresponds to a tile on the map. The corresponding tile must match each condition contained in [tile] for the [tile] tag to match. All [tile] tags must match in order for a rule to match. If the rule for a [tile] tag is applied, each action within [tile] will be executed on the tile corresponding to that [tile] tag&lt;br /&gt;
** '''x''','''y''': standard coordinates - the location of the corresponding tile relative to the base.&lt;br /&gt;
** '''pos''': a shortcut to specifying coordinates. Used in combination with ''map''&lt;br /&gt;
** '''type''': a comma-separated list of terrain codes (See [[TerrainWML]], data/terrain.cfg). In order for a tile to match this condition, it must be one of the terrains specified. However, if the string is preceded by &amp;quot;!&amp;quot;, the terrain must not be listed in order to match. If the string is '*', or if it is empty, any tile matches. A square bracket expansion, as in animationWML for halos may be used.&lt;br /&gt;
** '''set_flag''': a comma-separated list of strings. Attaches flags from that list to the corresponding tile if the rule matches. The only difference a flag makes is being detected by ''has_flag'' and ''no_flag'' in [tile]. This is determined by the order of the [terrain_graphics] tags; a tag after another one cannot influence it. See also ''has_flag'', ''no_flag''&lt;br /&gt;
** '''has_flag''': a comma-separated list of strings. Matches if all flags in that list are attached to the corresponding tile. Flags are attached using the ''set_flag'' key.&lt;br /&gt;
** '''no_flag''': a comma-separated list of strings. Matches if none of the flags in that list are attached to the corresponding tile. Flags are attached using the ''set_flag'' key.&lt;br /&gt;
** '''set_no_flag''': helper combining ''set_flag'' and ''no_flag''. Same effect as using them with the same flags. Added because it's the most common use; ''set_flag'' or ''no_flag'' can still be used to add flags in one group only. &lt;br /&gt;
** '''[image]''': images specified as a subtag to '''[tile]''' sets the images for a single tile.&lt;br /&gt;
*** '''layer''': an integer, usually negative. The more negative it is, the earlier it is drawn, and thus the farther &amp;quot;back&amp;quot; it is when compositing the terrain images together.&lt;br /&gt;
*** '''name''': the image to apply on this tile if appropriate&lt;br /&gt;
*** '''random_start''' (default: yes): Tells engine to start animation at random point instead of at the beginning for every tile&lt;br /&gt;
*** '''base''': specifies the point at which the image is considered to be for layering purposes.  ''base'' is specified as '''x,y''' where x and y indicate distances in pixels from the top-left corner of the '''image'''. This is translated to a certain pixel on the map, and all images with the ''base'' attribute are drawn from top-to-bottom in terms of these specified pixel positions '''on the map'''.&lt;br /&gt;
*** '''[variant]''': an alternate image to use for differing times of day&lt;br /&gt;
**** '''tod''': the time of day for which this variant applies. Accepts a comma separated list of times of day.&lt;br /&gt;
**** '''name''': the image to apply on this tile if appropriate&lt;br /&gt;
**** '''random_start''' (default: yes): Tells engine to start animation at random point instead of at the beginning for every tile&lt;br /&gt;
* '''[image]''': image may also be used directly in the rule, to specify multihex images. The following additional attributes are recognized for multihex images (as well as all the ones for images within '''[tile]''').&lt;br /&gt;
** '''center''': specifies the point which the image will be centered on. If it is not specified, the image will instead be aligned with the top left corner of the tile.&lt;br /&gt;
* '''probability''': the percent probability for each position that if the position matches, then the rule will be applied. Default is 100(%).  See [[TerrainGraphicsTutorial#Cumulative_Probabilities|Cumulative_Probabilities]] for mathematical complications.&lt;br /&gt;
* '''rotations''': 6 comma(''',''') separated input strings. A rule that contains this key is not actually checked against the terrain; it instead is used as a template to create 6 new rules, each corresponding to a rotated version of the current rule. Whenever a rotated version is applied, instances of @(at-sign)R0, @R1, ... @R6 in attributes in the [terrain_graphics] tag will be adjusted by the corresponding amount and replaced with the letters specified by that numbered rotation in the ''rotations'' list. Each value corresponds to the rotated version that is -Pi/3 (60° clockwise) from the previous version; the first value corresponds to the unrotated version.&amp;lt;br&amp;gt;For example, if '''rotations=n,ne,se,s,sw,nw''' and it is being rotated 120°, then &amp;quot;@R0&amp;quot;-&amp;gt;&amp;quot;@R2&amp;quot;-&amp;gt;&amp;quot;se&amp;quot;, &amp;quot;@R1&amp;quot;-&amp;gt;&amp;quot;@R3&amp;quot;-&amp;gt;&amp;quot;s&amp;quot;, ... &amp;quot;@R6&amp;quot;-&amp;gt;&amp;quot;@R1&amp;quot;-&amp;gt;&amp;quot;ne&amp;quot;.&amp;lt;br&amp;gt;Basically the important thing is that this lets the rule be applied in any of the six hex-directions, allowing you to adjust the name of the image files automatically.&lt;br /&gt;
* '''set_flag''','''has_flag''', '''no_flag''': shortcuts to putting these in the [tile] subtags; unbound attributes will apply to all [tile] subtags.&lt;br /&gt;
* '''map''': a shortcut for defining [tile] tags with ''type'' conditions. Inputs a multi-line string value visually describing the map. The lines are cut into words of 4 characters, which correspond to [tile] tags. The line types alternate between lines corresponding to relatively even-abciss tiles and lines preceded by two spaces corresponding to relatively odd-abciss tiles. Every two lines represent 1 row on the map.&lt;br /&gt;
&lt;br /&gt;
=== Words ===&lt;br /&gt;
&lt;br /&gt;
A ''word'' is a 4-character shortcut to a [tile] tag. There are different types of words:&lt;br /&gt;
* Usually a word is interpreted as being the input to the ''type'' key of the corresponding [tile]. That is, it creates a [tile] with the attribute '''type=''word'''''.&lt;br /&gt;
* A word can also be a digit followed by 3 spaces. In this case, it is a shortcut to the [tile] with the attribute '''pos=''word'''''. This is called ''anchoring''.&lt;br /&gt;
&lt;br /&gt;
In 1.3, the format is basically the same but the following changes are made&lt;br /&gt;
* A ''word'' no longer needs to be 4 characters but is comma separated and spaces and tabs may be used for padding&lt;br /&gt;
* The 2 spaces for odd lines in no longer used, instead a leading comma is used on these lines (before the comma spaces and tabs are allowed for padding)&lt;br /&gt;
* A ''word'' may only be a dot a star or an anchor. The terrain letter format was not used and hard to support in the new engine, so that support is dropped.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
To define a north-south 2-tile mountain, the following syntax can be used:&lt;br /&gt;
&lt;br /&gt;
 [terrain_graphics]&lt;br /&gt;
     [tile]&lt;br /&gt;
         x=0&lt;br /&gt;
         y=0&lt;br /&gt;
         type=Mm&lt;br /&gt;
         set_no_flag=&amp;quot;base&amp;quot;&lt;br /&gt;
     [/tile]&lt;br /&gt;
     [tile]&lt;br /&gt;
         x=0&lt;br /&gt;
         y=1&lt;br /&gt;
         type=Mm&lt;br /&gt;
         set_no_flag=&amp;quot;base&amp;quot;&lt;br /&gt;
     [/tile]&lt;br /&gt;
     [image]&lt;br /&gt;
          name=&amp;quot;mountain-n-s.png&amp;quot;&lt;br /&gt;
     [/image]&lt;br /&gt;
 [/terrain_graphics]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This represents a tile 1, and its six adjacent tiles 2, in the map notation.&lt;br /&gt;
&lt;br /&gt;
 .,   .,   .,   .&lt;br /&gt;
 ,  .,   2,   .,   .&lt;br /&gt;
 .,   2,   2,   .&lt;br /&gt;
 ,  .,   1,   .,   .&lt;br /&gt;
 .,   2,   2,   .&lt;br /&gt;
 ,  .,   2,   .,   .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To define an animated campfire at coordinates (4,5) with files &amp;quot;misc/fire-A01.png&amp;quot; to &amp;quot;misc/fire-A08.png&amp;quot; with an interframe transition time of 140, the following can be placed at the scenario top level (adapted from the CAMPFIRE macro):&lt;br /&gt;
    [terrain_graphics]&lt;br /&gt;
        x,y=4,5&lt;br /&gt;
        [tile]&lt;br /&gt;
            x=0&lt;br /&gt;
            y=0&lt;br /&gt;
            [image]&lt;br /&gt;
                layer=0&lt;br /&gt;
                name=&amp;quot;misc/fire-A[01-08].png:140&amp;quot;&lt;br /&gt;
            [/image]&lt;br /&gt;
        [/tile]&lt;br /&gt;
    [/terrain_graphics]&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[MultiHexTutorial]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
* Ayin's [http://www.anathas.org/ayin/wesnoth/doc/terrain_graphics_wml detailed Terrain Graphics document]&lt;br /&gt;
* [[TerrainGraphicsTutorial]] - First half of Ayin's document, wikified&lt;br /&gt;
* [[TerrainGraphicsReference]] - Second (partial) half of Ayin's document, wikified&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=TerrainGraphicsWML&amp;diff=48421</id>
		<title>TerrainGraphicsWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=TerrainGraphicsWML&amp;diff=48421"/>
		<updated>2013-01-27T08:54:54Z</updated>

		<summary type="html">&lt;p&gt;Coffee: /* The toplevel [terrain_graphics] tag */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== The toplevel [terrain_graphics] tag ==&lt;br /&gt;
&lt;br /&gt;
For information about the multi-hex tiling system, see [[MultiHexTutorial]]&lt;br /&gt;
&lt;br /&gt;
In terrain graphics, in Wesnoth 1.8.x all images are assumed to be .png and relative to images/terrain/. For example, writing 'image=grassland' means that the image file is images/terrain/grassland.png.  In Wesnoth 1.9.x the .png extension is required.  This means that TerrainGraphicsWML is incompatible from 1.8.x to 1.9.x.&lt;br /&gt;
&lt;br /&gt;
The multi-hex tiling system adds a new top-level element to WML, [terrain_graphics].&lt;br /&gt;
A building rule is used to specify images to place when terrains are in a certain formation.&lt;br /&gt;
When a building rule is applied to a map, it is applied once to each coordinate on the map;&lt;br /&gt;
when it is applied to a coordinate then that coordinate is considered the ''base''.&lt;br /&gt;
All locations in '''[terrain_graphics]''' are relative to the base.&lt;br /&gt;
&lt;br /&gt;
The following keys/tags are recognized:&lt;br /&gt;
* '''[tile]''': whenever a building rule is applied, each [tile] tag corresponds to a tile on the map. The corresponding tile must match each condition contained in [tile] for the [tile] tag to match. All [tile] tags must match in order for a rule to match. If the rule for a [tile] tag is applied, each action within [tile] will be executed on the tile corresponding to that [tile] tag&lt;br /&gt;
** '''x''','''y''': standard coordinates - the location of the corresponding tile relative to the base.&lt;br /&gt;
** '''pos''': a shortcut to specifying coordinates. Used in combination with ''map''&lt;br /&gt;
** '''type''': a comma-separated list of terrain codes (See [[TerrainWML]], data/terrain.cfg). In order for a tile to match this condition, it must be one of the terrains specified. However, if the string is preceded by &amp;quot;!&amp;quot;, the terrain must not be listed in order to match. If the string is '*', or if it is empty, any tile matches. A square bracket expansion, as in animationWML for halos may be used.&lt;br /&gt;
** '''set_flag''': a comma-separated list of strings. Attaches flags from that list to the corresponding tile if the rule matches. The only difference a flag makes is being detected by ''has_flag'' and ''no_flag'' in [tile]. This is determined by the order of the [terrain_graphics] tags; a tag after another one cannot influence it. See also ''has_flag'', ''no_flag''&lt;br /&gt;
** '''has_flag''': a comma-separated list of strings. Matches if all flags in that list are attached to the corresponding tile. Flags are attached using the ''set_flag'' key.&lt;br /&gt;
** '''no_flag''': a comma-separated list of strings. Matches if none of the flags in that list are attached to the corresponding tile. Flags are attached using the ''set_flag'' key.&lt;br /&gt;
** '''set_no_flag''': helper combining ''set_flag'' and ''no_flag''. Same effect as using them with the same flags. Added because it's the most common use; ''set_flag'' or ''no_flag'' can still be used to add flags in one group only. &lt;br /&gt;
** '''[image]''': images specified as a subtag to '''[tile]''' sets the images for a single tile.&lt;br /&gt;
*** '''layer''': an integer, usually negative. The more negative it is, the earlier it is drawn, and thus the farther &amp;quot;back&amp;quot; it is when compositing the terrain images together.&lt;br /&gt;
*** '''name''': the image to apply on this tile if appropriate&lt;br /&gt;
*** '''random_start''' (default: yes): Tells engine to start animation at random point instead of at the beginning for every tile&lt;br /&gt;
*** '''base''': specifies the point at which the image is considered to be for layering purposes.  ''base'' is specified as '''x,y''' where x and y indicate distances in pixels from the top-left corner of the '''image'''. This is translated to a certain pixel on the map, and all images with the ''base'' attribute are drawn from top-to-bottom in terms of these specified pixel positions '''on the map'''.&lt;br /&gt;
*** '''[variant]''': an alternate image to use for differing times of day&lt;br /&gt;
**** '''tod''': the time of day for which this variant applies. Accepts a comma separated list of times of day.&lt;br /&gt;
**** '''name''': the image to apply on this tile if appropriate&lt;br /&gt;
**** '''random_start''' (default: yes): Tells engine to start animation at random point instead of at the beginning for every tile&lt;br /&gt;
* '''[image]''': image may also be used directly in the rule, to specify multihex images. The following additional attributes are recognized for multihex images (as well as all the ones for images within '''[tile]''').&lt;br /&gt;
** '''center''': specifies the point which the image will be centered on. If it is not specified, the image will instead be aligned with the top left corner of the tile.&lt;br /&gt;
* '''probability''': the percent probability for each position that if the position matches, then the rule will be applied. Default is 100(%).  See [[TerrainGraphicsTutorial#Cumulative_Probabilities|Cumulative_Probabilities]] for mathematical complications.&lt;br /&gt;
* '''rotations''': 6 comma(''',''') separated input strings. A rule that contains this key is not actually checked against the terrain; it instead is used as a template to create 6 new rules, each corresponding to a rotated version of the current rule. Whenever a rotated version is applied, instances of @(at-sign)R0, @R1, ... @R6 in attributes in the [terrain_graphics] tag will be adjusted by the corresponding amount and replaced with the letters specified by that numbered rotation in the ''rotations'' list. Each value corresponds to the rotated version that is -Pi/3 (60° clockwise) from the previous version; the first value corresponds to the unrotated version.&amp;lt;br&amp;gt;For example, if '''rotations=n,ne,se,s,sw,nw''' and it is being rotated 120°, then &amp;quot;@R0&amp;quot;-&amp;gt;&amp;quot;@R2&amp;quot;-&amp;gt;&amp;quot;se&amp;quot;, &amp;quot;@R1&amp;quot;-&amp;gt;&amp;quot;@R3&amp;quot;-&amp;gt;&amp;quot;s&amp;quot;, ... &amp;quot;@R6&amp;quot;-&amp;gt;&amp;quot;@R1&amp;quot;-&amp;gt;&amp;quot;ne&amp;quot;.&amp;lt;br&amp;gt;Basically the important thing is that this lets the rule be applied in any of the six hex-directions, allowing you to adjust the name of the image files automatically.&lt;br /&gt;
* '''set_flag''','''has_flag''', '''no_flag''': shortcuts to putting these in the [tile] subtags; unbound attributes will apply to all [tile] subtags.&lt;br /&gt;
* '''map''': a shortcut for defining [tile] tags with ''type'' conditions. Inputs a multi-line string value visually describing the map. The lines are cut into words of 4 characters, which correspond to [tile] tags. The line types alternate between lines corresponding to relatively even-abciss tiles and lines preceded by two spaces corresponding to relatively odd-abciss tiles. Every two lines represent 1 row on the map.&lt;br /&gt;
&lt;br /&gt;
=== Words ===&lt;br /&gt;
&lt;br /&gt;
A ''word'' is a 4-character shortcut to a [tile] tag. There are different types of words:&lt;br /&gt;
* Usually a word is interpreted as being the input to the ''type'' key of the corresponding [tile]. That is, it creates a [tile] with the attribute '''type=''word'''''.&lt;br /&gt;
* A word can also be a digit followed by 3 spaces. In this case, it is a shortcut to the [tile] with the attribute '''pos=''word'''''. This is called ''anchoring''.&lt;br /&gt;
&lt;br /&gt;
In 1.3, the format is basically the same but the following changes are made&lt;br /&gt;
* A ''word'' no longer needs to be 4 characters but is comma separated and spaces and tabs may be used for padding&lt;br /&gt;
* The 2 spaces for odd lines in no longer used, instead a leading comma is used on these lines (before the comma spaces and tabs are allowed for padding)&lt;br /&gt;
* A ''word'' may only be a dot a star or an anchor. The terrain letter format was not used and hard to support in the new engine, so that support is dropped.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
To define a north-south 2-tile mountain, the following syntax can be used:&lt;br /&gt;
&lt;br /&gt;
 [terrain_graphics]&lt;br /&gt;
     [tile]&lt;br /&gt;
         x=0&lt;br /&gt;
         y=0&lt;br /&gt;
         type=Mm&lt;br /&gt;
         set_no_flag=&amp;quot;base&amp;quot;&lt;br /&gt;
     [/tile]&lt;br /&gt;
     [tile]&lt;br /&gt;
         x=0&lt;br /&gt;
         y=1&lt;br /&gt;
         type=Mm&lt;br /&gt;
         set_no_flag=&amp;quot;base&amp;quot;&lt;br /&gt;
     [/tile]&lt;br /&gt;
     [image]&lt;br /&gt;
          name=&amp;quot;mountain-n-s.png&amp;quot;&lt;br /&gt;
     [/image]&lt;br /&gt;
 [/terrain_graphics]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This represents a tile 1, and its six adjacent tiles 2, in the map notation.&lt;br /&gt;
&lt;br /&gt;
 .,   .,   .,   .&lt;br /&gt;
 ,  .,   2,   .,   .&lt;br /&gt;
 .,   2,   2,   .&lt;br /&gt;
 ,  .,   1,   .,   .&lt;br /&gt;
 .,   2,   2,   .&lt;br /&gt;
 ,  .,   2,   .,   .&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[MultiHexTutorial]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
* Ayin's [http://www.anathas.org/ayin/wesnoth/doc/terrain_graphics_wml detailed Terrain Graphics document]&lt;br /&gt;
* [[TerrainGraphicsTutorial]] - First half of Ayin's document, wikified&lt;br /&gt;
* [[TerrainGraphicsReference]] - Second (partial) half of Ayin's document, wikified&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=48420</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=48420"/>
		<updated>2013-01-27T08:51:19Z</updated>

		<summary type="html">&lt;p&gt;Coffee: /* Progressive parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''start_time'''=-350&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [frame]&lt;br /&gt;
                duration=350&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [frame]&lt;br /&gt;
                duration=350&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;dev feature 1.9,progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;dev feature 1.9,progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has an expanded syntax:&lt;br /&gt;
&lt;br /&gt;
 halo=halo1.png:100,halo2.png:200,halo3.png:300&lt;br /&gt;
&lt;br /&gt;
or equivalently,&lt;br /&gt;
 halo=halo[1-3]:[100,200,300]&lt;br /&gt;
&lt;br /&gt;
the square bracket expansion works like so:&lt;br /&gt;
 halo=halo[3,5,7].png  is equivalent to  halo=halo3.png,halo5.png,halo7.png&lt;br /&gt;
 halo=halo[07-10].png  is equivalent to  halo=halo07.png,halo08.png,halo09.png,halo10.png&lt;br /&gt;
 halo=halo[5-3,1].png  is equivalent to  halo=halo5.png,halo4.png,halo3.png,halo1.png&lt;br /&gt;
 halo=halo[1-2]-ex[4-5].png:[100,200]  is equivalent to  halo=halo1-ex4.png:100,halo2-ex5:200.png&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 150ms in each hex. so you typically want to have an offset of ''0~1:150,0~1:150,0~1:150,0~1:150,0~1:150'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:150,0.6~0:150&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, but you can't nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            begin=-100&lt;br /&gt;
            end=100&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            begin=-100&lt;br /&gt;
            end=100&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=48419</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=48419"/>
		<updated>2013-01-27T07:27:00Z</updated>

		<summary type="html">&lt;p&gt;Coffee: /* Field Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''start_time'''=-350&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [frame]&lt;br /&gt;
                duration=350&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [frame]&lt;br /&gt;
                duration=350&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;dev feature 1.9,progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;dev feature 1.9,progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has a similar syntax&lt;br /&gt;
&lt;br /&gt;
 halo=halo1.png:300,halo2.png:300,halo2.png:300&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this can be left out and will be automatically calculated.&lt;br /&gt;
** '''image''': the image to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 150ms in each hex. so you typically want to have an offset of ''0~1:150,0~1:150,0~1:150,0~1:150,0~1:150'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:150,0.6~0:150&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, but you can't nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            begin=-100&lt;br /&gt;
            end=100&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            begin=-100&lt;br /&gt;
            end=100&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=48418</id>
		<title>AnimationWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=AnimationWML&amp;diff=48418"/>
		<updated>2013-01-27T07:14:50Z</updated>

		<summary type="html">&lt;p&gt;Coffee: /* Field Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page covers unit animations. At any point in game, units are playing an animation. Even when the unit is standing, it is actually playing a single frame animation.&lt;br /&gt;
&lt;br /&gt;
This page will deal with the two problems of animations&lt;br /&gt;
* How are animations chosen&lt;br /&gt;
* What exactly is drawn&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How animations are drawn ==&lt;br /&gt;
=== Animations ===&lt;br /&gt;
Any unit has a huge set of animations to choose from. Animations are WML blocks in the unit type, enclosed in either the generic type '''[animation]''' or some more specific tags such as '''[attack_anim]''' '''[idle_anim]''' and the like. An animation is what a unit displays when a given event is triggered, and a certain set of conditions are met such as&lt;br /&gt;
* unit is attacking&lt;br /&gt;
* unit is idling&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition)&lt;br /&gt;
* unit is attacking (event) and uses a melee weapon (condition) and opponent can't retaliate (condition)&lt;br /&gt;
&lt;br /&gt;
events and conditions are described entirely in the [animation] block, and will be discussed in the animation choice section.&lt;br /&gt;
&lt;br /&gt;
=== Frames ===&lt;br /&gt;
    &lt;br /&gt;
An animation is cut in frames. Frames are WML blocks that are contained either in '''[frame]''' WML blocks or in generic '''[xxx_frame]''' block. (the xxx part can be any string not starting with an underscore) the xxx part in the frame name is called the frame prefix. frames of the type '''[frame]''' are said to have an empty prefix&lt;br /&gt;
&lt;br /&gt;
A frame typically describes an image, where an how to render it. It can contain such things as&lt;br /&gt;
* the image to display&lt;br /&gt;
* how transparent should that image be&lt;br /&gt;
* where to draw that image.&lt;br /&gt;
&lt;br /&gt;
At any given time, an animation will display one frame for each frame prefix it can find. I.e if your animation has both '''[frame]''' and '''[missile_frame]''' blocks, both will be displayed at the same time&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The frame with the empty prefix is special in many way. It is assumed to contain the image representing the unit itself, and as such the engine will heavily temper with it in multiple ways, such as providing a default image if none is available, or forcing the image to be green when the unit is poisoned&lt;br /&gt;
&lt;br /&gt;
=== Timing, Clock, Multiple animations ===&lt;br /&gt;
When an animation is played it has an internal clock that is run. The step of this clock is the milisecond, and each frame is played for a given duration. Each animation also has a starting time which tells the animation engine at what value the animation clock should start&lt;br /&gt;
&lt;br /&gt;
This starting time is very important when multiple animations from different units are played synchronously  Typically a fight involves a unit playing its defense animation while the opponent plays its attack animation (and a third might play its leading animation, too). In that case all animations have a common clock, and are played concurrently.&lt;br /&gt;
&lt;br /&gt;
The convention is that the &amp;quot;important time&amp;quot; (usually the time of the hit) is at time 0. everything before should be at negative time, everything after at positive time. This is a WML convention that is not enforced by the engine&lt;br /&gt;
&lt;br /&gt;
In that case, it is very important that these animations (which can have different lengths) be synchronized. Fight animations are synchronized around the point of impact, so they all reach time 0 when the attack lands (or misses). This is accomplished through the use of the '''start_time''' key of the '''[animation]''' tag.&lt;br /&gt;
&lt;br /&gt;
Just like the '''[frame]''' tag can have a prefix, so can the '''start_time''' key. A '''start_time''' key without prefix will affect a '''[frame]''' tag without prefix, while a '''start_time''' key with a prefix will affect a '''[frame]''' tag with the same prefix.&lt;br /&gt;
&lt;br /&gt;
==== Example Syntax ====&lt;br /&gt;
    [attack_anim]&lt;br /&gt;
        [filter_attack]&lt;br /&gt;
            name=bow&lt;br /&gt;
        [/filter_attack]&lt;br /&gt;
        '''start_time'''=-350&lt;br /&gt;
        '''missile_start_time'''=-150&lt;br /&gt;
        [missile_frame]&lt;br /&gt;
            duration=150&lt;br /&gt;
            image=&amp;quot;projectiles/missile-n.png&amp;quot;&lt;br /&gt;
            image_diagonal=&amp;quot;projectiles/missile-ne.png&amp;quot;&lt;br /&gt;
        [/missile_frame]&lt;br /&gt;
        [if]&lt;br /&gt;
            hits=yes&lt;br /&gt;
            [frame]&lt;br /&gt;
                duration=350&lt;br /&gt;
                sound=bow.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/if]&lt;br /&gt;
        [else]&lt;br /&gt;
            hits=no&lt;br /&gt;
            [frame]&lt;br /&gt;
                duration=350&lt;br /&gt;
                sound=bow-miss.ogg&lt;br /&gt;
            [/frame]&lt;br /&gt;
        [/else]&lt;br /&gt;
    [/attack_anim]&lt;br /&gt;
&lt;br /&gt;
=== The content of a frame ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [frame]&lt;br /&gt;
    duration=&amp;lt;integer&amp;gt;&lt;br /&gt;
    begin=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    end=&amp;lt;deprecated,integer&amp;gt;&lt;br /&gt;
    image=&amp;lt;string&amp;gt;&lt;br /&gt;
    image_diagonal=&amp;lt;string&amp;gt;&lt;br /&gt;
    image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    sound=&amp;lt;string&amp;gt;&lt;br /&gt;
    halo=&amp;lt;progressive string&amp;gt;&lt;br /&gt;
    halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
    alpha=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    blend_color=&amp;lt;red, green, blue&amp;gt;&lt;br /&gt;
    blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    text=&amp;lt;string&amp;gt;&lt;br /&gt;
    text_color=&amp;lt; red, green, blue &amp;gt;&lt;br /&gt;
    submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
    x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    directional_x=&amp;lt;dev feature 1.9,progressive int&amp;gt;&lt;br /&gt;
    directional_y=&amp;lt;dev feature 1.9,progressive int&amp;gt;&lt;br /&gt;
    layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
    auto_hflip=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
    auto_vflip=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
    primary=&amp;lt;dev feature 1.9, boolean&amp;gt;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
==== Progressive parameters ====&lt;br /&gt;
&lt;br /&gt;
Some parameters above are marked as ''progressive'' This means that you can specify that during the time the frame is displayed, the parameter should smoothly slide from one value to an other.&lt;br /&gt;
&lt;br /&gt;
A typical example would be a unit progressively fading out, becoming transparent&lt;br /&gt;
&lt;br /&gt;
To do that, you could use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0&lt;br /&gt;
&lt;br /&gt;
To make a frame, which is 900ms long, slide to transparent for 300ms, stay transparent for another 300ms and finally fade back to normal for 300ms, use:&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0:300,0:300,0~1:300&lt;br /&gt;
&lt;br /&gt;
you could also specify it like that&lt;br /&gt;
&lt;br /&gt;
 alpha=1~0,0,0~1&lt;br /&gt;
&lt;br /&gt;
when a timing is missing, the engine will do its best to fill in in a fair way. &lt;br /&gt;
&lt;br /&gt;
a progressive string has a similar syntax&lt;br /&gt;
&lt;br /&gt;
 halo=halo1.png:300,halo2.png:300,halo2.png:300&lt;br /&gt;
&lt;br /&gt;
==== Field Description ====&lt;br /&gt;
&lt;br /&gt;
** '''begin''': (deprecated) will be replaced by '''duration= &amp;lt;end - begin &amp;gt;'''&lt;br /&gt;
** '''end''': (deprecated) see '''begin''' and also [[AnimationWML#Timing.2C_Clock.2C_Multiple_animations|Timing, Clock, Multiple animations]] section for coverage of '''start_time''' which combines with '''duration''' to replace '''begin=''' '''end='''.&lt;br /&gt;
** '''duration''': how long the frame should be displayed. Use instead of '''begin=''' and '''end='''. If specified by timing in a progressive string, such as a halo, this will be automatically calculated.&lt;br /&gt;
** '''image''': the image to display during the frame.&lt;br /&gt;
** '''image_diagonal''': the image to display when the attack occurs diagonally (directions ne,se,sw,nw).&lt;br /&gt;
** '''image_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all images&lt;br /&gt;
** '''sound''': the sound to play when the frame begins. Can be a comma-separated list of sounds, in which case one of them is chosen randomly every time.&lt;br /&gt;
** '''halo''': the halo to display at the time.&lt;br /&gt;
** '''halo_x''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_y''': the position the halo is displayed in pixel relative to the unit's center.&lt;br /&gt;
** '''halo_mod''': a string modifications (see [[ImagePathFunctionWML]] ) that will be applied to all haloes&lt;br /&gt;
** '''alpha''': transparency level to apply to the frame. This is a floating point progressive parameter ranging from 0.0 to 1.0.&lt;br /&gt;
** '''offset''': the position of the image relative to the hex the unit is facing, 0.0 will display the unit in the center of the hex, 1.0 in the center of the faced hex, -1.0 at the center of the hex behind you. This is a progressive parameter.&lt;br /&gt;
** '''blend_color''': a comma separated list of numbers representing a color in RGB (0-255); this color will be mixed to the frame to give it a tint.&lt;br /&gt;
** '''blend_ratio''': this is a progressive parameter ranging from 0 to 1: 0 means no tint, 1 means target color only.&lt;br /&gt;
** '''text''': if specified, floats a label with the given text above the unit (identical to the floating damage and healing numbers).&lt;br /&gt;
** '''text_color''': the color of the above floating label.&lt;br /&gt;
** '''submerge''': the part of the unit that should drawn with 50% opacity (for units in water)&lt;br /&gt;
** '''x''': x offset applied to the frame&lt;br /&gt;
** '''y''': y offset applied to the frame&lt;br /&gt;
** '''directional_x''': the x offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''directional_y''': the y offset, in pixels, applied to the frame in the direction the unit is facing&lt;br /&gt;
** '''layer''': layer used to draw the frame, see discussion bellow&lt;br /&gt;
** '''auto_hflip''': should the image flip horizontally depending on sprite orientation&lt;br /&gt;
** '''auto_vflip''': should the image flip vertically depending on sprite orientation&lt;br /&gt;
** '''primary''': should the engine consider that frame as a primary frame (affected by visual effects like stone and poison)&lt;br /&gt;
&lt;br /&gt;
=== Drawing related animation content ===&lt;br /&gt;
==== Syntax summary ====&lt;br /&gt;
 [animation]&lt;br /&gt;
   &amp;lt;animation choice related content&amp;gt;&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   [frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/frame]&lt;br /&gt;
   start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   [xxx_frame]&lt;br /&gt;
     &amp;lt;frame content&amp;gt;&lt;br /&gt;
   [/xxx_frame]&lt;br /&gt;
   xxx_start_time=&amp;lt;integer&amp;gt;&lt;br /&gt;
   xxx_image_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_offset=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_blend_color=&amp;lt;r,g,b&amp;gt;&lt;br /&gt;
   xxx_blend_ratio=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_halo=&amp;lt;progressive_string&amp;gt;&lt;br /&gt;
   xxx_halo_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_halo_mod=&amp;lt;string&amp;gt;&lt;br /&gt;
   xxx_submerge=&amp;lt;progressive float&amp;gt;&lt;br /&gt;
   xxx_x=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_y=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_x=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_directional_y=&amp;lt;dev1.9,progressive int&amp;gt;&lt;br /&gt;
   xxx_layer=&amp;lt;progressive int&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [/animation]&lt;br /&gt;
&lt;br /&gt;
==== Parameter handling ====&lt;br /&gt;
All drawing related parameters in '''[animation]''' can be matched with a corresponding parameter in  a '''[frame]''' block (or a '''[xxx_frame]''' block) The value provided in the animation will be used if no value is provided in the frame. &lt;br /&gt;
&lt;br /&gt;
The point of these two level of parameters is to easily be able to specify a parameter at the animation level and override it for a special case of frame.&lt;br /&gt;
&lt;br /&gt;
== How animations are chosen ==&lt;br /&gt;
Within a unit description block there are multiple animations. Each animation is meant to be played in a very special set of circumstances. We will discuss here how to tell the animation engine when a given animation should be played. &lt;br /&gt;
&lt;br /&gt;
Let's take an example. Suppose we have a unit which has the skirmisher ability. We have the following movement animations :&lt;br /&gt;
* a normal walking animation&lt;br /&gt;
* a swimming animation when the unit is in water&lt;br /&gt;
* a tiptoeing animation when moving next to an enemy unit&lt;br /&gt;
&lt;br /&gt;
Ok. most of the time it's easy to guess what animation should be. However if you are both in water and next to an enemy unit, the animation to play is not obvious.&lt;br /&gt;
&lt;br /&gt;
To solve that question, each animation has a number of filtering criteria. The engine follow the following rules to select an animation&lt;br /&gt;
* Start with all animations&lt;br /&gt;
* Drop all animations with a criteria that fails on the current situation&lt;br /&gt;
* Take the animations that have the most matching criteria&lt;br /&gt;
* If there are more than one animation remaining, take an animation randomly&lt;br /&gt;
* If all animations have been dropped, the engine will provide a smart default.&lt;br /&gt;
    &lt;br /&gt;
here is a pseudo-code explanation of this algorithm:&lt;br /&gt;
&lt;br /&gt;
 foreach animation&lt;br /&gt;
    animation_score = 0&lt;br /&gt;
    foreach filter-criteria&lt;br /&gt;
      if &amp;lt;criteria-fails&amp;gt; &lt;br /&gt;
          animation_score = -1;&lt;br /&gt;
          break;&lt;br /&gt;
      elsif &amp;lt;criteria-matches&amp;gt; &lt;br /&gt;
          animation_score++&lt;br /&gt;
    endfor&lt;br /&gt;
    if animation_score &amp;gt; max_score&lt;br /&gt;
        &amp;lt;empty animation list&amp;gt;&lt;br /&gt;
        max_score = animation_score;&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
    elsif animation_score = max_score&lt;br /&gt;
        push(animation,animation_list);&lt;br /&gt;
 endfor&lt;br /&gt;
 &amp;lt;choose an animation randomly from animation_list&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
Note that all animations don't have all the filters...&lt;br /&gt;
&lt;br /&gt;
so, if we have a unit with&lt;br /&gt;
# an animation for water terrain&lt;br /&gt;
# an animation for SE on grassland&lt;br /&gt;
# an animation with no criteria&lt;br /&gt;
# an animation for N,NE,NW,S,SW,SE&lt;br /&gt;
# an animation for NW&lt;br /&gt;
&lt;br /&gt;
* 3. will never be taken, because 4. will always trump it&lt;br /&gt;
* on water going NW, it can be 1. 4. 5.&lt;br /&gt;
* on water, any direction but NW, it will be 1. or 4.&lt;br /&gt;
* on SE grassland it will be 2.&lt;br /&gt;
* on other grasslands, it will be 4. (4. or 5. if NW)&lt;br /&gt;
&lt;br /&gt;
=== Generic animation filters available for all animations ===&lt;br /&gt;
* '''apply_to''': a list of comma separated keywords describing what event should trigger the animation (movement, attack...) the complete list is given below&lt;br /&gt;
* '''value''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''value_second''': a list of comma separated integer, the meaning depends on the triggering event. the meaning is given with the list of event&lt;br /&gt;
* '''terrain''': a list of comma separated terrain letters, the animation will only be used on these terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].  this has been replaced by '''terrain_type'''&lt;br /&gt;
* '''terrain_type''': a list of comma separated terrain codes, the animation will only be used on matching terrains.  See [[FilterWML#Filtering Terrains|Filtering Terrains]].&lt;br /&gt;
* '''[filter]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the animated unit. Note that matching all criterias in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter]''' blocks in an animation.&lt;br /&gt;
* '''[filter_second]''': this will filter using a [[StandardUnitFilter|standard unit filter]] on the unit in the hex faced. Note that matching all criteria in the filter will only earn you one point for animation selection, but that you can have multiple '''[filter_second]''' blocks in an animation. Also note that if the faced hex is empty, the whole filter will fail.&lt;br /&gt;
* '''direction''': a list of directions (n,ne,se,s,sw,nw), the animation will only be used when acting or moving in this direction (the attack direction for attack animations, moving direction for movement animations, direction of lead unit for leading animations, and so on).&lt;br /&gt;
* '''frequency''': this integer value allows to easily tweak the matching frequency of animations. The filter will fail n-1 times out of n, randomly. Note that unlike every other filter, matching this filter won't give an extra point.&lt;br /&gt;
* '''[filter_attack]''': a standard attack filter to match on the attacker's attack. See  [[FilterWML#Filtering Weapons|Filtering Weapons]]. &lt;br /&gt;
* '''[filter_second_attack]''': a standard attack filter to match on the defender's attack. See [[FilterWML#Filtering Weapons|Filtering Weapons]]. Also note that if the defender doesn't have any weapon to retaliate with, this filter will always fail. &lt;br /&gt;
* '''hits''': filters attack animations based on whether the attack hits, misses or kills. Accepts a list of the following:&lt;br /&gt;
** '''hit''': the attack hits, defender survives.&lt;br /&gt;
** '''no''' or '''miss''': the attack misses.&lt;br /&gt;
** '''kill''': the attack hits, defender dies.&lt;br /&gt;
** '''yes''': is an alias of '''hit,kill'''.&lt;br /&gt;
* '''swing''': a list of numbers representing the swing numbers this animation should match (numbered from 1). this has been replaced by value_second&lt;br /&gt;
* '''base_score''': a number that will always be added to the score. Use with caution&lt;br /&gt;
&lt;br /&gt;
=== Events triggering animations and default animations ===&lt;br /&gt;
==== standing ====&lt;br /&gt;
This animation is triggered whenever any other animation is finished, and is played in loop until another animation is triggered&lt;br /&gt;
&lt;br /&gt;
this is the default &amp;quot;standing image&amp;quot; for the unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no standing animation is set a single frame animation based on the enclosing unit's '''image=''' field is used&lt;br /&gt;
==== selected ====&lt;br /&gt;
This animation is triggered whenever the unit is selected&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0.0~0.3:100,0.3~0.0:200&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== recruited ====&lt;br /&gt;
This animation is triggered whenever the unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=0~1:600''&lt;br /&gt;
&lt;br /&gt;
==== recruiting ====&lt;br /&gt;
&lt;br /&gt;
This animation is triggered for the leader when a unit is recruited or recalled&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
no default animation is needed&lt;br /&gt;
&lt;br /&gt;
note that is not triggered for WML triggered animations&lt;br /&gt;
&lt;br /&gt;
==== levelout ====&lt;br /&gt;
This animation is triggered whenever the unit levels, before the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== levelin ====&lt;br /&gt;
This animation is triggered whenever the unit levels, after the unit is replaced by the new unit.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:600&amp;quot; blend_color=255,255,255''&lt;br /&gt;
&lt;br /&gt;
==== movement ====&lt;br /&gt;
This animation is used whenever a unit moves. There are multiple things to consider when dealing with movement animation&lt;br /&gt;
* unit stay ''exactly'' 150ms in each hex. so you typically want to have an offset of ''0~1:150,0~1:150,0~1:150,0~1:150,0~1:150'' or something similar&lt;br /&gt;
* when a unit enters a hex, the current anim is tested again.&lt;br /&gt;
** if the current animation is still valid (i.e it passes all its filter) it is kept, whatever the final score is&lt;br /&gt;
** if it fails, a new movement anim is searched&lt;br /&gt;
&lt;br /&gt;
''value='' contains the number of steps already taken&lt;br /&gt;
&lt;br /&gt;
''value_second='' contains the number of steps left&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
==== pre_movement ====&lt;br /&gt;
This animation is used before any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
==== post_movement ====&lt;br /&gt;
This animation is used after any unit movement&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0 &lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
==== pre_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but before it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;1~0:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== post_teleport ====&lt;br /&gt;
This animation is triggered whenever the unit teleports, but after it has moved to the target hex&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0~1:150&amp;quot; blend_color=255,255,255''&lt;br /&gt;
==== healing ====&lt;br /&gt;
This animation is triggered when the unit has healing powers and uses them&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== healed ====&lt;br /&gt;
This animation is triggered whenever the unit is healed for any reason&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points healed&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=255,255,255''&lt;br /&gt;
and plays the sound ''heal.wav''&lt;br /&gt;
==== poisoned ====&lt;br /&gt;
This animation is triggered whenever the unit suffers poison damage&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of points lost&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''blend_ratio=&amp;quot;0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30&amp;quot; blend_color=0,255,0''&lt;br /&gt;
and plays the sound 'poison.ogg''&lt;br /&gt;
&lt;br /&gt;
==== defend ====&lt;br /&gt;
This animation is triggered during a strike, of the unit receiving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of point lost, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== attack ====&lt;br /&gt;
This animation is triggered during a strike, of the unit giving the blow&lt;br /&gt;
&lt;br /&gt;
''value='' is the number of damage dealt, if any&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''offset=&amp;quot;0~0.6:150,0.6~0:150&amp;quot;'' for melee attacks&lt;br /&gt;
No default is provided for range attacks&lt;br /&gt;
==== leading ====&lt;br /&gt;
This animation is triggered for units with the leading special ability, when the unit they are leading is attacking&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== resistance ====&lt;br /&gt;
This animation is triggered for units with the resistance special ability affecting neighbouring fights, when the unit they are helping is defending&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is the number of the swing, starting from 1&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== death ====&lt;br /&gt;
This animation is triggered when a unit die.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
if no animation is available, the default uses the standing animation(s) with ''alpha=1~0:600'' and plays the sound in ''die_sound='' of the enclosing unit&lt;br /&gt;
==== victory ====&lt;br /&gt;
This animation is triggered when a unit finishes a fight by killing the other unit&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
==== idling ====&lt;br /&gt;
This animation is called when the unit has been using its standing animation for a random duration.&lt;br /&gt;
&lt;br /&gt;
''value='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
''value_second='' is not used, and always contains 0&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== draw_weapon ====&lt;br /&gt;
This animation is played before a fight&lt;br /&gt;
&lt;br /&gt;
''hit='' is set to HIT for the attacker and MISS for the defender&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== sheath_weapon ====&lt;br /&gt;
This animation is played after a fight simultaneously for all surviving units&lt;br /&gt;
&lt;br /&gt;
No default is provided by the engine&lt;br /&gt;
&lt;br /&gt;
==== default ====&lt;br /&gt;
&lt;br /&gt;
This animation is never triggered, but is used as a base to create new animations&lt;br /&gt;
&lt;br /&gt;
''value='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
''value_second='' is used depending of the type of animation it replaces&lt;br /&gt;
&lt;br /&gt;
A single animation made of the base frame is provided by the engine if no default animation is available&lt;br /&gt;
&lt;br /&gt;
==== extra animations ====&lt;br /&gt;
Other values are never called by the engine. However they can be triggered by WML events allowing custom animations.&lt;br /&gt;
&lt;br /&gt;
Note that WML events can also trigger standard animations.&lt;br /&gt;
''value='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
''value_second='' is set from the WML event&lt;br /&gt;
&lt;br /&gt;
== Shortcuts, tricks and quirks ==&lt;br /&gt;
&lt;br /&gt;
=== ''[if]'' and ''[else]'' ===&lt;br /&gt;
&lt;br /&gt;
Often, you need to do very slight variations in an animation (like a different sound depending on whether the unit hits or misses its attack), the '''[if]''' and '''[else]''' tags are meant to help you do that.  ('''Attention:''' These do not have the same syntax as the action tag [if] and its subtag [else] in [[ConditionalActionsWML]].)&lt;br /&gt;
    &lt;br /&gt;
Using these in an animation is equivalent to having multiple animations, one with the '''[if]''' block and one with each of the ''[else]'' blocks. Any filtering flags in these blocks will replace the toplevel filters. You can have multiple '''[if]''' blocks in an animation, but you can't nest an '''[if]''' inside another. These should be written directly inside the '''[animation]''' block. The following example would make the '''[frame]''' inside the '''[if]''' be played when the attack misses, and the '''[frame]''' inside the '''[else]''' be played when the attack hits (producing a different sound):&lt;br /&gt;
&lt;br /&gt;
    [if]&lt;br /&gt;
        hits=no&lt;br /&gt;
        [frame]&lt;br /&gt;
            begin=-100&lt;br /&gt;
            end=100&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png&amp;quot;&lt;br /&gt;
            sound={SOUND_LIST:MISS}&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/if]&lt;br /&gt;
    [else]&lt;br /&gt;
        hits=yes&lt;br /&gt;
        [frame]&lt;br /&gt;
            begin=-100&lt;br /&gt;
            end=100&lt;br /&gt;
            image=&amp;quot;units/dwarves/lord-attack.png&amp;quot;&lt;br /&gt;
            sound=axe.ogg&lt;br /&gt;
        [/frame]&lt;br /&gt;
    [/else]&lt;br /&gt;
&lt;br /&gt;
note that this is very close to preprocessing and should be considered as such, especially with regard to scoring and animation selection&lt;br /&gt;
&lt;br /&gt;
=== Simplified animation blocks ===&lt;br /&gt;
To simplify the most common animation cases, you can use different blocks instead of the generic '''[animation]''' block. These are also here for backward compatibility, but are not deprecated and fully supported&lt;br /&gt;
&lt;br /&gt;
some of these use extra tags which are translated in the normal ''value='' tag&lt;br /&gt;
&lt;br /&gt;
some of these define '''[xxx_frame]''' blocks where the frame prefix starts with an underscore. This is not allowed in normal WML (prefix starting with underscore is reserved for the engine internal use). It is here for clarity purpose&lt;br /&gt;
&lt;br /&gt;
* '''[leading_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=leading&lt;br /&gt;
* '''[recruit_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruited&lt;br /&gt;
* '''[recruiting_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=recruiting&lt;br /&gt;
* '''[standing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=standing,default&lt;br /&gt;
note for 1.4 :''default'' doesn't exist in 1.4, but the semantic is the same.&lt;br /&gt;
&lt;br /&gt;
i.e: the animation will be used to build default animations&lt;br /&gt;
* '''[idle_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=idling&lt;br /&gt;
* '''[levelout_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelout&lt;br /&gt;
* '''[levelin_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=levelin&lt;br /&gt;
* '''[healing_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healing&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
* '''[healed_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=healed&lt;br /&gt;
 value=&amp;lt;healing= value&amp;gt;&lt;br /&gt;
 [_healed_sound_frame]&lt;br /&gt;
    sound=heal.wav&lt;br /&gt;
 [/_healed_sound_frame]&lt;br /&gt;
* '''[poison_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=poisoned&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 [_poison_sound_frame]&lt;br /&gt;
    sound=poison.ogg&lt;br /&gt;
 [/_poison_sound_frame]&lt;br /&gt;
* '''[movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=movement&lt;br /&gt;
 offset=&amp;quot;0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150,0~1:150&amp;quot;&lt;br /&gt;
* '''[pre_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_movement&lt;br /&gt;
* '''[post_movement_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_movement&lt;br /&gt;
* '''[draw_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=draw_weapon&lt;br /&gt;
* '''[sheath_weapon_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=sheath_weapon_movement&lt;br /&gt;
* '''[defend]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=defend&lt;br /&gt;
 value=&amp;lt;damage= value&amp;gt;&lt;br /&gt;
 &amp;lt;WML content&amp;gt;&lt;br /&gt;
 [frame]&lt;br /&gt;
    blend_color=255,0,0&lt;br /&gt;
    blend_ratio=&amp;quot;0.5:50,0.0:50&amp;quot;&lt;br /&gt;
 [/frame]&lt;br /&gt;
&lt;br /&gt;
there are some subtil change compared to what is described above to avoid the red flash when value=0, but it should work as expected as far as WML author are concerned&lt;br /&gt;
 &lt;br /&gt;
* '''[attack_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
if the animation contains a missile frame&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 missile_offset=&amp;quot;0~0.8&amp;quot;&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
 apply_to=attack&lt;br /&gt;
 offset=&amp;quot;0~0.6,0.6~0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''[death]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=death&lt;br /&gt;
 [_death_sound_frame]&lt;br /&gt;
    sound=&amp;lt;die_sound= of the enclosing [unit] tag&amp;gt;&lt;br /&gt;
 [/_death_sound_frame]&lt;br /&gt;
* '''[victory_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=victory&lt;br /&gt;
* '''[extra_anim]''' is an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=&amp;lt;flag= value of the anim&amp;gt;&lt;br /&gt;
* '''[teleport_anim]''' will be cut into two at the clock-time 0&lt;br /&gt;
everything before zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=pre_teleport&lt;br /&gt;
everything after zero becomes an animation with the following parameters automatically set&lt;br /&gt;
 apply_to=post_teleport&lt;br /&gt;
&lt;br /&gt;
== Layering ==&lt;br /&gt;
The ''layer'' progressive parameter allows the animation writer to choose in what order the animation should be drawn.&lt;br /&gt;
&lt;br /&gt;
this value must be between 0 and 100&lt;br /&gt;
&lt;br /&gt;
* the back of haloes is drawn with a value of 10&lt;br /&gt;
* when unspecified, a animation is drawn with a value of 40&lt;br /&gt;
* terrain elements that are supposed to go in front of units (castles) are drawn with a value of 50&lt;br /&gt;
* orbs and status bars are drawn on layer 80&lt;br /&gt;
* when unspecified missile frames are drawn on layer 90&lt;br /&gt;
&lt;br /&gt;
by changing these values, it is easy to have the unit display the way you want&lt;br /&gt;
&lt;br /&gt;
== Optimization ==&lt;br /&gt;
&lt;br /&gt;
there is a special flag that goes into the animation block (not the frame) &lt;br /&gt;
&lt;br /&gt;
* ''offscreen'' a boolean saying if the unit's animation should be played when the unit is offscreen. You want the animation to play offscreen if the animation contains some usefull sound effects.This attribute defaults to true (play offscreen) except for standing and idle animations where it defaults to false&lt;br /&gt;
&lt;br /&gt;
== Cycling ==&lt;br /&gt;
&lt;br /&gt;
there is a special boolean parameter that can be put in an animation block (not the frame)&lt;br /&gt;
&lt;br /&gt;
* ''cycles'' a boolean value. if set to true the animation will cycles forever until it is replaced. That animation will not influence the end time of all related animations (for example a cycling defense animation will play normally but the overall duration of the fight animation will be only decided by the attack animation)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[UnitTypeWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=Formula_AI_Code_Library&amp;diff=44351</id>
		<title>Formula AI Code Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=Formula_AI_Code_Library&amp;diff=44351"/>
		<updated>2011-12-04T07:53:05Z</updated>

		<summary type="html">&lt;p&gt;Coffee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page lists Formula AI code examples that can be used directly in a scenario or as templates for further development.  If you have problems with any of them or would like to see additional examples let us know in [http://forums.wesnoth.org/viewtopic.php?f=10&amp;amp;t=34976 this forum thread].  If you have examples to add, you can also let us know there and we will post them, or feel free to edit these wiki pages yourself.&lt;br /&gt;
&lt;br /&gt;
* Check out [[Formula AI Howto]] for a practical guide for setting up and testing these examples in a scenario.&lt;br /&gt;
* Additional examples can be found in the Wesnoth data directory under ai/formula/.  See [[EditingWesnoth]] for locating the data directory.&lt;br /&gt;
* Lua AI code examples can be found in the [[Lua AI Code Library]].&lt;br /&gt;
&lt;br /&gt;
==Swamp Lurker Moves==&lt;br /&gt;
&lt;br /&gt;
This is the Formula AI adaptation of the WML swamp lurker code from [http://forums.wesnoth.org/viewtopic.php?f=8&amp;amp;t=34970 Grnk the Mighty].  Swamp lurkers have the 'swamp_submerge' ability, meaning they are invisible in swamps unless an enemy unit is adjacent to them. They are dumb, impulse-drive creatures which move as follows:&lt;br /&gt;
&lt;br /&gt;
* They can move across most terrain, but only stop on swamp.&lt;br /&gt;
* All lurkers move individually, there is no strategy.&lt;br /&gt;
* If there are enemies within reach (next to swamp terrain), a lurker will attack the unit with the fewest hitpoints.&lt;br /&gt;
* If no unit is in reach, the lurker will move to a random reachable swamp hex.&lt;br /&gt;
&lt;br /&gt;
In Grnk, this behavior is coded in WML (the WML code can be found in '1_unit_macros.cfg' in the Grnk folder or in [http://forums.wesnoth.org/viewtopic.php?f=10&amp;amp;t=34976#p506852 this forum post]).  The adaptation to Formula AI follows below.  A [[Lua_AI_Code_Library#Swamp_Lurker_Moves|Lua AI version]] exists as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;height: 250px; overflow:auto&amp;quot;&amp;gt;&lt;br /&gt;
 fai 'lurker_moves.fai'&lt;br /&gt;
 # run_file('~add-ons/AItest/ai/lurker_moves.fai') #&lt;br /&gt;
 &lt;br /&gt;
 def is_swamp(map, xx, yy)   &lt;br /&gt;
     # Tests whether terrain at xx,yy is swamp_water #&lt;br /&gt;
     map( &lt;br /&gt;
         filter( map.terrain, (x=xx) and (y=yy)),&lt;br /&gt;
         self.id &lt;br /&gt;
     )[0] = 'swamp_water';&lt;br /&gt;
 &lt;br /&gt;
 def reachable_swamp(unit_loc,map)&lt;br /&gt;
     # get all reachable swamp locs for unit at unit_loc #&lt;br /&gt;
     # exclude own location #&lt;br /&gt;
     filter( &lt;br /&gt;
         unit_moves( unit_loc ), &lt;br /&gt;
         (is_swamp( map, x, y )) and (self != unit_loc)&lt;br /&gt;
     );&lt;br /&gt;
 &lt;br /&gt;
 def random(array)&lt;br /&gt;
     # Picks a random elements of 'array' #&lt;br /&gt;
     array[(1d size(array) - 1)];&lt;br /&gt;
 &lt;br /&gt;
 def reachable_enemies_next_to_swamp(unit_loc,attacks,map)&lt;br /&gt;
     # Returns all the attacks for enemies that the unit at 'unit_loc' #&lt;br /&gt;
     # can reach and that are next to a swamp hex #&lt;br /&gt;
     filter( &lt;br /&gt;
         map( attacks.attacks, self),&lt;br /&gt;
         (move_from = unit_loc) and (is_swamp( map, attack_from.x, attack_from.y))&lt;br /&gt;
     );&lt;br /&gt;
 &lt;br /&gt;
 def weakest_defender(attacks)&lt;br /&gt;
     # Get the enemy with the lowest HP #&lt;br /&gt;
     choose( attacks, -unit_at(defender).hitpoints&lt;br /&gt;
     );&lt;br /&gt;
 &lt;br /&gt;
 # Attack if possible, otherwise random move #&lt;br /&gt;
 if( size(possible_attacks) != 0,&lt;br /&gt;
     weakest_defender(possible_attacks),&lt;br /&gt;
 if( size(swamp_in_reach) != 0,&lt;br /&gt;
     move(me.loc,random(swamp_in_reach)),&lt;br /&gt;
 end)&lt;br /&gt;
 )&lt;br /&gt;
 &lt;br /&gt;
 where possible_attacks = reachable_enemies_next_to_swamp( me.loc, my_attacks, map)&lt;br /&gt;
 &lt;br /&gt;
 where swamp_in_reach = reachable_swamp(me.loc, map)&lt;br /&gt;
 &lt;br /&gt;
 faiend&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code is meant to be in a file 'lurker_moves.fai.  It can be used with the [[Formula_AI_Howto#Setting_up_the_Formula_AI_unit_formulas_Stage|Formula AI ''unit_moves'' stage]] by including&lt;br /&gt;
&lt;br /&gt;
 [ai]&lt;br /&gt;
     formula={lurker_moves.fai}&lt;br /&gt;
 [/ai]&lt;br /&gt;
&lt;br /&gt;
in the definition of all swamp lurker units.  Or it can be set up as a [[Formula_AI_Howto#Setting_up_the_RCA_main_loop_Stage_and_Candidate_Actions|candidate action]] that applies to all swamp lurker units of a given side:&lt;br /&gt;
&lt;br /&gt;
 [candidate_action]&lt;br /&gt;
      engine=fai&lt;br /&gt;
      name=lurker_moves&lt;br /&gt;
      type=movement&lt;br /&gt;
      [filter]&lt;br /&gt;
          me=&amp;quot;filter(input, (input.type = 'Swamp Lurker'))&amp;quot;&lt;br /&gt;
      [/filter]&lt;br /&gt;
      evaluation=300000&lt;br /&gt;
      action={lurker_moves.fai}&lt;br /&gt;
 [/candidate_action]&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
* This code can, of course, also be used with any non-lurker unit as long as it is able to move through swamp.&lt;br /&gt;
* This example currently only works with &amp;quot;pure&amp;quot; swamp, not with quagmire tiles, but the extension to include those should be obvious.&lt;br /&gt;
&lt;br /&gt;
==Specifying simple AI combat targets==&lt;br /&gt;
This side wide Formula AI example is also taken from [http://forums.wesnoth.org/viewtopic.php?f=8&amp;amp;t=33664 The Great Quest] by Coffee.&lt;br /&gt;
&lt;br /&gt;
When the AI has a chance/choice of units to kill, sometimes you might want it to try to kill a certain unit or type of unit in preference of another. The following example makes the AI try to kill a ''loyal'' unit in preference of other units where the chance of a kill from one attack is greater than 50% (it then further prioritizes by chance to kill ''loyal'' units):&lt;br /&gt;
&lt;br /&gt;
*Notes: There is a specific exclusion for the AI leader, so it doesn't get goaded into a bad position. There is also a calculation done to attack from the best terrain spot available for each possible attack pair. Calculate_outcome gives a result in the range of 0 to 10000, with &amp;gt;=5000 meaning a 50% chance of success.&lt;br /&gt;
&lt;br /&gt;
 [side]&lt;br /&gt;
      side={SIDE}&lt;br /&gt;
      controller=ai&lt;br /&gt;
      #other params here&lt;br /&gt;
      [ai]&lt;br /&gt;
          #others here such as ''grouping'' or ''aggression''&lt;br /&gt;
          {MODIFY_AI_ADD_CANDIDATE_ACTION {SIDE} main_loop (&lt;br /&gt;
              [candidate_action]&lt;br /&gt;
                  id=go_for_loyal_units&lt;br /&gt;
                  name=go_for_loyal_units&lt;br /&gt;
                  engine=fai&lt;br /&gt;
                  type=attack&lt;br /&gt;
                  [filter]&lt;br /&gt;
                      me=&amp;quot;filter(input, 'me', me.leader=0)&amp;quot;&lt;br /&gt;
                      target=&amp;quot;filter(input, 'target', index_of('loyal',target.traits) != -1)&amp;quot;&lt;br /&gt;
                  [/filter]&lt;br /&gt;
                  evaluation=&amp;quot;if(max_possible_damage(me,target)&amp;gt;=target.hitpoints, if(ca_prob&amp;gt;=5000, {AI_CA_COMBAT_SCORE}+ca_prob,0), 0)&lt;br /&gt;
                              where ca_prob=calculate_outcome(me.loc, choose(filter(map(filter(my_moves.moves, src=me.loc), dst), distance_between(self, target.loc) = 1), defense_on(me, self)), target.loc)[1].probability[0]&amp;quot;&lt;br /&gt;
                  action=&amp;quot;attack(me.loc, choose(filter(map(filter(my_moves.moves, src=me.loc), dst), distance_between(self, target.loc) = 1), defense_on(me, self)), target.loc, -1)&amp;quot;&lt;br /&gt;
              [/candidate_action]&lt;br /&gt;
          )}&lt;br /&gt;
      [/ai]&lt;br /&gt;
 [/side]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Recruiting certain types of units on particular hexes==&lt;br /&gt;
This Formula AI example is from a multiplayer campaign, [http://forums.wesnoth.org/viewtopic.php?f=8&amp;amp;t=33664 The Great Quest], by Coffee.&lt;br /&gt;
&lt;br /&gt;
As it currently stands in Wesnoth 1.9, the AI recruits units based on a ''recruitment_pattern'' AI parameter. This sometimes can lead to non-optimal scout recruiting, etc. The following code attempts to remedy this by suggesting that certain units be recruited on certain hexes to improve village grabbing, etc. (but could also be used to recruit a wider variety of units within each ''recruitment_pattern'' parameter).&lt;br /&gt;
&lt;br /&gt;
This code specifies to recruit an appropriate ''scout'' unit (from default faction units) to grab a village 8 tiles away on (7, 24) by flat for side 4. *Note: undead scouts are excluded as ghost only moves 7 hexes and saurians as they move only 6, with quick scout moving 7.&lt;br /&gt;
&lt;br /&gt;
 [event]&lt;br /&gt;
      name=turn 1&lt;br /&gt;
      &lt;br /&gt;
      #recruit 8 movement scout unit to get village(7,24) fast&lt;br /&gt;
      {MODIFY_AI_ADD_CANDIDATE_ACTION 4 main_loop (&lt;br /&gt;
          [candidate_action]&lt;br /&gt;
              id=recruit_scout&lt;br /&gt;
              name=recruit_scout&lt;br /&gt;
              engine=fai&lt;br /&gt;
              type=movement&lt;br /&gt;
              evaluation=&amp;quot;if(turn=1 and unit_at(loc(7,24))=null(), {AI_CA_RECRUITMENT_SCORE}+400, 0)&amp;quot;&lt;br /&gt;
              action=&amp;quot;recruit(scout_units[(1 d size(scout_units))-1],loc(7,24))&lt;br /&gt;
                      where scout_units=map(filter(my_recruits,usage='scout' and undead=0 and id!='Saurian Skirmisher'),id)&amp;quot;&lt;br /&gt;
          [/candidate_action]&lt;br /&gt;
      )}&lt;br /&gt;
 [/event]&lt;br /&gt;
      &lt;br /&gt;
 #delete at turn 2, as we should have the wanted scout recruited by then&lt;br /&gt;
 [event]&lt;br /&gt;
      name=turn 2&lt;br /&gt;
      &lt;br /&gt;
      {MODIFY_AI_TRY_DELETE_CANDIDATE_ACTION 4 main_loop recruit_scout}&lt;br /&gt;
 [/event]&lt;br /&gt;
&lt;br /&gt;
The evaluation is for turn 1 because this is when we want to recruit this particular unit here. It also checks to see if there is already a unit on this hex as the candidate actions are run more than once. With a score of {AI_CA_RECRUITMENT_SCORE}+400, this formula will be evaluated just before the regular recruitment stage and simply adds to it.&lt;br /&gt;
&lt;br /&gt;
=== Specifying scouts not attack whilst scouting ===&lt;br /&gt;
&lt;br /&gt;
In addition to specifying that scouts should be recruited on certain hexes, an ''aspect'' can be set so that the AI does not choose to attack whilst it could be scouting instead. An example code for this is:&lt;br /&gt;
&lt;br /&gt;
 [side]&lt;br /&gt;
   side={SIDE}&lt;br /&gt;
   [ai]&lt;br /&gt;
      {MODIFY_AI_ADD_ASPECT {SIDE} attacks (&lt;br /&gt;
      [facet]&lt;br /&gt;
         name=testing_ai_default::aspect_attacks&lt;br /&gt;
         id=hold_off_initial_scout_attack&lt;br /&gt;
         invalidate_on_gamestate_change=yes&lt;br /&gt;
         [filter_own]&lt;br /&gt;
            [not]&lt;br /&gt;
               type=&amp;quot;Cavalryman,Drake Glider,Elvish Scout,Footpad,Ghost,Gryphon Rider,Vampire Bat,Wolf Rider&amp;quot;&lt;br /&gt;
            [/not]&lt;br /&gt;
         [/filter_own]&lt;br /&gt;
      [/facet]&lt;br /&gt;
      )}&lt;br /&gt;
   [/ai]&lt;br /&gt;
 [/side]&lt;br /&gt;
 [event]&lt;br /&gt;
   name=turn 3&lt;br /&gt;
   {MODIFY_AI_TRY_DELETE_ASPECT {SIDE} attacks hold_off_initial_scout_attack}&lt;br /&gt;
 [/event]&lt;br /&gt;
&lt;br /&gt;
The above code stops the calculation of combat for the units matching the ''filter_own'' ''Single Unit Filter'' expression. The turn 3 event deletes this changed behavior (presumably after the scouts have collected a village).&lt;br /&gt;
&lt;br /&gt;
This approach might also be useful for when it is desired that a certain unit or type of unit should not attack. Alternatively, it could be useful to specify that a beserker, say, should not attack unless a formula AI candidate action expression evaluates to &amp;gt; 0 (be careful that you don't rely on the built-in calculation functions though, as they are not executed with this aspect set).&lt;/div&gt;</summary>
		<author><name>Coffee</name></author>
		
	</entry>
</feed>