Research Project def help

Started by rhtstm, July 29, 2016, 09:03:59 PM

Previous topic - Next topic

rhtstm

Hello,
Is it possible to let an item that can be craft after research a certain research project? Currently working on a mod right now and want to add this cool feature in. If so, what's the def file structure like?
Sorry for asking a noob question.  :P

Thanks!

rhtstm

Here is the code in one of the xml file. Is there a way to call this part from other def files?
 
<ResearchProjectDef>
    <defName>A</defName>
    <label>A</label>
    <description>You can craft A at Machining Table.</description>
    <baseCost>300</baseCost>
    <techLevel>Industrial</techLevel>
    <prerequisites>
      <li>Machining</li>
    </prerequisites>
</ResearchProjectDef>


notfood

In your RecipeDef put <researchPrerequisite>A</researchPrerequisite>

notfood

#3
Nono, that's a ThingDef. It defines your item.

You need a RecipeDef. It defines how to craft your item.

Read this: http://rimworldwiki.com/wiki/Modding_Tutorials/Smelter

rhtstm

Oh, thanks! :D I'll take a look at it.

rhtstm

Quote from: notfood on July 30, 2016, 01:58:28 AM
Nono, that's a ThingDef. It defines your item.

You need a RecipeDef. It defines how to craft your item.

Read this: http://rimworldwiki.com/wiki/Modding_Tutorials/Smelter

I went through this page. So...I am not creating a new production type thingy. It's just a regular usable weapon that can be craft via smith or machining table. Let's say, I want to have the Research Project of "Medieval Sword Study" to be done in order to craft a sword via the bench.

notfood

So you have your ThingDef defined.

Just add a new RecipeDef.
Copy this somewhere in RecipeDefs folder.
<RecipeDefs>

  <RecipeDef>
    <defName>MakeMyItem</defName>
    <label>make my item</label>
    <description>Craft my item.</description>
    <jobString>Crafting my item.</jobString>
    <workAmount>500</workAmount>
    <workSpeedStat>SmithingSpeed</workSpeedStat>
    <effectWorking>Smith</effectWorking>
    <soundWorking>Recipe_Smith</soundWorking>
    <ingredients>
      <li>
        <filter>
          <thingDefs>
            <li>Steel</li>
          </thingDefs>
        </filter>
        <count>20</count>
      </li>
    </ingredients>
    <fixedIngredientFilter>
      <thingDefs>
        <li>Steel</li>
      </thingDefs>
    </fixedIngredientFilter>
    <products>
      <MyItem>5</MyItem>
    </products>
    <recipeUsers>
        <li>ElectricTailoringBench</li>
    </recipeUsers>
    <researchPrerequisite>A</researchPrerequisite>
  </RecipeDef>

</RecipeDefs>


Consider MyItem is the DefName of your item.

Now your item can be crafted in the ElectricTailoringBench and requires A to appear.

rhtstm

Quote from: notfood on July 30, 2016, 03:09:09 AM
So you have your ThingDef defined.

Just add a new RecipeDef.
Copy this somewhere in RecipeDefs folder.
<RecipeDefs>

  <RecipeDef>
    <defName>MakeMyItem</defName>
    <label>make my item</label>
    <description>Craft my item.</description>
    <jobString>Crafting my item.</jobString>
    <workAmount>500</workAmount>
    <workSpeedStat>SmithingSpeed</workSpeedStat>
    <effectWorking>Smith</effectWorking>
    <soundWorking>Recipe_Smith</soundWorking>
    <ingredients>
      <li>
        <filter>
          <thingDefs>
            <li>Steel</li>
          </thingDefs>
        </filter>
        <count>20</count>
      </li>
    </ingredients>
    <fixedIngredientFilter>
      <thingDefs>
        <li>Steel</li>
      </thingDefs>
    </fixedIngredientFilter>
    <products>
      <MyItem>5</MyItem>
    </products>
    <recipeUsers>
        <li>ElectricTailoringBench</li>
    </recipeUsers>
    <researchPrerequisite>A</researchPrerequisite>
  </RecipeDef>

</RecipeDefs>


Consider MyItem is the DefName of your item.

Now your item can be crafted in the ElectricTailoringBench and requires A to appear.

Awesome, It worked! Thanks! ;D