HELP: Trait Description changes from german to english

Started by Trunken, March 30, 2019, 10:13:37 AM

Previous topic - Next topic

Trunken

Hey Forum 8)
i'm using patch files to change the labels from traits. This works.
Now here comes my problem, for some reason the description part changes too from german to english, even though i dont touch it at all :o

Whats going on? Is there any possible reason for this? I dont know to proceed and need your help guys

here is the code:

<Patch>
  <Operation Class="PatchOperationReplace">
    <xpath>/Defs/TraitDef[defName="TRAITNAME"]/degreeDatas/li/label</xpath>
    <value>
        <label>TEXT</label>
    </value>
  </Operation>
</Patch>

EDIT:

And why is this not working? (Example for Slowpoke)

  <Operation Class="PatchOperationReplace">
    <xpath>/Defs/TraitDef[defName="SpeedOffset"]/degreeDatas/li[label="slowpoke"]/description</xpath>
    <value>
    <description>TEXTTEXTTEXT</description>
    </value>
  </Operation>

Where is my mistake?

Error Log:

[New_Mod] Patch operation Verse.PatchOperationReplace(/Defs/TraitDef[defName="SpeedOffset"]/degreeDatas/li[label="slowpoke"]/description) failed
file: C:\Steam\steamapps\common\RimWorld\Mods\New_Mod\Patches\Core_SpectrumPatch.xml
Verse.Log:Error(String, Boolean)
Verse.PatchOperation:Complete(String)
Verse.LoadedModManager:ClearCachedPatches()

Is sombody out there who can help?

LWM

Quote from: ruhkey on March 30, 2019, 10:13:37 AM
And why is this not working? (Example for Slowpoke)

  <Operation Class="PatchOperationReplace">
    <xpath>/Defs/TraitDef[defName="SpeedOffset"]/degreeDatas/li[label="slowpoke"]/description</xpath>

    <value>
    <description>TEXTTEXTTEXT</description>
    </value>
  </Operation>

Okay, when I create the file test1.xml in Patches:


<?xml version="1.0" encoding="utf-8" ?>
<Patch>
  <Operation Class="PatchOperationReplace" >
    <xpath>/Defs/TraitDef[defName="SpeedOffset"]/degreeDatas/li[label="slowpoke"]/description</xpath>
    <value><description>TEXT</description></value>
  </Operation>
</Patch>


it parses and I can make a slowpoke with TEXT.

So I'm not sure what's going on, but it *does* work?

--LWM

Trunken

the translation files for the patched def changes to default. (im editing labels only)

in other words:

the DESCRIPTION swaps to english. it shouldnt. im using the german version and translation/language files

THATS my problem

Edit: For me it didnt work, i was patching the same def on label before i patched the description, is there a way to patch both in one single operation? (for a workaround)

Kirby23590

Have you tried checking out the Core Folder like this?

Rimworld/Mods/Core/Languages/German/DefInjected/TraitDef

Try using the Language folder... Or try asking and reporting this as a bug, if it persists...

I think looking at the language folder, it's missing something which is why it's jumping back to English...

One "happy family" in the rims...
Custom font made by Marnador.



Trunken

@kirby: i did, i made a workaround, which i'm unhappy with, since its not as compatible as it should be

i dont know if this is a bug, thats why i registered in this forum

can someone answer my question?

is there a way to patch both label and description in one single operation?
i need a code snippet if possible

Kirby23590

#5
Try this code...


<Operation Class="PatchOperationReplace">
        <xpath>Defs/TraitDef[defName = "SpeedOffset"]/degreeDatas/li[1]/description</xpath>
        <value>
          <description>YOURTEXTHERE</description>
        </value>
</Operation>


Remove the li[label="slowpoke"] and change it to li[1] this is how people are able change the pawns and raiders for appearing in the factions in raids with patches like adding a new raider to show up in pirate raids...

So it should work for the trait as well...

One "happy family" in the rims...
Custom font made by Marnador.



LWM

And that is why having a unique defName (or speedOffsetName, traitName, whatever) is super valuable ><

Because you cannot be sure anymore:  if someone adds another one before "slowpoke", then you are changing the wrong description.  If someone changes degree, then you cannot search on /Defs/TraitDef[defName=...]/degreeDatas/li[degree="-1"]/...  Etc.

I would still probably try to base it off of the degree, were I making it. (.../li[degree="-1"]/...)

Or at the very least double check that [1] is correct and not [\0] every single time I did that.

--LWM

Edit: Weird formatting

Kirby23590

#7
Hey mean if you want to detect. Something else like, Fast Walker or Jogger.

Change it to li[2] for Fast Walker or li[3] for Jogger traits.

Just like for the Factions_misc with the pirates, where they are located in the code...
If i want to change something in the code with a patch and remove the heavy mercenaries from appearing. They appear in normal fights and those explosive only raids...

li[1]
for normal fights... li[2] for melee only raids... li[3] for guns only raids...  And li[4] for boom boom raid party times...

Because the Pirate Raid pawnGroupMakers don't have anything in their <li> to detect them so if i want to remove the heavy mercs from the boom booms i have to target li[4] and replace them with merc slashers i will do this for my code...

So i have to target li[4] and li[1] where they are located, but for now i will do li[4] instead...


<Operation Class="PatchOperationReplace">
        <xpath>Defs/FactionDef[defName = "Pirate"]/pawnGroupMakers/li[4]/options/Mercenary_Heavy</xpath>
        <value>
  <Mercenary_Slasher>10</Mercenary_Slasher>
        </value>
</Operation>

Since in the code of the faction_misc where the pirate faction is located, you have to target the forth <li> code thing in the pawnGroupMakers.

Same goes for the Speed Offset Traits like Slowpoke and Fast Walker. If you want to target Slowpoke make it li[1]. Or for the other two, go with li[2] & li[3]...

One "happy family" in the rims...
Custom font made by Marnador.



Trunken

@kirby, thx i got you

@LWM, yeah true words

is there a way to put both lines in one single operation? Or do i have to patch twice?

Kirby23590

@ruhkey

You to do the patch twice, since you can't get both of them...

So just Copy and paste your code, and change some values of them...

It shouldn't be to hard... ;)

One "happy family" in the rims...
Custom font made by Marnador.



Trunken