Difference between revisions of "XML/Unit"

From MegaGlest
Jump to navigation Jump to search
 
(54 intermediate revisions by 8 users not shown)
Line 1: Line 1:
<?xml version="1.0" standalone="no" ?>
+
([[XML|Back to XML Overview ]])
 
<unit>
 
    <parameters>
 
        <size value="#" />                      <!-- How many units per side a building uses -->
 
        <height value="#" />                    <!-- The height of a unit -->
 
        <max-hp value="#" regeneration="#"/>    <!-- Maximum hit points and rate of regeneration -->
 
        <max-ep value="#" regeneration="#"/>    <!-- Maximum energy points and rate of regeneration -->
 
        <armor value="#" />                      <!-- Armor value of unit -->
 
        <armor-type value="wood"/>              <!-- Type of armor - some weapons are more effective against some
 
                                                        armor types; Editable in the [[Tech XML|<font color="green">Tech XML</font>]] file --&gt;
 
        &lt;sight value="#" /&gt;                      &lt;!-- Range of sight to react to other units --&gt;
 
        &lt;time value="#" /&gt;                      &lt;!-- Time required to build unit. --&gt;
 
        &lt;multi-selection value="false" /&gt;        &lt;!-- Is double-click on unit multi-select other unit of same type --&gt;
 
        &lt;cellmap value="true"&gt;                  &lt;!-- For Buildings, which Cells in a building a unit can pass through
 
                                                        (0 can pass, 1 cannot). The number of rows and the number of
 
                                                        digits in a line must match the size given above! --&gt;
 
            &lt;row value="1011"/&gt;
 
            &lt;row value="1011"/&gt;
 
            &lt;row value="0000"/&gt;
 
            &lt;row value="1011"/&gt;
 
        &lt;/cellmap&gt;
 
        &lt;levels/&gt;                                &lt;!-- Levels automatically improve Hit points, Energy Points, and
 
                                                        Armor by 50%, as well as sight by 20%. --&gt;
 
            &lt;level name="level_name" kills="#"/&gt; &lt;!-- level_name is the designation, kills denotes how many enemies
 
                                                        must be destroyed to achieve it --&gt;
 
        &lt;/levels&gt;
 
        &lt;fields&gt;                                &lt;!-- Where is it considered to be for purposes of being attacked;
 
                                                        land weapons can attack land, etcetera --&gt;
 
            &lt;field value="land" /&gt;
 
            &lt;field value="air" /&gt;
 
        &lt;/fields&gt;
 
        &lt;properties&gt;                            &lt;!-- Properties (like flags) that can be set for the unit  --&gt;
 
            &lt;property value="burnable"/&gt;        &lt;!-- If set, unit will catch on fire (visually) when damage causes
 
                                                        it to go below 50% (i.e., wont catch on fire when it's below
 
                                                        50% at the start of construction, for instance). --&gt;
 
        &lt;/properties&gt;
 
                                                  &lt;!-- If enabled, specifies light generated by unit (currently only
 
                                                        generates light at night).  RGB values must be &gt;= 0 and &lt;= 1. --&gt;
 
        &lt;light enabled="false" red="0.0" green="0.0" blue="0.0"/&gt;
 
        &lt;unit-requirements&gt;                      &lt;!-- Units required to be in use before creating --&gt;
 
            &lt;unit name="unit_name" /&gt;
 
        &lt;/unit-requirements&gt;
 
        &lt;upgrade-requirements&gt;                  &lt;!-- Upgrades required to be in use before creating --&gt;
 
            &lt;upgrade name="upgrade_name"/&gt;
 
        &lt;/upgrade-requirements&gt;
 
        &lt;resource-requirements&gt;                  &lt;!-- Resources used for upgrade (if negative resources will be added
 
                                                        to player) --&gt;
 
            &lt;resource name="resource_name" amount="#" /&gt;
 
        &lt;/resource-requirements&gt;
 
        &lt;resources-stored&gt;                      &lt;!-- Resource that the unit can store for inventory purposes --&gt;
 
            &lt;resource name="resource_name" amount="#" /&gt;
 
        &lt;/resources-stored&gt;
 
        &lt;image path="images/aerodrome.bmp"/&gt;    &lt;!-- Path to Image Icon --&gt;
 
        &lt;image-cancel path="images/cancel.bmp"/&gt; &lt;!-- Path to cancellation icon --&gt;
 
                                                  &lt;!-- Can the unit be used as a meeting point for other units, and the
 
                                                        UI icon to be used to initiate. --&gt;
 
        &lt;meeting-point value="true" image-path="../../../../common/tech_meeting_point.bmp"/&gt;
 
        &lt;selection-sounds enabled="true"&gt;        &lt;!-- Audio feedback to note unit selections --&gt;
 
            &lt;sound path="../../../../common/tech_click.wav" /&gt;
 
        &lt;/selection-sounds&gt;
 
        &lt;command-sounds enabled="true"&gt;          &lt;!-- Audio feedback to note unit UI selections --&gt;
 
            &lt;sound path="../../../../common/tech_click.wav" /&gt;
 
        &lt;/command-sounds&gt;
 
    &lt;/parameters&gt;
 
    &lt;skills&gt;                                    &lt;!-- Skills are what a unit can do. --&gt;
 
        &lt;skill&gt;
 
            &lt;type value="attack"/&gt;              &lt;!-- Type of  skill --&gt;
 
            &lt;name value="attack_skill"/&gt;        &lt;!-- name of this skill (refer to it) --&gt;
 
            &lt;ep-cost value="40"/&gt;                &lt;!-- How many energy points used for each use of skill --&gt;
 
            &lt;speed value="60"/&gt;                  &lt;!-- The speed of skill (more=faster) --&gt;
 
            &lt;anim-speed value="60"/&gt;            &lt;!-- Animation speed --&gt;
 
            &lt;animation path="models/battlemage_attacking.g3d"/&gt;    &lt;!-- Animation path --&gt;
 
            &lt;sound enabled="true" start-time="0.3"&gt;                &lt;!-- Is sound enabled. Sound start delayed by this
 
                                                                          time. --&gt;
 
                &lt;sound-file path="sounds/battlemage_attack1.wav"/&gt;  &lt;!-- path to sound --&gt;
 
            &lt;/sound&gt;
 
            &lt;attack-strenght value="140"/&gt;      &lt;!-- attack strength Note Spelling; Minor bug, not corrected as of
 
                                                        Glest 3.1.2 nor GAE 0.2.8a --&gt;
 
            &lt;attack-var value="40"/&gt;            &lt;!-- attack of unit = attack-strenght +- attack-var --&gt;
 
            &lt;attack-range value="7"/&gt;            &lt;!-- attack range --&gt;
 
            &lt;attack-type value="magic"/&gt;        &lt;!-- Type of weapon - some weapons are more effective against some
 
                                                        armor types; Editable in the [[Tech XML|<font color="green">Tech XML</font>]] file --&gt;
 
            &lt;attack-fields&gt;                      &lt;!-- Whom can attack; land weapons can attack land, air - air. --&gt;
 
                &lt;field value="land"/&gt;
 
            &lt;/attack-fields&gt;
 
            &lt;attack-start-time value="0.6"/&gt;    &lt;!-- When the actual attack starts relative to when the unit started
 
                                                        executing the attack skill --&gt;
 
            &lt;projectile value="true"&gt;            &lt;!-- Use projectile  (true for shooting,false for melee) --&gt;
 
                &lt;particle value="true" path="particle_proj.xml"/&gt; &lt;!-- Path to projectile fail --&gt;
 
                &lt;sound enabled="true"&gt;          &lt;!-- path to sound file --&gt;
 
                    &lt;sound-file path="sounds/battlemage_hit1.wav"/&gt;
 
                &lt;/sound&gt;
 
            &lt;/projectile&gt;
 
            &lt;splash value="true"&gt;                &lt;!-- Will projectile explode --&gt;
 
                &lt;radius value="0"/&gt;              &lt;!-- radius of explosion --&gt;
 
                &lt;damage-all value="true"/&gt;      &lt;!-- Will it damage all units (enemy & ally) (maybe be broken in both
 
                                                        Glest & GAE) --&gt;
 
                &lt;particle value="true" path="particle_splash.xml"/&gt;  &lt;!-- Path to explosion file --&gt;
 
            &lt;/splash&gt;
 
        &lt;/skill&gt;
 
  ...
 
    &lt;/skills&gt;
 
    &lt;commands&gt;                                  &lt;!-- Commands create the specific UI for accessing skills --&gt;
 
        &lt;command&gt;
 
            &lt;type value="morph"/&gt;                &lt;!-- Type of command --&gt;
 
            &lt;name value="promote_to_archmage"/&gt;  &lt;!-- In game description --&gt;
 
            &lt;image path="../archmage/images/archmage.bmp"/&gt;  &lt;!-- Path to icon image --&gt;
 
            &lt;unit-requirements/&gt;                &lt;!-- See above --&gt;
 
            &lt;upgrade-requirements/&gt;              &lt;!-- See above --&gt;
 
            &lt;morph-skill value="morph_skill"/&gt;  &lt;!-- reference to which skill to use --&gt;
 
            &lt;morph-unit name= "archmage"/&gt;      &lt;!-- Morphing to unit --&gt;
 
            &lt;discount value="0"/&gt;                &lt;!-- discount to morph (100=free morphing, 0=full unit cost) NOTE: you
 
                                                        still need to spend full cost at the start,but at the end of
 
                                                        morphing you get resources back. --&gt;
 
        &lt;/command&gt;
 
  ...
 
    &lt;/commands&gt;
 
&lt;/unit&gt;
 
  
 +
The [[unit]] [[XML]] is the main body of a mod, defining everything about each unit. Every unit has this XML, which is named the same as their unit folder, and defines their stats and abilities, as well as various other bits of information on the unit.
  
If anyone needs a downloadable version of a rtf format outline, check out mine: http://www.mediafire.com/?ydypxxsyx3x
 
  
Back to [[XML_Definitions]]
+
==XML==
 +
<syntaxhighlight lang="xml">
 +
<?xml version="1.0" standalone="no" ?>
 +
<unit>
 +
<parameters>
 +
<size value="2" />
 +
<height value="2" />
 +
<target-height value="2" />
 +
<burn-height value="2" />
 +
<max-hp value="800" regeneration="2" />
 +
<max-ep value="100" regeneration="5" />
 +
<armor value="20" />
 +
<armor-type value="organic" />
 +
<sight value="15" />
 +
<time value="100" />
 +
<multi-selection value="false" />
 +
<uniform-selection value="false" />
 +
<cellmap value="true" allowEmpty="false">
 +
<row value="10" />
 +
<row value="01" />
 +
</cellmap>
 +
<levels>
 +
<level name="level_name" kills="3" />
 +
</levels>
 +
<fields>
 +
<field value="land" />
 +
</fields>
 +
<properties>
 +
<property value="burnable" />
 +
<property value="rotated_climb" />
 +
</properties>
 +
<rotationAllowed value="false" />
 +
<max-unit-count value="10" />
 +
<damage-particles value="true">
 +
<particle-file path="damage_particles.xml" />
 +
<particle-file path="damage2_particles.xml" />
 +
</damage-particles>
 +
<count-unit-death-in-stats value="true" />
 +
<count-unit-production-in-stats value="true" />
 +
<count-unit-kill-in-stats value="true" />
 +
<count-kill-for-unit-upgrade value="true" />
 +
<count-in-victory-conditions value="true"/>
 +
<light enabled="true" red="0.1" green="0.1" blue="0.3" />
 +
<unit-requirements>
 +
<unit name="unit_name" />
 +
</unit-requirements>
 +
<upgrade-requirements>
 +
<upgrade name="upgrade_name" />
 +
</upgrade-requirements>
 +
<resource-requirements>
 +
<resource name="resource_name" amount="50" />
 +
</resource-requirements>
 +
<resources-stored>
 +
<resource name="resource_name" amount="50" />
 +
</resources-stored>
 +
<image path="images/image.bmp" />
 +
<image-cancel path="images/cancel.bmp" />
 +
<meeting-point value="true" image-path="images/meeting_point.bmp" />
 +
<selection-sounds enabled="true">
 +
<sound path="sound/selection_sound.wav" />
 +
</selection-sounds>
 +
<command-sounds enabled="true">
 +
<sound path="sound/command_sound.wav" />
 +
</command-sounds>
 +
<tags>
 +
<tag value="tag_name"/>
 +
</tags>
 +
        <resources-death>
 +
            <resource name="wood" amount-value="100" loss-value="100" allow-negative="true" />
 +
            <resource name="gold" amount-faction-percent="10" loss-faction-percent="10" />
 +
            <resource name="food" amount-value="1" />
 +
        </resources-death>
 +
</parameters>
 +
<skills>
 +
 
 +
<!-- See section: skills -->
 +
 
 +
</skills>
 +
<commands>
 +
 
 +
<!-- See section: [[XML/Commands|Commands]] -->
 +
 
 +
</commands>
 +
</unit>
 +
</syntaxhighlight>
 +
 
 +
==Documentation==
 +
===size===
 +
This is the width of the unit in Glest cells. Note that all units take up a perfect square of cells, so size 2 means it's a 2x2 unit.
 +
 
 +
===height===
 +
The height of the unit is used for check for collision of projectile attacks, as well as for determining the placement of particles such as flames. Most standard humanoids are 2-3 units tall.
 +
 
 +
===target-height===
 +
A height which is used to calculate the target height for projectiles shot by attacking units. Per default this value is the same as the height.
 +
 
 +
===burn-height===
 +
A height which is used to calculate the the position of the fire particle system if the unit is burnable. Per default this value is the same as the height.
 +
 
 +
===max-hp===
 +
The maximum health of the unit. A produced unit has full health once produced, but a building starts at zero health, and will increase as it is built, with construction ending once it reaches full health. When health reaches zero, the unit dies.
 +
 
 +
===max-ep===
 +
The maximum energy of a unit. Skills can have energy requirements, meaning they draw a certain amount of energy each skill cycle.
 +
 
 +
===armor===
 +
Damage that is subtracted from the damage, using the following formula:
 +
 
 +
<math>\text{Damage} = \left(\frac{\text{Attack Strength} + \text{Random}}{\text{Distance} + 1} - \text{Armor}\right) \times \text{Damage Multiplier}</math>
 +
 
 +
===armor-type===
 +
The type of armor, which is declared in the [[Faction XML]] and can be set with a multiplier so that different attack types will do damage based on the type of armor the foe has, such as a sword doing less damage on metal armor than bare flesh.
 +
 
 +
===sight===
 +
The distance a unit can see, as a radius in glest units. Units cannot attack others outside of their sight, and [[fog of war]]/[[shroud of darkness]] are removed when they are inside a unit's sight.
 +
 
 +
===time===
 +
The time it takes to produce this unit. Varies according to the producer's production speed, but follows the following formula:
 +
 
 +
<math>\text{World Frames} = \text{Time} \times floor\left(\frac{1}{\frac{\text{speed}}{4000} + 1}\right)</math>
 +
 
 +
===multi-selection===
 +
If true this unit can be selected with other units. If false, a selection box ignores that type of unit if selected with other units. This should generally be off for buildings and on for regular units, unless there is any reason you don't want them to be easily mass selected.
 +
 
 +
===uniform-selection===
 +
If true this unit can only be in a selection with units of the same type. ( new in post 3.12 versions )
 +
 
 +
===cellmap===
 +
Cellmaps are generally used only for buildings to define what parts are walkable and what parts are not. If the building takes up the entire square that is defined by its size, then the cellmap should not be used (the value should be false the tag should be immediately closed, such as <tt>&lt;cellmap value="false" /&gt;</tt>). Otherwise, if using the cellmap, there must be as many row elements as the size, and each of these row's must have a value containing as many characters as the unit's size. So if the unit is size 2, there should be two row tags each with 2 characters. These characters are 1's (cannot be walked on) and 0's (can be walked on). Cellmaps are rotated with the unit.
 +
 
 +
The <tt>allowEmpty</tt> attribute is a MegaGlest only attribute which allows a unit with an all zero cellmap to be completely ignored by the AI and immune to attacks, circumventing the AI issues that would occur if not used. Note that even on a size zero unit, the cellmap value must be set to <tt>true</tt> (eg, <tt>&lt;cellmap value="true" allowEmpty="true" /&gt;</tt>).
 +
 
 +
===levels===
 +
Levels are increases in stats and a name change that occur after the unit reaches a certain number of kills. For [[MegaGlest]], only the name and level can be changed. When the unit reaches that number of kills, the name is prefixed to the unit and they are given a +50% max HP, +50% max EP, +50% armor, and +20% sight boost, which stacks with each level.
 +
 
 +
===fields===
 +
Fields are the area that units can traverse. Currently this is limited to <tt>land</tt> and <tt>air</tt>. Land units can only walk on walkable parts of the land and shallow water, while air units can fly and traverse everywhere.
 +
 
 +
===properties===
 +
Properties are additional flags which take no parameters, but can define the unit.
 +
*<tt>burnable</tt> - When the unit drops to under 50% HP (only after being attacked for the first time, to prevent the occurance when building), a flame particle effect starts and persists until the unit's HP is back above 50%.
 +
*<tt>rotated-climb</tt> - MG Only, this will make units rotate when moving on sloped surfaces so that they are parallel to the surface. Meant for units such as tanks, which look unnatural if they do not slope with the ground. Units such as humanoids would generally not use this, as they would stand upright even on slopes.
 +
 
 +
===rotationAllowed===
 +
A [[MegaGlest]] only element which toggles whether or not the building can be rotated.
 +
 
 +
===max-unit-count===
 +
An MG only feature which, if specified, will limit the maximum number of that unit to the specified number. If the unit count should not be limited, as is the default for most units, exclude the tag completely.
 +
 
 +
===count-unit-death-in-stats===
 +
A MegaGlest only feature which, if set to false, will not count a death of this unit for the endgame stats. The tag is optional and defaults to true.
 +
 
 +
===count-unit-production-in-stats===
 +
A MegaGlest only feature which, if set to false, will not count a production of this unit for the endgame stats. The tag is optional and defaults to true.
 +
 
 +
===count-unit-kill-in-stats===
 +
A MegaGlest only feature which, if set to false, will not count a kill of this unit for the endgame stats. The tag is optional and defaults to true.
 +
 
 +
===count-kill-for-unit-upgrade===
 +
A MegaGlest only feature which, if set to false, will not count a kill of this unit for the number of kills of the killing unit. The tag is optional and defaults to true. If its set to false, <tt>count-unit-kill-in-stats</tt> is automatically set to false too.
 +
 
 +
===count-in-victory-conditions===
 +
A Megaglest only feature which, if set to false, the unit will not have to be killed for the game to be a victory. Normally, the game ends when all units with a <tt>be-built</tt> skill are killed.
 +
 
 +
===light-enabled===
 +
If true, when night begins, this unit will emit light in the specified color. Color is done with RGB values from 0-1, which specify how much of the color is each hue.
 +
 
 +
So a unit with a red value of 0.5, a green value of 0, and a blue value of 0.5 will emit a medium strength magenta light.
 +
 
 +
===unit-requirements===
 +
The names of any other units that may be required to produce this unit.
 +
 
 +
===upgrade-requirements===
 +
The names of any upgrades that may be required to produce this unit.
 +
 
 +
===resource-requirements===
 +
The [[Resource XML|resource]] cost to produce this unit.
 +
 
 +
===resources-stored===
 +
Using the same syntax as resource-requirements above, resources stored is the number of resources that can be stored in this unit. This expands the total maximum storage as shown at the top of the [[HUD]], and also performs the more valuable function of letting units head to it after harvesting that resource.
 +
 
 +
===resources-death ( looting ) ===
 +
The resources gained by the player who killed the unit, and/ or the resources lost by the player who owned the unit when the unit is killed.
 +
*<tt>amount-value</tt> is the absolute amount to give to the killing player.
 +
*<tt>loss-value</tt>  is the absolute amount of resources that is removed from the player who owns the killed unit.
 +
*<tt>amount-faction-percent</tt> is the percentage of the resources stored by the player who owns this unit (when the unit is killed), that is then given to the player who kills this unit.
 +
*<tt>loss-faction-percent</tt> is the percentage of the resources stored by the player who owns this unit (when the unit is killed), that is then taken from the player who owns this unit.
 +
All the variables listed above can have a negative value, which causes an inverse effect (i.e. resources are gained by the player who owns the unit/ resources are taken from the player who kills the unit).
 +
*<tt>allow-negative</tt> defines whether the final resource count of the player losing resources can go below 0. If set to true, when this unit is killed, the resources-store of the player losing resources can go into negatives. If set to false, if the resources to be taken is greater than the resources the player has, then the player's resource count becomes 0.
 +
 
 +
===image===
 +
Path to the unit's icon, which will be displayed on the HUD. In MegaGlest they can be BMP, TGA, JPG, or PNG.
 +
 
 +
===image-cancel===
 +
Path to the cancel icon that will be used by the image, which will be displayed at the bottom of the unit box on the HUD, for canceling their current action (upgrades specify their own cancel icon in the [[Upgrade XML]]). Images can be BMP, TGA, JPG, or PNG.
 +
 
 +
===meeting-point===
 +
If true, a meeting point will be used, which is a selectable location that produced units will be sent to. Generally only given to buildings because otherwise the right click "hotkey" is used for move. The path is the icon that can be used to choose the meeting point location.
 +
 
 +
===selection-sounds===
 +
If true, the following list of sounds can be played when the unit is selected, at random. Path links to a relative path to the sound file. Sound files in Glest can be either WAV or OGG.
 +
 
 +
===command-sounds===
 +
If true, the following list of sounds can be played when the unit is given a command, at random. Path links to a relative path to the sound file. Sound files in Glest can be either WAV or OGG.
 +
 
 +
===tags===
 +
Tags are a implementation which allows units to be assigned to a "group". You could then use those to perform affects only to units with that specific tag. For example, it's possible to have an [[XML/Upgrades|upgrade]] affect only units with that specific tag.
 +
 
 +
As a result, you could tag all melee units with a tag named "melee", and have an effect that boosts only the attack strength of melee units. Or you could tag a unit as a "building" to have an effect that only affects buildings.
 +
 
 +
Tags are defined in a the parameter node of the unit xml. and are used by adding extra tag lines in skills.
 +
 
 +
===skills===
 +
{{See|XML/Skills}}
 +
[[Skills]] define the abilities of a unit, and are generally used with commands to provide actions that the unit can perform, but sometimes mandate automated events too, such as the death skill, which fires every time the unit dies.
 +
 
 +
===commands===
 +
{{See|XML/Commands}}
 +
[[Commands]] are the actions that a unit can be given. Unlike skills, which are called by commands, commands are directly the result of user interaction. For example, an attack command can be called by the player to issue an attack on the foe. All commands require some types of skills, which they use to find information like speed or the model.
 +
 
 +
==See also==
 +
*[[XMLs]]
 +
*[[XML/Commands|Commands]]
 +
[[Category:XMLs]]

Latest revision as of 01:03, 11 October 2019

(Back to XML Overview )

The unit XML is the main body of a mod, defining everything about each unit. Every unit has this XML, which is named the same as their unit folder, and defines their stats and abilities, as well as various other bits of information on the unit.


XML[edit]

<?xml version="1.0" standalone="no" ?>
<unit>
	<parameters>
		<size value="2" />
		<height value="2" />
		<target-height value="2" />
		<burn-height value="2" />
		<max-hp value="800" regeneration="2" />
		<max-ep value="100" regeneration="5" />
		<armor value="20" />
		<armor-type value="organic" />
		<sight value="15" />
		<time value="100" />
		<multi-selection value="false" />
		<uniform-selection value="false" />
		<cellmap value="true" allowEmpty="false">
			<row value="10" />
			<row value="01" />
		</cellmap>
		<levels>
			<level name="level_name" kills="3" />
		</levels>
		<fields>
			<field value="land" />
		</fields>
		<properties>
			<property value="burnable" />
			<property value="rotated_climb" />
		</properties>
		<rotationAllowed value="false" />
		<max-unit-count value="10" />
		<damage-particles value="true">
			<particle-file path="damage_particles.xml" />
			<particle-file path="damage2_particles.xml" />
		</damage-particles>
		<count-unit-death-in-stats value="true" />
		<count-unit-production-in-stats value="true" />
		<count-unit-kill-in-stats value="true" />
		<count-kill-for-unit-upgrade value="true" />
		<count-in-victory-conditions value="true"/>
		<light enabled="true" red="0.1" green="0.1" blue="0.3" />
		<unit-requirements>
			<unit name="unit_name" />
		</unit-requirements>
		<upgrade-requirements>
			<upgrade name="upgrade_name" />
		</upgrade-requirements>
		<resource-requirements>
			<resource name="resource_name" amount="50" />
		</resource-requirements>
		<resources-stored>
			<resource name="resource_name" amount="50" />
		</resources-stored>
		<image path="images/image.bmp" />
		<image-cancel path="images/cancel.bmp" />
		<meeting-point value="true" image-path="images/meeting_point.bmp" />
		<selection-sounds enabled="true">
			<sound path="sound/selection_sound.wav" />
		</selection-sounds>
		<command-sounds enabled="true">
			<sound path="sound/command_sound.wav" />
		</command-sounds>
		<tags>
			<tag value="tag_name"/>
		</tags>
        <resources-death>
            <resource name="wood" amount-value="100" loss-value="100" allow-negative="true" />
            <resource name="gold" amount-faction-percent="10" loss-faction-percent="10" />
            <resource name="food" amount-value="1" />
        </resources-death>
	</parameters>
	<skills>

		<!-- See section: skills -->

	</skills>
	<commands>

		<!-- See section: [[XML/Commands|Commands]] -->

	</commands>
</unit>

Documentation[edit]

size[edit]

This is the width of the unit in Glest cells. Note that all units take up a perfect square of cells, so size 2 means it's a 2x2 unit.

height[edit]

The height of the unit is used for check for collision of projectile attacks, as well as for determining the placement of particles such as flames. Most standard humanoids are 2-3 units tall.

target-height[edit]

A height which is used to calculate the target height for projectiles shot by attacking units. Per default this value is the same as the height.

burn-height[edit]

A height which is used to calculate the the position of the fire particle system if the unit is burnable. Per default this value is the same as the height.

max-hp[edit]

The maximum health of the unit. A produced unit has full health once produced, but a building starts at zero health, and will increase as it is built, with construction ending once it reaches full health. When health reaches zero, the unit dies.

max-ep[edit]

The maximum energy of a unit. Skills can have energy requirements, meaning they draw a certain amount of energy each skill cycle.

armor[edit]

Damage that is subtracted from the damage, using the following formula\[\text{Damage} = \left(\frac{\text{Attack Strength} + \text{Random}}{\text{Distance} + 1} - \text{Armor}\right) \times \text{Damage Multiplier}\]

armor-type[edit]

The type of armor, which is declared in the Faction XML and can be set with a multiplier so that different attack types will do damage based on the type of armor the foe has, such as a sword doing less damage on metal armor than bare flesh.

sight[edit]

The distance a unit can see, as a radius in glest units. Units cannot attack others outside of their sight, and fog of war/shroud of darkness are removed when they are inside a unit's sight.

time[edit]

The time it takes to produce this unit. Varies according to the producer's production speed, but follows the following formula\[\text{World Frames} = \text{Time} \times floor\left(\frac{1}{\frac{\text{speed}}{4000} + 1}\right)\]

multi-selection[edit]

If true this unit can be selected with other units. If false, a selection box ignores that type of unit if selected with other units. This should generally be off for buildings and on for regular units, unless there is any reason you don't want them to be easily mass selected.

uniform-selection[edit]

If true this unit can only be in a selection with units of the same type. ( new in post 3.12 versions )

cellmap[edit]

Cellmaps are generally used only for buildings to define what parts are walkable and what parts are not. If the building takes up the entire square that is defined by its size, then the cellmap should not be used (the value should be false the tag should be immediately closed, such as <cellmap value="false" />). Otherwise, if using the cellmap, there must be as many row elements as the size, and each of these row's must have a value containing as many characters as the unit's size. So if the unit is size 2, there should be two row tags each with 2 characters. These characters are 1's (cannot be walked on) and 0's (can be walked on). Cellmaps are rotated with the unit.

The allowEmpty attribute is a MegaGlest only attribute which allows a unit with an all zero cellmap to be completely ignored by the AI and immune to attacks, circumventing the AI issues that would occur if not used. Note that even on a size zero unit, the cellmap value must be set to true (eg, <cellmap value="true" allowEmpty="true" />).

levels[edit]

Levels are increases in stats and a name change that occur after the unit reaches a certain number of kills. For MegaGlest, only the name and level can be changed. When the unit reaches that number of kills, the name is prefixed to the unit and they are given a +50% max HP, +50% max EP, +50% armor, and +20% sight boost, which stacks with each level.

fields[edit]

Fields are the area that units can traverse. Currently this is limited to land and air. Land units can only walk on walkable parts of the land and shallow water, while air units can fly and traverse everywhere.

properties[edit]

Properties are additional flags which take no parameters, but can define the unit.

  • burnable - When the unit drops to under 50% HP (only after being attacked for the first time, to prevent the occurance when building), a flame particle effect starts and persists until the unit's HP is back above 50%.
  • rotated-climb - MG Only, this will make units rotate when moving on sloped surfaces so that they are parallel to the surface. Meant for units such as tanks, which look unnatural if they do not slope with the ground. Units such as humanoids would generally not use this, as they would stand upright even on slopes.

rotationAllowed[edit]

A MegaGlest only element which toggles whether or not the building can be rotated.

max-unit-count[edit]

An MG only feature which, if specified, will limit the maximum number of that unit to the specified number. If the unit count should not be limited, as is the default for most units, exclude the tag completely.

count-unit-death-in-stats[edit]

A MegaGlest only feature which, if set to false, will not count a death of this unit for the endgame stats. The tag is optional and defaults to true.

count-unit-production-in-stats[edit]

A MegaGlest only feature which, if set to false, will not count a production of this unit for the endgame stats. The tag is optional and defaults to true.

count-unit-kill-in-stats[edit]

A MegaGlest only feature which, if set to false, will not count a kill of this unit for the endgame stats. The tag is optional and defaults to true.

count-kill-for-unit-upgrade[edit]

A MegaGlest only feature which, if set to false, will not count a kill of this unit for the number of kills of the killing unit. The tag is optional and defaults to true. If its set to false, count-unit-kill-in-stats is automatically set to false too.

count-in-victory-conditions[edit]

A Megaglest only feature which, if set to false, the unit will not have to be killed for the game to be a victory. Normally, the game ends when all units with a be-built skill are killed.

light-enabled[edit]

If true, when night begins, this unit will emit light in the specified color. Color is done with RGB values from 0-1, which specify how much of the color is each hue.

So a unit with a red value of 0.5, a green value of 0, and a blue value of 0.5 will emit a medium strength magenta light.

unit-requirements[edit]

The names of any other units that may be required to produce this unit.

upgrade-requirements[edit]

The names of any upgrades that may be required to produce this unit.

resource-requirements[edit]

The resource cost to produce this unit.

resources-stored[edit]

Using the same syntax as resource-requirements above, resources stored is the number of resources that can be stored in this unit. This expands the total maximum storage as shown at the top of the HUD, and also performs the more valuable function of letting units head to it after harvesting that resource.

resources-death ( looting )[edit]

The resources gained by the player who killed the unit, and/ or the resources lost by the player who owned the unit when the unit is killed.

  • amount-value is the absolute amount to give to the killing player.
  • loss-value is the absolute amount of resources that is removed from the player who owns the killed unit.
  • amount-faction-percent is the percentage of the resources stored by the player who owns this unit (when the unit is killed), that is then given to the player who kills this unit.
  • loss-faction-percent is the percentage of the resources stored by the player who owns this unit (when the unit is killed), that is then taken from the player who owns this unit.

All the variables listed above can have a negative value, which causes an inverse effect (i.e. resources are gained by the player who owns the unit/ resources are taken from the player who kills the unit).

  • allow-negative defines whether the final resource count of the player losing resources can go below 0. If set to true, when this unit is killed, the resources-store of the player losing resources can go into negatives. If set to false, if the resources to be taken is greater than the resources the player has, then the player's resource count becomes 0.

image[edit]

Path to the unit's icon, which will be displayed on the HUD. In MegaGlest they can be BMP, TGA, JPG, or PNG.

image-cancel[edit]

Path to the cancel icon that will be used by the image, which will be displayed at the bottom of the unit box on the HUD, for canceling their current action (upgrades specify their own cancel icon in the Upgrade XML). Images can be BMP, TGA, JPG, or PNG.

meeting-point[edit]

If true, a meeting point will be used, which is a selectable location that produced units will be sent to. Generally only given to buildings because otherwise the right click "hotkey" is used for move. The path is the icon that can be used to choose the meeting point location.

selection-sounds[edit]

If true, the following list of sounds can be played when the unit is selected, at random. Path links to a relative path to the sound file. Sound files in Glest can be either WAV or OGG.

command-sounds[edit]

If true, the following list of sounds can be played when the unit is given a command, at random. Path links to a relative path to the sound file. Sound files in Glest can be either WAV or OGG.

tags[edit]

Tags are a implementation which allows units to be assigned to a "group". You could then use those to perform affects only to units with that specific tag. For example, it's possible to have an upgrade affect only units with that specific tag.

As a result, you could tag all melee units with a tag named "melee", and have an effect that boosts only the attack strength of melee units. Or you could tag a unit as a "building" to have an effect that only affects buildings.

Tags are defined in a the parameter node of the unit xml. and are used by adding extra tag lines in skills.

skills[edit]

Skills define the abilities of a unit, and are generally used with commands to provide actions that the unit can perform, but sometimes mandate automated events too, such as the death skill, which fires every time the unit dies.

commands[edit]

Commands are the actions that a unit can be given. Unlike skills, which are called by commands, commands are directly the result of user interaction. For example, an attack command can be called by the player to issue an attack on the foe. All commands require some types of skills, which they use to find information like speed or the model.

See also[edit]