Skip to content

Health

Examples

Example

<Health>
  <Max>
    100
  </Max>
  <RegenRate>
    1.0
  </RegenRate>
  <IdleRegenRate>
    0
  </IdleRegenRate>
  <DeathType>
    corpse
  </DeathType>
</Health>

XML Elements

The following elements can be used within this component:

Health

Max

Maximum hitpoints

Type: non-negative decimal

Path: Health/Max

Initial

Initial hitpoints. Default if unspecified is equal to Max

Type: non-negative decimal

Path: Health/Initial

DamageVariants

Path: Health/DamageVariants

{DamageVariantsType}

Name of the variant to select when health drops under the defined ratio

Type: decimal (e.g. -10.0 or 0.0 or 2.5)

Path: Health/DamageVariants/{DamageVariantsType}

RegenRate

Hitpoint regeneration rate per second.

Type: decimal (e.g. -10.0 or 0.0 or 2.5)

Path: Health/RegenRate

IdleRegenRate

Hitpoint regeneration rate per second when idle or garrisoned.

Type: decimal (e.g. -10.0 or 0.0 or 2.5)

Path: Health/IdleRegenRate

DeathType

Behaviour when the unit dies

Path: Health/DeathType

SpawnEntityOnDeath

Entity template to spawn when this entity dies. Note: this is different than the corpse, which retains the original entity's appearance

Type: text

Path: Health/SpawnEntityOnDeath

Unhealable

Indicates that the entity can not be healed by healer units

Type: boolean (true or false)

Path: Health/Unhealable

RELAX NG Grammar

<define name="component.Health">
  <element name="Health">
    <interleave>
      <element name="Max">
        <ref name="nonNegativeDecimal"/>
      </element>
      <optional>
        <element name="Initial">
          <ref name="nonNegativeDecimal"/>
        </element>
      </optional>
      <optional>
        <element name="DamageVariants">
          <oneOrMore>
            <element>
              <anyName/>
              <data type="decimal">
                <param name="minInclusive">
                </param>
                <param name="maxInclusive">
                </param>
              </data>
            </element>
          </oneOrMore>
        </element>
      </optional>
      <element name="RegenRate">
        <data type="decimal"/>
      </element>
      <element name="IdleRegenRate">
        <data type="decimal"/>
      </element>
      <element name="DeathType">
        <choice>
          <value>
          </value>
          <value>
          </value>
          <value>
          </value>
        </choice>
      </element>
      <optional>
        <element name="SpawnEntityOnDeath"/>
      </optional>
      <element name="Unhealable">
        <data type="boolean"/>
      </element>
    </interleave>
  </element>
</define>