Skip to content

TakeDamage

NachoToast edited this page Mar 28, 2025 · 2 revisions

Applies a DamageDef to a pawn.

Source: TakeDamage.cs (V2.6)

Full Example

<li Class="SCGF.Actions.TakeDamage">

    <!-- Apply the 'Cut' DamageDef. -->
    <damageDef>Cut</damageDef>

    <!-- With a base amount of 4.5 -->
    <amount>4.5</amount>

    <!-- At 30% armour penetration. -->
    <armorPenetration>0.3</armorPenetration>

    <!-- Every 500 ticks (10 gas ticks). -->
    <tickInterval>500</tickInterval>

    <!-- Applied randomly to either the torso or heart. -->
    <partsToAffect>
        <li>Torso</li>
        <li>Heart</li>
    </partsToAffect>
</li>

Required Properties

These properties must be defined!

damageDef

Type DamageDef
Example
<damageDef>Cut</damageDef>

The damage type to apply.

Optional Properties

amount

Type Float
Default
<amount>5</amount>

Damage amount, cannot be less than 0.

armorPenetration

Type Float
Default
<armorPenetration>0</armorPenetration>

Armor penetration (%), cannot be less than 0. Generally between 0 and 1 (inclusive), although can be greater.

partsToAffect

Type List<BodyPartDef>
Default Empty List
Example
<partsToAffect>
    <li>Torso</li>
    <li>Heart</li>
</partsToAffect>

List of body parts to apply the damage to.

If none are specified, the whole body will be the target. If multiple are specified, a random non-missing one is chosen based on it's coverage.

Clone this wiki locally