Temporary Faction - KonradHeinser/EBSGFramework GitHub Wiki
This hediff comp changes the faction of the pawn to something else, usually until the hediff is removed. The faction in question can either be a static FactionDef, or can use another pawn's faction if the hediff is a HediffWithTarget and useStatic is left False:
<comps>
<li Class="EBSGFramework.HediffCompProperties_TemporaryFaction">
</li>
</comps>
These are the options available for those who want to do something other than set the faction to another pawn's faction:
- useStatic : Default (False) : Makes the comp use the static faction you set, or makes them lose their faction if staticFaction is not used
- staticFaction : The FactionDef to use
- temporary : Default (True) : Not generally intended to be set to False unless you are adding the hediff via something other than an ability, and need the faction to stick around after the hediff is gone
Note : Due to how the game handles pawn ai, pawns may choose to wander off the map if their faction is changed to a non-player faction, though if the hediff has a target with a Lord, the pawn should usually be able to change their actions to whatever that Lord tells them to do
Note 2: In the event that multiple hediffs with this comp are applied to the same pawn, the last one added will usually be the one that makes the final decision about what the pawn's faction should be until the hediff is removed
Note 3: If you want to make an ability that does the same as this that only makes changes to the pawn when cast, the Change Faction ability comp serves that purpose
This first example uses Create Linked Hediffs to make the target pawn's faction the same as their own:
<AbilityDef>
<defName>TemporaryRecruitment</defName>
<label>test ability</label>
<description>.</description>
<iconPath>Things/Mote/SpeechSymbols/Speech</iconPath>
<cooldownTicksRange>60</cooldownTicksRange>
<hostile>false</hostile>
<verbProperties>
<verbClass>Verb_CastAbility</verbClass>
<range>30</range>
<warmupTime>0.5</warmupTime>
<requireLineOfSight>False</requireLineOfSight>
</verbProperties>
<comps>
<li Class="EBSGFramework.CompProperties_CreateLinkedHediff">
<hediffOnTarget>TemporaryRecruitment</hediffOnTarget>
</li>
</comps>
</AbilityDef>
<HediffDef>
<defName>TemporaryRecruitment</defName>
<label>temporary recruitment</label>
<description>.</description>
<everCurableByItem>false</everCurableByItem>
<initialSeverity>0.001</initialSeverity>
<stages />
<hediffClass>HediffWithTarget</hediffClass>
<scenarioCanAdd>false</scenarioCanAdd>
<comps>
<li Class="EBSGFramework.HediffCompProperties_TemporaryFaction" />
</comps>
</HediffDef>
This example makes the pawn have no faction, which generally makes them wander off the map because they have no reason to be there:
<HediffDef>
<defName>TemporarilyWild</defName>
<label>temporarily wild</label>
<description>They'll wander off the map if left alone.</description>
<everCurableByItem>false</everCurableByItem>
<initialSeverity>0.001</initialSeverity>
<stages />
<hediffClass>HediffWithComps</hediffClass>
<scenarioCanAdd>false</scenarioCanAdd>
<comps>
<li Class="EBSGFramework.HediffCompProperties_TemporaryFaction">
<useStatic>True</useStatic>
</li>
</comps>
</HediffDef>
This example puts the pawn into the Empire's faction, and much like the no faction variant, they generally don't have much reason to stick around a long time unless an enemy of the Empire is near them:
<HediffDef>
<defName>EmpireRecruit</defName>
<label>empire recruit</label>
<description>.</description>
<everCurableByItem>false</everCurableByItem>
<initialSeverity>0.001</initialSeverity>
<stages />
<hediffClass>HediffWithComps</hediffClass>
<scenarioCanAdd>false</scenarioCanAdd>
<comps>
<li Class="EBSGFramework.HediffCompProperties_TemporaryFaction">
<useStatic>True</useStatic>
<staticFaction>Empire</staticFaction>
</li>
</comps>
</HediffDef>