Changing Mech Work Speed

Started by Silentfox, March 30, 2024, 08:02:54 PM

Previous topic - Next topic

Silentfox

So I was trying to make a basic .xml patch to make it so that mechs have a 100% global work speed instead of 50% using chatgpt because I have no idea how to code. I thought it would be easy but every time I put the .xml into the game it gives me this error:

[Mech Speed Fix] Patch operation Verse.PatchOperationReplace(/Defs/ThingDef[defName="Mech_Constructoid"]/statBases/workSpeedGlobal) failed
file: C:\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\MechSpeedFix\Patches\MechSpeedFix.xml
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Verse.Log:Error (string)
Verse.PatchOperation:Complete (string)
Verse.LoadedModManager:ClearCachedPatches ()
Verse.LoadedModManager:LoadAllActiveMods ()
Verse.PlayDataLoader:DoPlayLoad ()
Verse.PlayDataLoader:LoadAllPlayData (bool)
Verse.Root/<>c:<Start>b__6_1 ()
Verse.LongEventHandler:RunEventFromAnotherThread (System.Action)
Verse.LongEventHandler/<>c:<UpdateCurrentAsynchronousEvent>b__27_0 ()
System.Threading.ThreadHelper:ThreadStart_Context (object)
System.Threading.ExecutionContext:RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object)
System.Threading.ThreadHelper:ThreadStart ()

And it repeats that for the other mechs that I tried to change the speed of as well. For reference, this is the code:

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

  <Operation Class="PatchOperationReplace">
    <xpath>/Defs/ThingDef[defName="Mech_Constructoid"]/statBases/workSpeedGlobal</xpath>
    <value>
      <workSpeedGlobal>1.0</workSpeedGlobal>
    </value>
  </Operation>

  <Operation Class="PatchOperationReplace">
    <xpath>/Defs/ThingDef[defName="Mech_Agrihand"]/statBases/workSpeedGlobal</xpath>
    <value>
      <workSpeedGlobal>1.0</workSpeedGlobal>
    </value>
  </Operation>

  <Operation Class="PatchOperationReplace">
    <xpath>/Defs/ThingDef[defName="Mech_Fabricor"]/statBases/workSpeedGlobal</xpath>
    <value>
      <workSpeedGlobal>1.0</workSpeedGlobal>
    </value>
  </Operation>

  <Operation Class="PatchOperationReplace">
    <xpath>/Defs/ThingDef[defName="Mech_Paramedic"]/statBases/workSpeedGlobal</xpath>
    <value>
      <workSpeedGlobal>1.0</workSpeedGlobal>
    </value>
  </Operation>

  <Operation Class="PatchOperationReplace">
    <xpath>/Defs/ThingDef[defName="Mech_Cleansweeper"]/statBases/workSpeedGlobal</xpath>
    <value>
      <workSpeedGlobal>1.0</workSpeedGlobal>
    </value>
  </Operation>

</Patch>

As far as I can tell it should work, but again, I have no experience coding and don't know what I'm doing. I would appreciate any help getting this to work so I can have OP robots. Thank you.