Cloaking is making a unit invisible to foes. It is a very versatile ability which can be toggled on and off multiple ways, depending on how the modder chooses.
Ways to cloak[]
Permanently[]
Permanently cloaked units are cloaked until they are found by a detector or are performing a de-cloaking skill. The cloak-sound and de-cloak-sound are sounds to play when cloaking and de-cloaking respectively. The group is the cloaking group it is in, which can be any valid variable name, and only detectors in the same group as the cloaked unit can de-cloak the unit.
<cloak type="permanent">
<group value="stealth" />
<cloak-sound path="sounds/cloak.wav" />
<de-cloak-sound path="sounds/decloak.wav" />
</cloak>
Energy[]
Energy cloaking will give a command button on the unit to toggle on or off cloaking, using the energy cost specified (per interval). The image path is the path to the image to use as the button. The cloak-sound and de-cloak-sound are sounds to play when cloaking and de-cloaking respectively.
<cloak type="energy" cost="20">
<group value="stealth" />
<image path="images/daemon_cloaked.png" />
<cloak-sound path="sounds/cloak.wav" />
<de-cloak-sound path="sounds/decloak.wav" />
</cloak>
Effect[]
The most complex type of cloaking, an energy cloak is a two part cloaking system. Firstly, the unit(s) to be cloaked must have an effect cloak. They must then have a tag that will be linked to an emanation which will be used to hide the unit. All units that should be cloaked by that emanation should have the same tag.
<cloak type="effect">
<group value="stealth" />
<cloak-sound path="sounds/cloak.wav" />
<de-cloak-sound path="sounds/decloak.wav" />
</cloak>
<tags>
<tag value="my_tag"/>
</tags>
For the emanation itself, the core differences are the <affect> tag, which specifies the name of the tag that was previously applied to all to-be-cloaked units, and the flag <causes-cloak/>, which specifies that the emanation in particular can cause cloaking.
<emanations>
<emanation name="hide_daemons" bias="beneficial" stacking="overwrite"
target="ally" chance="100.0" duration="2" radius="7">
<affect value="my_tag" />
<flags>
<causes-cloak/>
</flags>
</emanation>
</emanations>
Other attributes available[]
All types of cloaks can also contain the following children tags. All of these are the standard code that can be found in the unit XML.
<unit-requirements>
<unit name="my_unit">
</unit-requirements>
<upgrade-requirements>
<upgrade name="my_upgrade">
</upgrade-requirements>
<subfaction-restrictions>
<subfaction name="my_subfaction">
</subfaction-restrictions>
Ways to uncloak[]
An always cloaked unit would be overpowered as the opponent would never see it and it could kill the foe without them being able to do anything. Thus, there must be ways to uncloak units automatically.
De-cloak actions[]
It is possible to group an entire skill class (type) such as "attack" or even a specific skill name as decloaking by having a <de-cloak/> tag a child of the cloak tag. Permanent and effect cloaks will be re-applied after a de-cloaking action is complete, but energy cloaks will not be automatically re-applied.
<de-cloak skill-class="attack" /> <de-cloak skill-name="my_skill" />
Detectors[]
A detector is a unit that can remove the cloaking of a cloaked unit on sight, and can be created by adding the below XML tags as a child to a unit's parameters tag. The detector type can only be permanent for now, but more types may be available in the future. As well, the detector can only uncloak units in the same group as it.
<detector type="permanent">
<group value="stealth" />
</detector>
Examples[]
In this example, a unit has a permanent cloak that disappears when attacking.
<?xml version="1.0" standalone="no"?>
<unit>
<parameters>
<size value="1"/>
<height value="3"/>
<max-hp value="700" regeneration="0"/>
<max-ep value="0"/>
<armor value="20"/>
<armor-type value="leather"/>
<sight value="15"/>
<time value="60"/>
<cloak type="permanent">
<group value="stealth" />
<de-cloak skill-class="attack" />
</cloak>
<multi-selection value="true"/>
<cellmap value="false"/>
<levels/>
<fields>
<field value="land"/>
</fields>
<properties/>
<light enabled="false"/>
<unit-requirements/>
<upgrade-requirements/>
<resource-requirements>
<resource name="gold" amount="100"/>
</resource-requirements>
<resources-stored/>
<image path="images/image.bmp"/>
<image-cancel path="images/cancel.bmp"/>
<meeting-point value="false"/>
<selection-sounds enabled="false"/>
<command-sounds enabled="false"/>
</parameters>
<skills>
[..]
</skills>
<commands>
[..]
</commands>
</unit>
And this unit is a detector capable of detecting the first unit on sight.
<?xml version="1.0" standalone="no"?>
<unit>
<parameters>
<size value="1"/>
<height value="3"/>
<max-hp value="1000" regeneration="0"/>
<max-ep value="0"/>
<armor value="0"/>
<armor-type value="leather"/>
<sight value="14"/>
<time value="80"/>
<detector value="true">
<group value="stealth"/>
</detector>
<multi-selection value="true"/>
<cellmap value="false"/>
<levels/>
<fields>
<field value="land"/>
</fields>
<properties/>
<light enabled="false"/>
<unit-requirements/>
<upgrade-requirements/>
<resource-requirements>
<resource name="gold" amount="250"/>
</resource-requirements>
<resources-stored/>
<image path="images/image.bmp"/>
<image-cancel path="images/cancel.bmp"/>
<meeting-point value="false"/>
<selection-sounds enabled="false"/>
<command-sounds enabled="false"/>
</parameters>
<skills>
[..]
</skills>
<commands>
[..]
</commands>
</unit>