Gender by Age Genes - KonradHeinser/EBSGFramework GitHub Wiki

This portion of the EBSG Extension allows for altering the gender of the pawn the gene is attached to. This requires using one of the gene classes from this framework (ideally HediffAdder), and the EBSGExtension:

        <geneClass>EBSGFramework.HediffAdder</geneClass>
        <exclusionTags> <!--Not required, but recommended most cases-->
            <li>EBSGGenderChange</li>
        </exclusionTags>
        <modExtensions>
            <li Class="EBSGFramework.EBSGExtension">
                <genderByAge>
                </genderByAge>
            </li>
        </modExtensions>

The genderByAge is a special list that uses the Gender as the tag name, with the age range as the values.

  • Gender options are Male, Female, and None. When set to None, the pawn's gender is not changed. Generally speaking, you shouldn't ever really need to use None, it's just there as a just in case
  • The range can have two numbers, one number, or no numbers. When two numbers, it acts like a normal range. If only one number is used, then any age at or over that number qualify. If no numbers are used, then all ages apply

Mini Demonstrations:

<!--No changes occur for the first 30 years due to None. 
Usually implied, but due to the male at the end, this ensures that change won't happen too early-->
<None>0~30</None> 
<Female>30</Female> <!--Ensures the pawn's age is Female when their age passes 30-->
<Male /> <!--Always Male as soon as this point in the list is reached-->

Note: If the gene is removed, it will not reset the pawn's gender to whatever it was before adding

Note 2: If only one item is put on the list, then that gender will be treated as a static gender. If no range is given, then this gender will be set only once (when the gene is added), allowing it to be overridden by anything else. If a range is given, even if said range is 0~9999, then the pawn's gender will be checked every in-game hour to ensure the pawn is still the expected gender, assuming the pawn's age is within the range


This example makes carriers of this gene become female when they reach the age of 30, and then become male when they pass the age of 60. Before 30, the gender remains what they were born with:

    <GeneDef>
        <defName>SurpriseBallChange</defName>
        <label>surprise ball change</label>
        <description>It's nuts after a while.</description>
        <iconPath>UI/Icons/Genes/Gene_HairColor</iconPath>
        <displayCategory>Miscellaneous</displayCategory>
        <geneClass>EBSGFramework.HediffAdder</geneClass>
        <modExtensions>
            <li Class="EBSGFramework.EBSGExtension">
                <genderByAge>
                    <Female>30~60</Female>
                    <Male>60</Male>
                </genderByAge>
            </li>
        </modExtensions>
    </GeneDef>

This example sets the carrier's gender to always be male:

    <GeneDef>
        <defName>AlwaysMale</defName>
        <label>always male</label>
        <description>.</description>
        <iconPath>UI/Icons/Genes/Gene_HairColor</iconPath>
        <displayCategory>Miscellaneous</displayCategory>
        <geneClass>EBSGFramework.HediffAdder</geneClass>
        <modExtensions>
            <li Class="EBSGFramework.EBSGExtension">
                <genderByAge>
                    <Male />
                </genderByAge>
            </li>
        </modExtensions>
    </GeneDef>
⚠️ **GitHub.com Fallback** ⚠️