Can't modify abstract class? (XML)

Started by CombinedAutism, March 10, 2019, 08:21:24 AM

Previous topic - Next topic

CombinedAutism

Hello, I have two questions:

1. I tried to modify the abstract TerrainDef FloorBase with the following xml patch to add pathCost to it.

<?xml version="1.0" encoding="utf-8"?>
<Patch>
   <Operation Class="PatchOperationAdd">
      <xpath>*/Defs/TerrrainDef[@Name="FloorBase"]</xpath>
      <value>
         <pathCost>3</pathCost>                     
      </value>
   </Operation>   
</Patch>

Though when I load the mod it says "Verse.PatchOperationAdd failed file [name of my xml file]. Editing the Floorbase manually and adding the pathCost this way does not return such an error and correctly reduces movement speed for all floors.


2. Is there any way you can INCREASE Movement Speed on certain terrain to over 100%? Setting pathCost to a decimal<1 does not work. That was the original point of the tweak

Kirby23590

I don't know if this one will work since i never used that.

Try PatchOperationAttributeSet but it's more in the much more advanced side, since i didn't try it.


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



CombinedAutism

I dont think what I want to modify is an attribute. I think you would call it adding a node which is different.

Kirby23590

Well it's hard to modify the abstract class. And there is no better way than replacing the entire base.

Even by looking at it, i don't have enough skill to do it, so you're better off modifying or replacing the entire FloorBase...

Unless there is a better modder out there that can really help you, since i lack the knowledge of replacing the abstract class via patching...

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



CombinedAutism

Im just very surprised because in the patching tutorials it says to just an @ in front of the name and that is it.

Mehni

Quote from: CombinedAutism on March 10, 2019, 08:21:24 AM
1. I tried to modify the abstract TerrainDef FloorBase with the following xml patch to add pathCost to it.

<xpath>Defs/TerrrainDef[@Name="FloorBase"]</xpath>

You had */Defs.

Quote from: CombinedAutism on March 10, 2019, 08:21:24 AM
2. Is there any way you can INCREASE Movement Speed on certain terrain to over 100%? Setting pathCost to a decimal<1 does not work. That was the original point of the tweak

At a quick glance, not with just XML.

CombinedAutism

I tried with and without *. Both give the same error: "Failed file"

LWM

Can you try as Mehni suggested and post your entire xml file?

(Off topic slightly) By the way, Mehni, /Defs/... is **slightly** faster than Defs/...  The difference is tiny, tho.

--LWM

CombinedAutism

What do you mean by entire xml file? That was all of the xml, I just tried to modify the Floor Base for starters. Tried with /Defs, Defs, */Defs, all fail to Patch this abstract class.

LWM

Well, as written, it won't work.  It's easier to double check something if we can see exactly what you put in.

Kirby23590

When he mean't entire xml file.

He meant entire the code of your patch... Otherwise we don't know what's the problem...

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



CombinedAutism

That is the entire code so far. That's why I'm surprised that such a supposedly simple opration returns an error

Kirby23590


Maybe try this code...


<?xml version="1.0" encoding="utf-8"?>
<Patch>
   <Operation Class="PatchOperationSequence">
<success>Always</success>
<operations>

<li Class="PatchOperationSequence">
    <success>Always</success>
    <operations>
        <li Class="PatchOperationAdd">
        <xpath>Defs/TerrrainDef[@Name="FloorBase"]</xpath>
                        <value>
                                      <pathCost>3</pathCost>                     
                                </value>
        </li>
    </operations>
</li>

</operations>
</Operation>
</Patch>


Most my Patch Mods follow this, from following some Xpath Tutorials out there...

Will it still throw an error?

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



CombinedAutism

F... me. While I was checking what might have been different in your code I noticed you misspelled TerrainDef with 3 r's. Then I noticed that I misspelled Terrain in the original post. Barely noticable lol...
I guess the mystery is solved, thanks for helping everybody  :-X

Kirby23590

Oh..... Ywoch...

Wow... I didn't notice that since i kinda copy and pasted your post, to show of the other way if would work...

How didn't we not notice that typo... :P

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