Offset Needs Ability - KonradHeinser/EBSGFramework GitHub Wiki

This ability comp allows you to manipulate the need levels of pawns. This can use any specific NeedDef, or a completely random one the Rimworld gives it if you don't include the need tag. For your basic comp, you'll need something like this:

        <comps>
            <li Class="EBSGFramework.CompProperties_AbilityOffsetNeed">
                <needOffsets>
                    <li>
                        <need>Joy</need>
                        <offset>-0.1</offset>
                    </li>
                </needOffsets>
                <preventRepeats>True</preventRepeats> <!--Default (True). Only applicable if getting a random need-->
            </li>
        </comps>

This list can have as many needs as desired, but if you are including random needs and have left preventRepeats as True, you should make sure the random ones only appear after the specific ones to minimize the chances of a need getting targeted twice, similar to below:

        <comps>
            <li Class="EBSGFramework.CompProperties_AbilityOffsetNeed">
                <needOffsets>
                    <li>
                        <need>Joy</need>
                        <offset>-0.1</offset>
                    </li>
                    <li>
                        <offset>0.1</offset>
                    </li>
                </needOffsets>
            </li>
        </comps>

The offsets can be multiplied by a stat individually, so, for example, you want recreation change to be multiplied by psychic sensitivity, you would end up with a comp similar to below:

        <comps>
            <li Class="EBSGFramework.CompProperties_AbilityOffsetNeed">
                <needOffsets>
                    <li>
                        <need>Joy</need>
                        <offset>-0.1</offset>
                        <offsetFactorStat>PsychicSensitivty</offsetFactorStat>
                    </li>
                </needOffsets>
            </li>
        </comps>

While needoffsets change the need levels of the target, it is also possible change the caster's needs with the casterNeedOffsets tag. All of the options within it are the same, but it alter's the caster's needs whether they are the target or not. Note that if both are in use and the caster is the target, then they will be affected by both the needOffsets list and the casterNeedOffsets list (in that order for those interested).


Really simplistic examples of abilities that generate or burn joy(recreation). The parent just contains some basic stuff to allow the pawn to cast it only on themselves

    <AbilityDef ParentName="EBSG_TestSelfCastBase">
        <defName>Burner</defName>
        <label>burner</label>
        <description>This just burns a need to provide an example.</description>
        <comps>
            <li Class="EBSGFramework.CompProperties_AbilityOffsetNeed">
                <needOffsets>
                    <li>
                        <need>Joy</need>
                        <offset>-0.1</offset>
                    </li>
                </needOffsets>
            </li>
        </comps>
    </AbilityDef>

    <AbilityDef ParentName="EBSG_TestSelfCastBase">
        <defName>Generator</defName>
        <label>generator</label>
        <description>This just recovers a need to provide an example.</description>
        <comps>
            <li Class="EBSGFramework.CompProperties_AbilityOffsetNeed">
                <needOffsets>
                    <li>
                        <need>Joy</need>
                        <offset>0.1</offset>
                    </li>
                </needOffsets>
            </li>
        </comps>
    </AbilityDef>
⚠️ **GitHub.com Fallback** ⚠️