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

Common tags for skills
Stop skill only has base abilities so this is a good example:

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

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.

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

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

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.

Common tags for skills

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.

Common tags for skills

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.

Common tags for skills

anim-progress-bound
A 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.

Common tags for skills

Build
The build skill is used to build buildings. Common tags for skills

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. Common tags for skills

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.

Common tags for skills

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.

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

Common tags for skills

anim-progress-bound
A 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.

Common tags for skills

anim-progress-bound
A 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.

Alternative way to handle multiple projectiles: ( Megaglest>3.9.1 )
Common tags for skills

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. Include this in the projectile-tag to let the unit spawn when the projectile arrives at the target.

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. Finally, a Splash Particle XML is linked to define how the splash will look.

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

Common tags for skills

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.

spawn
If this tag exists the given number of units of type is spawned with a probability of and a predamage of  at the given start-time ( related to the death animation playback.)