Help with costStuffcount and two variable materials for one craftable item

Started by Stahlvormund, April 04, 2020, 09:10:58 AM

Previous topic - Next topic

Stahlvormund

Hey gals and guys,

I am pretty much a mod amateur, newbie, but I do like to change some values in the .xmls to adapt the game and its balance to my liking.
I would like to be able to make armor such as Flak Vests, Jackets and Pants be made from two variable items, so Fabric and Metallic.
So far I managed to change it so the Jackets and Pants have Fabric as the variable and Steel as fixed material, and the Vests have Metallic as variable and Cloth as fixed cost with this code instead of their normal ones, and those work with the game. (yes, I removed the component costs)

Pants/Jackets:

<costStuffCount>60</costStuffCount>
    <stuffCategories>
      <li>Fabric</li>
    </stuffCategories>
    <costList>
      <Steel>30</Steel>
    </costList>

Vests:

<costStuffCount>60</costStuffCount>
    <stuffCategories>
      <li>Metallic</li>
    </stuffCategories>
    <costList>
      <Cloth>30</Cloth>
    </costList>

I tried:

<costStuffCount>30</costStuffCount>
    <stuffCategories>
      <li>Fabric</li>
    </stuffCategories>
<costStuffCount>60</costStuffCount>
    <stuffCategories>
      <li>Metallic</li>
    </stuffCategories>

But that resulted in the former being overwritten by the latter for only a 60 ingredient cost instead of 30+60 of two different material classes, so ingame it should show as

Ingredients 30
Ingredients 60

as costs in the craft menu but it ended up showing as

Ingredients 60

Adding a costlist after the costStuffcount argument didn't work either.
I couldn't think of anywhere where I could copy the argument I am looking for either. Is it even possible?

I would be most happy about any help or feedback, even if you explain to me that it is not possible.

Kind regards,

Stahlvormund

Bunkier

You can't use two variable materials on one thing using base game code. The only possibility is to use one or more non-variable material which is cloth in your case and metal like plasteel or steel. There's no Elephant Leather Plasteel Flak Pants ect. in the base game, you will need to code it yourself.

Stahlvormund

How does the base game code determine that a material has a variable material it uses to determine it's main properties, f.e. Devilstrand Duster?
Do you know where that code is?

Also, I don't necessarily want it to be a Devilstrand Plasteel Flak Vest by name, but mainly the armor and insulation values of the materials to play into the end product.

Sorry again if I am asking maybe obvious questions, I am very new to this.

Bunkier

By variable i mean group of items like Metallic or Fabric. It collects data from f.e. Devilstrand and uses it as stats for the apparel etc.
Its hardcoded afaik.
Also i might be totally wrong, someone else might need to confirm what im sayin.

Stahlvormund

So I guess you don't know where exactly this is determined/coded so I could alter it to pull it from two variables and add the values.  :-\

Bunkier

im 99% sure that its hardcoded. you can't make this with pure xml

Stahlvormund

Yeah, I figured :-/
so need to dive in the C#, Assembly and all that stuff if I wanted to have it.

Stahlvormund

Maybe someone would be interested in working on this? Can't dive into the whole modding at the moment.
I would perhaps be willing to even commission it if that is a motivation, and if that is even allowed on these forums.



LWM

It's a tricky problem, because it will take:

  • Knowing how things are built in RimWorld
  • Making sure every place that checks a building's cost checks new code
  • Actually writing that new code
  • Inserting that new code
  • Making some sort of UI to access that code

In case you couldn't guess, I've thought about doing this before and haven't decided I have enough free time or coffee.

--LWM