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. There can be as many skills as you want (though there can only be one of some types of skills, such as the death or be_built skill).

type
This defines the type of the skill, e.g.: stop, move, be_built.

name
The name the skill is referenced in commands by, can be any valid variable name (starts with a letter, can contain letters, numbers, dashes, or underscores).

hp-cost
A MegaGlest only feature which allows a certain amount of HP to be depleted each time this skill is used (per skill cycle). This is currently broken.

ep-cost
How much EP the skill will require for each cycle. If there isn't enough EP, the skill cannot be executed.

- Exception for 'Stop' skill: NEVER use EP, because if there is no EP, the fallback is a stop skill, which just won't work.

speed
The speed that skill cycles at. Higher numbers make the skill go faster. The time it takes to perform a standard skill cycle can be found via the skill cycle formula.

- Exception for 'Be built' skill: Speed is not used here, as the time to construct the building is actually the time value, in the unit XML.

- Exception for 'Produce', 'Upgrade', 'Morph' skills: The time it takes is dependant on the time parameter, and uses the formula below. $$\text{World Frames} = \text{Time} \times floor\left(\frac{1}{\left(\frac{\text{speed}}{4000}\right)} + 1\right)$$

anim-speed
The speed to play the animation at. G3DHack is capable of setting an anim-speed for testing to find the perfect speed. Note that the anim-speed should generally be a lower number than the speed, otherwise the skill cycle will be repeated multiple times for a single animation.

- Exception for 'Repair' skill: If the anim-speed is a lower number than the speed, the skill cycle will be repeated multiple times for a single animation.

animation
The path to the G3D model that will be used when the unit is performing the skill. In MegaGlest, there can be multiples of this tag, and one will be chosen at random. You can also force a certain animation to be used when the unit's HP is between certain values with the minHp and maxHp attributes. For example, &lt;animation path="model.g3d" minHp="0" maxHp="100" /&gt; would force the animation model.g3d to be used when the unit's HP is between zero and 100.

animation-random-cycle-maxcount
This optional, MegaGlest only node tells the engine to cycle through the maximum specified random models. This is useful for death animations, where it can pick a random one but won't switch to another after it finishes animating. If this node does not exist the engine assume no maximum. Generally, it's only used for "one time" skills such as death or morph, while other skills would not not use the tag at all.

NOTE:This does not work for particle models.

sound
If true, randomly plays one of the listed sound files every time a skill cycle commences. There can be any number of sound files, and only one will be played each time, though the choice of which is random. The path is a relative path to the sound file, which can be either OGG or WAV.

particles
In MegaGlest and GAE only, you can set particles. If true, the unit will emit particles via a unit particle system. This is applied on a per skill basis, so if you want them to always be emitting the same particles, give them the same tags on every skill, except possibly be_built and die. You could also change the particles to modify the unit's appearance while doing a certain skill. For example, black smoke might turn fiery when a building is producing. There can be as many particle systems on a skill as you want, and each is placed by giving a particle-file tag the relative path of a Unit Particle XML.

MegaGlest can additionally use the start-time and end-time parameters (which will not work in GAE). These are as a percentage of the animation cycle, in decimal form, so a start-time of 0.5 would mean the particles start half way through the animation.

damage-particles
If true, these particles are displayed when the unit is damaged. You can specify the maximum and minimum HP (ie, a range) to display those particles, so you may have one particle system displayed when it is over half health, and one when it is under half health. The path links to the Unit Particle XML, and there can be as many particle-file children elements as desired.

animation
The path to the G3D model that will be used when the unit is performing the skill.

Stop
The stop skill is used for some commands where the unit would stand still, such as attack-stopped (hold position) or stop. Generally, when a unit isn't do any action, it performs the stop action, so it is necessary that all units have a stop skill, even if they don't have a stop command.

Most common entries in abilities

shake
If enabled camera shakes if skill is used. You can specify the intensity and duration. Also, you can setup different options for the player, allies and enemys. You can enable and disable each group. If visible is true the camera only shakes if the unit is visible (not hidden in fog-of-war). If in-camera-view is true the camera only shakes if the unit is in camera view. If camera-distance-affected is true the shake intensity is affected by the distance between the unit and the camera position.

Move
The move skill is the next most commonly used, used by mobile units to be able to move from place to place. It's used in commands like attack, move, patrol, and guard.

Most common entries in abilities

Be built
The be_built skill is an autoskill, meaning that it is not called by a command, but is automatically used as needed. All buildings should have a be_built skill, and it will be used to display the model while the build process takes place.

Most common entries in abilities

anim-progress-bound
A MegaGlest and GAE only value that, if true, will lock the animation speed to the progress of the unit as it builds. Thus, when the unit is half built, the animation would be halfway through, etc. This will override any specified animation speed and if not used, the entire tag may be omitted.

Repair
Repair is used to heal units and repair buildings.

Most common entries in abilities

max-range
GAE only, how far away the unit can be from its target when repairing.

amount
GAE only, if this tag is present, the formula used to calculate how much of the building to repair is overridden and this specified amount will be repaired each time.

multiplier
GAE only, how much to multiply the repair amount by, defaults to 1. For example, if set to 2.0, the unit will repair at double the speed it did before.

pet-only
GAE only, if true, this repairing can only be done to the unit's pets. Defaults to false. You cannot have self-only and pet-only both true at the same time, because those collide.

self-allowed
GAE only, if true, the unit is able to repair itself. If false, it cannot repair itself, even if it is capable of repairing units of the same type. Defaults to true.

self-only
GAE only, if true, the unit is only able to repair itself. If false, it can repair other units too (which may or may not include itself, depending on the value of self-allowed above). Note that you cannot have self-only be true but self-allowed be false, as that would collide. You also cannot have self-only and pet-only both true at the same time, because those also collide.

Build
The build skill is used to build buildings.

Most common entries in abilities

Harvest
The harvest skill is used to gather tech- and tileset-type Resources. If the resources are meant to be harvested as different mediums, you may wish to use multiple harvest skills and commands to allow you to use different models and harvest speeds.

Most common entries in abilities

Produce
The produce skill is used to produce units. This is most commonly done from a building, but can be done by mobile units too, such as how Magic's summoner works.

Most common entries in abilities

anim-progress-bound
A GAE and MegaGlest only value that, if true, will lock the animation speed to the progress of the production as it completes. Thus, when the production is half complete, the animation would be halfway through, etc. This will override any specified animation speed and if not used, the entire tag may be omitted.

pet
A GAE only value that, if true, makes the produced units into pets. Pets attack where their master attacks, and will die when the master dies, and have a maximum number that can be bound to one master unit, which is defined by the max parameter. Pets can also be given special targets in emanations so that it is possible to have a pet that has a negative HP regeneration normally, but when near their master, the master's emanation will boost their regen to be positive, thus further binding them to their master.

Upgrade
Skill used for the upgrade command. Unlike production, upgrades are one time events which can increase stats or unlock units (by having a unit use an upgrade-requirement).

Most common entries in abilities

anim-progress-bound
A GAE and MegaGlest only value that, if true, will lock the animation speed to the progress of the upgrade as it completes. Thus, when the upgrade is half complete, the animation would be halfway through, etc. This will override any specified animation speed and if not used, the entire tag may be omitted.

Morph
Similar to the produce skill, but rather than creating a new unit, it turns the current unit into a new unit.

Most common entries in abilities

anim-progress-bound
A GAE and MegaGlest only value that, if true, will lock the animation speed to the progress of the unit as it morphs. Thus, when the unit is half morphed, the animation would be halfway through, etc. This will override any specified animation speed and if not used, the entire tag may be omitted.

Attack
Attacks are the most complex skills, but also have the largest area of customizability. All types of attacks, long ranged, melee, splash attacks, etc all use the same attack skill and are defined via its elements.

Most common entries in abilities

unit
A MegaGlest only feature which spawns a unit of the specified name and quantity each time this attack is commenced. If this feature is not used, the tag should be excluded completely. Currently, it is not checked if the spawned units are dead before creating more. This feature is most useful for creating a custom unit such as a suicide bomb, or such which will destroy itself eventually.

attack-strenght
The base damage an attack will deal, in HP. Note the misspelling in the element tag, it must be spelled as "attack-strenght" in order for the tag to work.

attack-var
This is the amount of variance that is added to the attack strenght. So if the base damage is 150, and the var is 50, it will do (150-50) - (150+50), or 100-200 damage each time. Thus, the variance creates a range of numbers from the attack-strenght variable to make the damage more random.

attack-range
How many cell spaces away the unit can attack from. Generally, melee attacks would have a range of 1 (sometimes more for longer weapons), while range units can have as long as they like, though they can only attack enemies that are within a unit's sights.

attack-type
The type that is assigned to the task, which must be defined in the techtree XML, and affects how the damage multiplier will impact the final damage dealt.

attack-fields
The fields that the attack skill is capable of damaging. Either land or air, and depends on what the target unit has as their field. While GAE technically has additional fields such as any_water, they are not used for attack fields because attacks with the land field will hit such units.

attack-start-time
Time, as a ratio of start to finish, to damage the foe after the animation has played or the attack has hit (if it's a ranged attack). This can prevent a foe from falling dead before your unit finishes his fancy back swing.

projectiles
In MegaGlest ( version>3.9.1 ): You can have multiple projectiles and this tag surrounds them.

projectile
If true, the attack is considered to be a ranged attack, which allows the usage of projectile particles, and effects how the foe is damaged by the attack (must be hit by either the projectile or a splash from the projectile, rather than being automatically considered hit, and the attack-start value is calculated based on the particle time rather than animation time). MegaGlest ( version>3.9.1 ): you now can have multiple projectiles all with their own timing, individual particle system,hit sound and impact camera shake. Combined with multiple timed sounds this is good for multiple shots in oe skill. The shots damage can be given in percentage of the skill and those percents must all together sum up to 100%.

particle
If true, the attack will use a particle system. The path is the relative path to the Projectile Particle XML. There is also a sound tag childed in here, which uses similar syntax to the other sound tag in this skill, but is the sound played when the particle hits, rather than when the attack is started (thus making it good for explosions, etc).

splash
If true, the attack will have a splash, an area of affect when the projectile hits the area where its target was, eg: an explosion. The radius is the size, as a radius (thus, the diameter will be almost twice the size, the center is counted as part of the radius, so a 3 radius would have a 5 diameter). Damage all is a function which is meant to toggle whether or not all units (including friendly units) are hurt by the splash, though is currently broken in Glest and GAE, only working in MegaGlest. Finally, a Splash Particle XML is linked to define how the splash will look.

effects
Effects are a GAE only extender which allows special effects to be applied to attacks. It allows attacks to add a persisting effect which can modify the stats of the target unit, as well as can allow recourse effects with allows the stats of the attacker to be modified as well. For example, an attack that drains a units stats and gives it to the attacker could be created, or a poisonous arrow which damages the target, or a blinding gas which reduces their sight.

attack-boosts
Attack boosts are a MG only extender which allows boosts to be applied to units when attacking, such as increasing the attacker and units near the attack's stats.

Die
Death is another autoskill which is executed when the unit's HP reaches zero. This is how the death animation is controlled.

Most common entries in abilities

fade
If true, the unit's "corpse" will fade away at the end of the animation, rather than lying "dead" on the ground for a short period of time.

Cast-spell
Cast-spell allows a unit to apply an effect to friendly unit. Thus, it could be used to heal them or boost stats temporarly.

Most common entries in abilities

start-time
The time, as a ratio of the animation, to start the projectile (if there is one). Optional.

projectile
If true, allows the usage of projectile particles. If particle is true, the spell will use a particle system. The path is the relative path to the Projectile Particle XML. There is also a sound tag childed in here, which uses similar syntax to the other sound tag in this skill, but the sound is played when the particle hits.

splash
If true, the spell will have a splash, an area of affect when the projectile hits the area where its target was. The radius is the size, as a radius (thus, the diameter will be almost twice the size, the center is counted as part of the radius, so a 3 radius would have a 5 diameter). A Splash Particle XML is linked to define how the splash will look.

Build self
Build self is used for the self building command, which allows a unit to build itself once its basis is laid.

Most common entries in abilities

anim-progress-bound
If true, this will lock the animation speed to the hp of the unit as it builds. Thus, when the unit is half built, the animation would be halfway through, etc. This will override any specified animation speed and if not used, the entire tag may be omitted.

Load
The loading command it used to load a unit into a transport, building for garrisoning, etc.

Most common entries in abilities

max-range
Maximum distance the unit can be from the transport to be loaded. Too large and the unit will seem to disappear before it reaches the transport, too short and it large size units may have trouble accessing it.

Unload
The opposite of loading, unloading unloads units which were previously loaded with the load command.

Most common entries in abilities

max-range
Maximum distance from the transport units will be placed when unloading. If too large, they may appear to be appearing nowhere near the loaded unit, but if too small, units risk not having enough space.