Modcheck xpath help

Started by Deathawaits4, March 11, 2018, 03:46:55 PM

Previous topic - Next topic

Deathawaits4

So im trying to get accustomed to modcheck and damn it is frustrating. After getting the normal implementation of xpath to work without that much problems im now on the rim of madness(pun). Well the thing is, something that should work, doesn't.

<?xml version="1.0" encoding="utf-8" ?>

<Patch>
   <Operation Class="PatchOperationSequence">
      <success>Always</success>
      <operations>
         <li Class="ModCheck.isModLoaded">
            <modName>Core</modName>
            <yourMod>Surgery Fixes</yourMod>
            <customMessageSuccess>ettrerterte</customMessageSuccess>
         </li>
         
         <li Class="PatchOperationSequence">
         <success>Always</success>
      <operations>
         <li Class="PatchOperationReplace">
            <xpath>/Defs/ThingDef[defName = "Gun_Autopistol"]/verbs/li/warmupTime</xpath>
            <value>
               <warmupTime>6</warmupTime>
            </value>
         </li>
      </operations>
         </li>
      </operations>
   </Operation>
</Patch>

The normal implementation of adding a new warmupTime to the pistol works. But this here does not.. It gives me the Message, that it succesfully  found both mods, but it just wont use my xpath for what ever reason.

larSyn

In this case, you wouldn't need to use ".isModLoaded", ".FindFile" works better.

Here's a (untested) working version of the ModCheck code:

<?xml version="1.0" encoding="utf-8" ?>
<Patch>

<Operation Class="PatchOperationSequence">
    <success>Always</success>
    <operations>
    <li Class="ModCheck.FindFile">
                    <modName>Core</modName>
                    <file>Weapons_Guns.xml</file>
               </li>
       <li Class="PatchOperationReplace">
               <xpath>Defs/ThingDef[defName = "Gun_Autopistol"]/verbs/li/warmupTime</xpath>
               <value>
                <warmupTime>6</warmupTime>
               </value>
               </li>
            </operations>
        </Operation>

</Patch>


If you want to see a bunch of practical examples, check out my mod (Smokeleaf Industry).  I make use of almost all of the awesomeness ModCheck offers.  Once you figure it out, it's really much better (and faster) than the vanilla way.