Help! stuck on coding problem

Started by N00by95, December 23, 2018, 01:24:19 PM

Previous topic - Next topic

N00by95

Im making a mod that adds an upgrade to walls. Once you complete the smithing research you can forge metal plates to use to make plated walls. I have got that part to work, but building the walls it doesn't take an account to the resource that was used. i know i can use <costStuffCount>5</costStuffCount>
to let the player use any resource but thats for bace resource and im clueless how to code it to say any plate.
I have tried

------------------------
<costStuffCount>
  <WallPlate>6</WallPlate>
</costStuffCount>
<costList>
  <WallFrame>1</WallFrame>
  <WallRivet>28</WallRivet>
</costList>
------------------------
<costWallPlateCount>6</costWallPlateCount>
<costList>
  <WallFrame>1</WallFrame>
  <WallRivet>28</WallRivet>
</costList>

Razuhl

Make a recipe that uses "wallframes" and "wallrivets" in the desired quantity. Have it produce five "wallpiece" items. Wallpiece is now the "stuff" item that you use in the wall building.

If you add a costlist to the wall building it will require those items for every wall regardless of stuff used.

N00by95

Think i got it!

I can make a categorie could plates or something and put <costStuffCount>5</costStuffCount> in with the crafting and set the categorie too plates so only forged plates can be used.
Never made a new categorie before but hope its not as hard as i think.

When are stuff on programming a shower can help alot.

N00by95

#3
thanks Razuhl. it just came to me now. would u know how a new "stuffCategories" is made?

Im getting errors;

Could not resolve cross-reference to Rimworld.StuffcategoryDef named AdvancedPlate (wanter=stuffCategories)
Cannot call ItemFromXmlFile with resolveCrossRefs=true while loading is already in progress

Razuhl

Copy an entry from the vanilla file "Core\Defs\Misc\StuffCategoryDefs\StuffCategories.xml". For example:


<?xml version="1.0" encoding="utf-8" ?>
<Defs>
  <StuffCategoryDef>
    <defName>AdvancedPlate</defName>
    <label>advanced plate</label>
  </StuffCategoryDef>
</Defs>


You can also give the plates the Metallic category and then it can be used for everything that is buildable from metal. An advantage to that is the game will treat the material as truly metallic, which means damage treats the wall as metal armor and bullets can deal less damage or be deflected. If you make a new category that is supposed to be stronger you need to add a little extra just to stay on par with metallic walls.