Jump to content

[RimWorld] Need Help Creating A Mod Patch


Fenguard

Recommended Posts

I'm trying to patch the mod Fantasy Goblins so that they only spawn as Female, and following the patching tutorials around the internet I've gotten as far to have constructed this bit of code;

Spoiler

<?xml version="1.0" encoding="utf-8" ?>
<Patch>
    <Operation Class="PatchOperationReplace">
        <xpath>/Defs/ThingDefs_Races[defName="Fantasy_Goblin"]/alienRace/generalSettings/maleGenderProbability</xpath>
            <value>
                <maleGenderProbability>0</maleGenderProbability>
            </value>
    </Operation>
</Patch>

But it doesn't work and I can't figure out why. I've tried a number of combinations for the 'xpath' which I assume is the issue but each time the game tells me the patch operation failed. the mod's base code for the race's settings stuff is as follows, with the relevant bit(Or what I assume is the relevant bit) highlighted in green:

Spoiler

<?xml version="1.0" encoding="utf-8" ?>
<Defs>
    <AlienRace.ThingDef_AlienRace ParentName="BasePawn">
        <defName>Fantasy_Goblin</defName>
        <label>Goblin</label>
        <description>Goblins are small humanoid beings. With short scrawny bodies and oversized heads with long ears. While physically weaker than an average human goblins have a higher resistance to diseases and toxcicity. What they lack in physical strength they make up with their speed and tenacity. Goblins are fast workers if not the most diligent ones. They're a sly and intellectual race,only hindered by their own greed and violent nature. Goblins exists in primitive tribal structures with constant shifts in power. Often small tribes dominated by the strongest warriors. Both goblin men and women are vicious and both sexes are just as likely to rise to positions of power in a tribe.</description>
        <alienRace>
            <generalSettings>
                <maleGenderProbability>0.7</maleGenderProbability>

                <immuneToAge>true</immuneToAge>
                <forcedRaceTraitEntries>
                    <li>
                        <defName>Greedy</defName>
                        <chance>10</chance>
                    </li>
                    <li>
                        <defName>Nimble</defName>
                        <chance>50</chance>
                    </li>
                    <li>
                        <defName>Bloodlust</defName>
                        <chance>20</chance>
                    </li>
                    <li>
                        <defName>Masochist</defName>
                        <chance>15</chance>
                    </li>
                    <li>
                        <defName>Jealous</defName>
                        <chance>10</chance>
                    </li>
                    <li>
                        <defName>Tough</defName>
                        <chance>10</chance>
                    </li>
                    <li>
                        <defName>Brawler</defName>
                        <chance>10</chance>
                    </li>
                </forcedRaceTraitEntries>
                <disallowedTraits>
                    <li>Kind</li>
                    <li>BleedingHeart</li>
                    <li>Teetotaler</li>
                    <li>Pacifist</li>
                </disallowedTraits>
                <immuneToXenophobia>false</immuneToXenophobia>
                <humanRecipeImport>true</humanRecipeImport>
                <alienPartGenerator>
                    <aliencrowntypes>
                        <li>Average_Normal</li>
                        <li>Average_Wide</li>
                        <li>Average_Pointy</li>
                    </aliencrowntypes>

                    <alienbodytypes>
                        <li>Male</li>
                    </alienbodytypes>
                    <useGenderedHeads>true</useGenderedHeads>
                    <useGenderedBodies>true</useGenderedBodies>
                    <alienskincolorgen Class="ColorGenerator_Options">
                        <options>
                            <li>
                                <!-- Goblin (Green) -->
                                <weight>10</weight>
                                <only>RGBA(188,200,59)</only>
                            </li>
                        </options>
                    </alienskincolorgen>
                    <customDrawSize>(0.9, 0.9)</customDrawSize>
                    <customHeadDrawSize>(1.0, 1.0)</customHeadDrawSize>
                    <customPortraitDrawSize>(1.0, 1.0)</customPortraitDrawSize>
                    <customPortraitHeadDrawSize>(1.0, 1.0)</customPortraitHeadDrawSize>
                    <headOffset>(0.0, -0.05)</headOffset>
                </alienPartGenerator>
            </generalSettings>

Hoping someone can help me realize what I'm doing wrong and how to do it right as I'm incredibly new to this some modding.coding thing and intending to patch a number of races like this for my own use.

Maybe it has something to do with the fact it relies on Humanoid Alien Races 2.0 and I should be patching something in there instead? I dunno. This is all new and mysterious to me. :P

Link to comment
  • 2 weeks later...
Quote

<Patch>
    <Operation Class="PatchOperationSequence">
    <success>Always</success>
        <operations>
            
            <li Class="PatchOperationRemove">
                <xpath>*/Defs/AlienRace.ThingDef_AlienRace[defName = "Fantasy_Goblin"]/alienRace/generalSettings/maleGenderProbability</xpath>
            </li>

            <li Class="PatchOperationAdd">
                <xpath>*/Defs/AlienRace.ThingDef_AlienRace[defName = "Fantasy_Goblin"]/alienRace/generalSettings</xpath>
                <value>
                <maleGenderProbability>0</maleGenderProbability>
                </value>
            </li>

        </operations>
    </Operation>
</Patch>

Sometimes the PatchOperationReplace won't work, so you'll have to remove the node first, then add the replacement node(s).

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use