Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Nerdygamer

#1
Help / Re: A quick tutorial of xpathing and patching
August 01, 2019, 01:34:00 PM
That worked!  Thank you so much for your help; you have no idea how long I spent googling, making minor changes, and testing last night.  I'm no stranger to formatting errors (and that was the first thing I double-checked - making sure I had all my brackets, my slashes, and making sure it was ThingDef), but my mistakes don't usually hang up the game so badly that I can't get a basic idea of what I did wrong from the debug log, and I didn't even think to check that my commands had the same casing :x

I'm looking into emacs right now.
#2
Unfortunately, that still doesn't work.  Just trying to enable Core and my mod results in the game throwing up the "recovered from incompatible or corrupted mods error".  I have the mod folder, which has an "About" folder and a "Patches" folder.  In the "About" folder, I have an About.xml, which is as follows:
<?xml version="1.0" encoding="utf-8"?>
<ModMetaData>
  <name>Better Marine Helmets</name>
  <author>Nerdygamer1</author>
  <targetVersion>1.0</targetVersion>
  <description>Makes marine helmets competitive when compared to plasteel advanced helmets. Previously, plasteel advanced helmets had more health and better protection against blunt damage (despite the description suggesting otherwise). Now, advanced helmets have been given a gentle increase in both health and blunt protection, at the cost of ten extra plasteel (for a total cost of 50 plasteel; the same cost as a plasteel advanced helmet). Component requirements have not been changed.</description>
</ModMetaData>


In the "Patches" folder is my "Patches_Helmets.xml" which is as follows:
<?xml version="1.0" encoding="utf-8" ?>
<Patch>
<Operation Class="PatchOperationReplace">
    <xpath>/Defs/ThingDef[defName = "Apparel_PowerArmorHelmet"]/statBases/ArmorRating_Blunt</xpath>
<value>
<ArmorRating_Blunt>0.4</ArmorRating_Blunt>
</value>
    </Operation>
</patch>


And that's literally everything. The game throws an absolute fit when trying to start up with the mod enabled - checking the box automatically restarts the game, and upon booting up, I immediately get the error message; it's not even the debug log.
#3
First time poster, so apologies if I'm out of line somewhere, but I'm having trouble xpathing into ThingDefs with parent names. I'm trying to adjust the blunt armor rating of marine helmets with a PatchOperationReplace. I have a rudimentary understanding of xpathing (thanks in part to this thread) and have a working patch to edit the values of room sizes. The following code works and is meant to serve as proof that I faintly know what I'm doing: <Patch>
<Operation Class = "PatchOperationReplace">
<xpath>Defs/RoomStatDef[defName = "Space"]/scoreStages</xpath>
<value>
    <scoreStages>
[blah blah blah, snipped for space]
</scoreStages>
</value>
</Operation>
</Patch>


However, I cannot figure out how to use a replace command to change the value of a marine helmet's blunt protection. Everything I've tried just crashes the game immediately. I even used http://xmltoolbox.appspot.com/xpath_generator.html to "cheat" and write the code for me (you plug in the code, click on the line you wish to xpath to, and it spits out what you need), and even that doesn't work. My current code, which doesn't work, is as follows: <?xml version="1.0" encoding="utf-8" ?>
<Patch>
<Operation Class="PatchOperationReplace">
    <xpath>Defs/ThingDef ParentName="ArmorHelmetMakeableBase"[defName = "Apparel_PowerArmorHelmet"]/statBases/ArmorRating_Blunt</xpath>
<value>
<ArmorRating_Blunt>0.4</ArmorRating_Blunt>
</value>
    </Operation>
</patch>


Help, please? I have no idea why my first example works and my second doesn't, but I've had trouble in the past when trying to xpath to an object that started with <ThingDef ParentName = blahblahblah>