XML/Unit

From MegaGlest
Revision as of 00:43, 25 June 2011 by Hofmic (talk) (XML_definition_header)
Jump to: navigation, search
This article is under construction

The article is undergoing expansion or major revamping, and the article should not be considered accurate until this tag is removed. You can help expand it by editing the article.


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

GAE Only
MegaGlest Only
GAE and MegaGlest Only
<?xml version="1.0" standalone="no" ?>
<unit>
	<parameters>
		<size value="2" />
		<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" />
		<cellmap value="true">
			<row value="10"/>
			<row value="01"/>
		</cellmap>
		<levels>
			<level name="level_name" kills="3"/>
			<!-- Start GAE Only -->
			<level name="level_name" kills="7">
				<static-modifiers>
					<max-hp value="1"/>
					<max-ep value="1"/>
					<hp-regeneration value="1"/>
					<ep-regeneration value="1"/>
					<sight value="1"/>
					<armor value="1"/>
					<attack-strength value="1"/>
					<effect-strength value="1"/>
					<attack-percent-stolen value="1"/>
					<attack-range value="1"/>
					<move-speed value="1"/>
					<attack-speed value="1"/>
					<production-speed value="1"/>
					<repair-speed value="1"/>
					<harvest-speed value="1"/>
				</static-modifiers>
				<multipliers>
					<max-hp value="1"/>
					<max-ep value="1"/>
					<hp-regeneration value="1"/>
					<ep-regeneration value="1"/>
					<sight value="1"/>
					<armor value="1"/>
					<attack-strength value="1"/>
					<effect-strength value="1"/>
					<attack-percent-stolen value="1"/>
					<attack-range value="1"/>
					<move-speed value="1"/>
					<attack-speed value="1"/>
					<production-speed value="1"/>
					<repair-speed value="1"/>
					<harvest-speed value="1"/>
				</multipliers>
			</level>
			<!-- End GAE Only -->
		</levels>
		<fields>
			<field value="land" />
		</fields>
		<properties>
			<property value="burnable"/>
			<!-- Start GAE Only -->
			<property value="wall"/>
			<property value="multi-build"/>
			<property value="multi-select"/>
			<!-- End GAE Only -->
		</properties>
		<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>
		<!-- Start GAE Only -->
		<emanations>

			<!-- See section: emanations -->

		</emanations>
		<!-- End GAE Only -->
	</parameters>
	<skills>

		<!-- See section: skills -->

	</skills>
	<commands>

		<!-- See section: commands -->

	</commands>
</unit>

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.

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\[\text{Damage} = \left(\frac{\text{Attack Strength} + \text{Random}}{\left(\text{Distance} + 1\right) - \text{Armor}}\right) \times \text{Damage Multiplier}\]

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\[\text{World Frames} = \text{Time} \times floor\left(\frac{1}{\frac{\text{speed}}{4000} + 1}\right)\]

multi-selection

If true, all units of the same type can be mass selected by double clicking one of them. As well, this must be on for the unit to be selectable by clicking and dragging a selection box (otherwise the selection box ignores that type of unit). 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.

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 <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.

levels

Levels are increases in stats and a name change that occur after the unit reaches a certain number of kills. For Glest and 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% HP, +50% EP, +50% armor, and +20% sight boost, which stacks with each level.

In GAE, customizing the levels can be done by specifying specific boosts as either static modifiers or multipliers. A static modifier increases stats by an absolute amount, and a multiplier multipliers the stats by a number.

Table of Level Attributes (GAE Only)

Value Description
<max-hp> Modifies the maximum HP.
<hp-regen> Modifies the HP regeneration rate.
<max-ep> Modifies the maximum EP.
<ep-regen> Modifies the EP regeneration rate.
<sight> Modifies the unit's sight.
<armor> Modifies the unit's armor strength.
<attack-strength> Modifies the unit's attack strength.
<attack-range> Modifies the unit's attack ragen.
<attack-speed> Modifies the unit's attack speed.
<move-speed> Modifies the speed the unit moves at.
<production-speed> Modifies the production speed (speed of creating units or morphing).
<repair-speed> Modifies the speed of the repair skill.
<harvest-speed> Modifies the speed of the harvest skill.
<effect-strength> Modifies the strength of effects.

fields

Fields are the area that units can traverse. In Glest and MegaGlest, 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. In GAE, the additional fields of any_water (deep or shallow water), deep_water (only the deep areas that land units cannot enter), or amphibious (the unit can traverse both land and water (of any depth) but are still limited by unwalkable terrain).

properties

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%.
  • wall - GAE Only, will eventually tell the AI to treat the building like a wall, but currently such a function does not exist, so it just tells the AI not to construct the building.
  • multi-build - GAE Only, tells the engine you can build multiple of this building at once by dragging and dropping the mouse after selecting a build location. Used mainly for walls.
  • multi-select - GAE Only, an alternative way of telling the engine that this unit can have multi-selected (see multi-selection above).

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.

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 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.

image

Path to the unit's icon, which will be displayed on the HUD. In Glest, images can be either BMP or TGA. In MegaGlest and GAE, 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). In Glest, images can be either BMP or TGA. In MegaGlest and GAE, they 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. In Glest, images can be either BMP or TGA. In MegaGlest and GAE, they can be BMP, TGA, JPG, or PNG.

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.

emanations

skills

This article or section is incomplete and requires further information.
You can edit this page to improve it.


Skills define the abilities of a unit.

commands

This article or section is incomplete and requires further information.
You can edit this page to improve it.


Commands define the actions that a unit can execute.

See also