Skip to content

ApplyHediff

NachoToast edited this page Mar 28, 2025 · 2 revisions

Gives a pawn a hediff, or increases the severity of an existing hediff.

Source: ApplyHediff.cs

Full Example

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

    <!-- Give the Anesthetic hediff. -->
    <hediffDef>Anesthetic</hediffDef>

    <!-- Increase severity by a base value of 0.05. -->
    <severityPerTick>0.05</severityPerTick>

    <!-- Severity increase should be multiplied by 0.5 x the gas density. -->
    <densityFactor>0.5</densityFactor>

    <!-- And further multiply severity increase based on the pawn's ToxicEnvironmentResistance stat. -->
    <impactedByStat>ToxicEnvironmentResistance</impactedByStat>

    <!-- With that stat value being multiplied by 2. -->
    <statImpactFactor>2</statImpactFactor>

    <!-- If at the final stage of the hediff (sedated), severity increase should be multiplied by 0.25. -->
    <finalStageFactor>0.25</finalStageFactor>

    <!-- The hediff should be randomly given to either the torso or heart. -->
    <partsToAffect>
        <li>Torso</li>
        <li>Heart</li>
    </partsToAffect>
</li>

Required Properties

These properties must be defined!

hediffDef

Type HediffDef
Example
<hediffDef>Anesthetic</hediffDef>

The hediff to apply.

Optional Properties

severityPerTick

Type Float
Default
<severityPerTick>0.05</severityPerTick>

Base severity increase, cannot be 0. This value get multiplied by the severity multiplier (initially 1) just before the hediff is added.

densityFactor

Type Float
Default
<densityFactor>1</densityFactor>

How much of an impact the gas density (as a percentage) has on the severity increase.

A value of 1 would mean that the severity increase is multiplied by the gas density, e.g. if severityPerTick = 0.5, but the gas density was only 50%, the severity increase would be 0.25.

Tip

A value of 0 would mean severity increase is not affected by the gas density at all.

impactedByStat

Type StatDef
Default None
Example
<impactedByStat>ToxicEnvironmentResistance</impactedByStat>

The stat to use as a multiplier for the severity increase.

For example, if the stat is ToxicEnvironmentResistance, and severityPerTick = 0.5, a pawn with a ToxicEnvironmentResistance of 25% would only get a severity increase of 0.375, and a pawn with 75% would get 0.125.

Tip

By default this is inverted, meaning a higher stat value will reduce the severity increase. If you want to have this not inverted, you can set statImpactFactor to -1.

statImpactFactor

Type Float
Default
<statImpactFactor>1</statImpactFactor>

Multiplier for the stat value, cannot be 0. Only needed if impactedByStat is defined.

finalStageFactor

Type Float
Default
<finalStageFactor>1</finalStageFactor>

Multiplier for the severity increase if the hediff is at its final (last) stage.

partsToAffect

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

List of body parts to apply the hediff 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