Skill Changing Genes - KonradHeinser/EBSGFramework GitHub Wiki
Skill changing gene use a special class that allows you to alter the skill levels and passions of pawns individually instead of having to use gene templates. All of these genes require the below code as a basis for all of the other stuff. If you want to edit more than one skill, just add however many list items you need:
<geneClass>EBSGFramework.Gene_SkillChanging</geneClass>
<modExtensions>
<li Class="EBSGFramework.EBSGExtension">
<skillChanges>
<li>
</li>
</skillChanges>
</li>
</modExtensions>
The first thing to take care of is the skill. If you don't choose a skill to be changed, then the code will randomly pick one for you. This node accepts all SkillDefs:
<modExtensions>
<li Class="EBSGFramework.EBSGExtension">
<skillChanges>
<li>
<skill>Shooting</skill>
</li>
</skillChanges>
</li>
</modExtensions>
Finally we have skills and passions. Skill levels just use a change node like this, which can either have a singular number or a range (i.e. 2~3) :
<modExtensions>
<li Class="EBSGFramework.EBSGExtension">
<skillChanges>
<li>
<skillChange>1</skillChange>
</li>
</skillChanges>
</li>
</modExtensions>
Passions on the other hand, have two options. You can set the passion statically, or use a passion change node. To set the passion statically, you need the following nodes:
<modExtensions>
<li Class="EBSGFramework.EBSGExtension">
<skillChanges>
<li>
<setPassion>True</setPassion>
<passion>None</passion>
</li>
</skillChanges>
</li>
</modExtensions>
setPassion is what tells the code to look for a passion, and the passion node is what the new passion will be. Vanilla has 3 options for this, None, Minor, and Major. I don't know if modded in passion levels work with this as it depends on whether the modder in question had changed the vanilla Passion things, or created their own. The only way to know for certain is to look through their C# to find where they create their passions.
To change the skill's passion dynamically instead of statically (i.e. a +1 makes Minor become Major, and None become Minor), you can use the passionChange node. The system is set up this way because, in theory, a mod that adds passions would include their passion in the vanilla incrementing list, thus causing a +2 to mean something different in vanilla (always Major) than with the mod (depends on mod). Unfortunately, this incrementing only works upward, so a -1 on a modded passion will always become None, because the code has no way of comparing it to the full list.
<modExtensions>
<li Class="EBSGFramework.EBSGExtension">
<skillChanges>
<li>
<passionChange>1</passionChange>
</li>
</skillChanges>
</li>
</modExtensions>
Examples from EBSG - Passion Genes. The first gene just removes all passion in Shooting, while the second adds one level to it. The parent just contains the display category, description, cpx, and met.
<GeneDef>
<defName>EBSG_NoPassion_Shooting</defName>
<label>passionless shooting</label>
<description>.</description>
<geneClass>EBSGFramework.Gene_SkillChanging</geneClass>
<displayCategory>Miscellaneous</displayCategory>
<iconPath>UI/Icons/Genes/Skills/Shooting/Terrible</iconPath>
<displayOrderInCategory>1</displayOrderInCategory>
<exclusionTags>
<li>EBSG_Passion_Shooting</li>
</exclusionTags>
<modExtensions>
<li Class="EBSGFramework.EBSGExtension">
<skillChanges>
<li>
<skill>Shooting</skill>
<setPassion>True</setPassion>
<passion>None</passion>
</li>
</skillChanges>
</li>
</modExtensions>
</GeneDef>
<GeneDef>
<defName>EBSG_Interest_Shooting</defName>
<label>shooting interest</label>
<description>.</description>
<geneClass>EBSGFramework.Gene_SkillChanging</geneClass>
<displayCategory>Miscellaneous</displayCategory>
<iconPath>UI/Icons/Genes/Skills/Shooting/Strong</iconPath>
<displayOrderInCategory>1.3</displayOrderInCategory>
<exclusionTags>
<li>EBSG_Passion_Shooting</li>
</exclusionTags>
<modExtensions>
<li Class="EBSGFramework.EBSGExtension">
<skillChanges>
<li>
<skill>Shooting</skill>
<passionChange>1</passionChange>
</li>
</skillChanges>
</li>
</modExtensions>
</GeneDef>