RimWorld

RimWorld

xpath patching help?
Trying to patch Tinctoria to produce more dye and be beautiful
I cannot seem to get it to work, erroring every time I try anything

Could someone point me in the right direction here?
here's what I have:
<Patch> <Operation Class="PatchOperationReplace"> <xpath>Defs/ThingDefs_Plants[defname="Plant_Tinctoria"]/statBases/Beauty</xpath> <value> 16 </value> </Operation> <Operation Class="PatchOperationReplace"> <xpath>Defs/ThingDefs_Plants[defname="Plant_Tinctoria"]/plant/harvestYield</xpath> <value> 20 </value> </Operation> </Patch>
< >
Showing 1-12 of 12 comments
Jaggid Edje Jun 5, 2024 @ 4:40pm 
Maybe check out this mod's patch files to see what they are doing differently. It does the same thing you are trying to achieve to a bunch of different plants.
https://steamcommunity.com/sharedfiles/filedetails/?id=2011794898

That's what I do when I'm having issues when trying to make my own small patch file. I find a mod that does something very similar, and copy it. :-D
Last edited by Jaggid Edje; Jun 5, 2024 @ 4:41pm
Nyx (She/Her) Jun 5, 2024 @ 4:48pm 
well I did that just now and it *still* fails?

<?xml version="1.0" encoding="utf-8" ?> <Patch> <Operation Class="PatchOperationReplace"> <xpath>Defs/ThingDefs[defname="Plant_Tinctoria"]/statBases/Beauty/text()</xpath> <value>16</value> </Operation> <Operation Class="PatchOperationReplace"> <xpath>/Defs/ThingDef[defName="Plant_Tinctoria"]/statBases/BeautyOutdoors/text()</xpath> <value>16</value> </Operation> <Operation Class="PatchOperationReplace"> <xpath>Defs/ThingDefs[defname="Plant_Tinctoria"]/plant/harvestYield/text()</xpath> <value>20</value> </Operation> </Patch>
Last edited by Nyx (She/Her); Jun 5, 2024 @ 4:50pm
Jaggid Edje Jun 5, 2024 @ 4:54pm 
Doesn't the error message give you some indication of what the failure point is?
Nyx (She/Her) Jun 5, 2024 @ 4:57pm 
nope! I've seen it do that too so that's why I came here to ask. It just says "Failed" and then goes straight into the unity stack trace garbage

Patch operation Verse.PatchOperationReplace(Defs/ThingDefs[defname="Plant_Tinctoria"]/statBases/Beauty/text()) failed
Last edited by Nyx (She/Her); Jun 5, 2024 @ 4:58pm
DZiral Jun 5, 2024 @ 5:08pm 
Try with this code in value section (not plain number, but with field name)
<value>
<Beauty>16</Beauty>
</value>
Nyx (She/Her) Jun 5, 2024 @ 5:11pm 
Originally posted by DZiral:
Try with this code in value section (not plain number, but with field name)
<value>
<Beauty>16</Beauty>
</value>
Did not change anything of note, sadly
DZiral Jun 5, 2024 @ 5:23pm 
Stupid question: are you put patch in "Patches" folder of you mod?
Nyx (She/Her) Jun 5, 2024 @ 5:24pm 
Yep

RimWorld\Mods\ModName\v1.5\Patches
DZiral Jun 5, 2024 @ 5:32pm 
change "ThingDefs_Plants" or "ThingDefs" to "ThingDef"
Edit. If you use patch from Beautiful Outdoors this will be enough (I hope), for you original patch use <value> with field name not just number
Last edited by DZiral; Jun 5, 2024 @ 5:38pm
Nyx (She/Her) Jun 5, 2024 @ 5:38pm 
Already tried that, same result-
DZiral Jun 5, 2024 @ 5:45pm 
Another typo defname -> defName (all fields case sensitive)
Nyx (She/Her) Jun 5, 2024 @ 5:50pm 
Originally posted by DZiral:
Another typo defname -> defName (all fields case sensitive)
Turns out this was the cause of all my problems. Fixed it and suddenly it tells me what was wrong! Thank you.
< >
Showing 1-12 of 12 comments
Per page: 1530 50

Date Posted: Jun 5, 2024 @ 4:24pm
Posts: 12