Hediff When Fleeing - Vanilla-Expanded/VanillaExpandedFramework GitHub Wiki
CompHediffWhenFleeing is a comp class that applies a hediff to a pawn if it starts fleeing from contact, usually due to being attacked. The optional graphicAndSoundEffect is the usual PsycastPsychicEffect that distorts the screen in a circle.
//Applies a hediff when a creature starts fleeing.
//The hediff can also be applied to other pawns in a radius
public int tickInterval = 60;
public HediffDef hediffToCause;
public bool graphicAndSoundEffect = false;
public bool hediffOnRadius = false;
public float radius = 3;
It is a comp class, so you just add it in XML in the <comps>
tag. For example, this allows the pheasant in Vanilla Animals Expanded - Royal Animals to make friendly pawns invisible around them when attacked
<comps>
<li Class="AnimalBehaviours.CompProperties_HediffWhenFleeing">
<tickInterval>60</tickInterval>
<hediffToCause>VAERoy_PsychicInvisibility</hediffToCause>
<graphicAndSoundEffect>true</graphicAndSoundEffect>
<hediffOnRadius>true</hediffOnRadius>
<radius>6</radius>
</li>
</comps>