Putting recipes behind research?

Started by TTMegee, March 22, 2017, 10:08:13 PM

Previous topic - Next topic

TTMegee

So i'm new to modding (So new in fact that by the time i'm writing this I've only made a almost finished version my first mod, that's why i made this thread), and i made a mod that allows you to make 25 wood from 0.5 vegetarian nutrition, but i want to not be craftable until you research something, and i also have like no understanding of how to code in C# (for DLLs), so please attach code i can use. oh and if it's important, i have  it set that you raft it at a drug lab. I also have the research item setup in XML so all i need is how to lock the recipe behind the research.

TTMegee

On second thought i do need help with the research, it isnt showing up even though i added it

Granitecosmos

Quote from: TTMegee on March 22, 2017, 10:08:13 PM
...all i need is how to lock the recipe behind the research.

All you have to do is strap the line

<researchPrerequisite>yourResearchDef</researchPrerequisite>

to your RecipeDef.

Quote from: TTMegee on March 22, 2017, 10:29:50 PM
On second thought i do need help with the research, it isnt showing up even though i added it

The current Tech Tree is not mod friendly. You'd have to add coordinates to your research and hope that no other mod you use puts stuff there. I'd advise downloading a mod that fixes or reverts the Research Screen, like this one.

TTMegee

#3
Thanks! i used the coords the first time.... but  still didn't show up, if you know the coords for right next to the microelectronics research<?xml version="1.0" encoding="utf-8" ?>
<ResearchProjectDefs>

<ResearchProjectDef>
<defName>WoodSynth</defName>
<label>Wood Synthisis</label>
<description>Allows you to artificially synthisize wood from miscillanious plant matter.</description>
<baseCost>1200</baseCost>
<techLevel>Industrial</techLevel>
           
    <prerequisites>
      <li>Microelectronics Baisics</li>
      <li>Drug Production</li>
    </prerequisites>

<requiredResearchBuilding>HiTechResearchBench</requiredResearchBuilding>
<researchViewX>7</researchViewX>
<researchViewY>2.5</researchViewY>
</ResearchProjectDef>
that what was in the research i want to use, and i understand i just put it in case you needed it. if you know the coords i would like to know, they'd be appreciated.  And i did know about the coords before, i learned how to make this stuff by poking around the game and mod files.

TTMegee

Quote from: Granitecosmos on March 23, 2017, 05:04:36 AM
Quote from: TTMegee on March 22, 2017, 10:08:13 PM
...all i need is how to lock the recipe behind the research.

All you have to do is strap the line

<researchPrerequisite>yourResearchDef</researchPrerequisite>

to your RecipeDef.

Quote from: TTMegee on March 22, 2017, 10:29:50 PM
On second thought i do need help with the research, it isnt showing up even though i added it

The current Tech Tree is not mod friendly. You'd have to add coordinates to your research and hope that no other mod you use puts stuff there. I'd advise downloading a mod that fixes or reverts the Research Screen, like this one.
Hey er, what do i edit? i edited the "defName" section to be "WoodSynthR" but when i put that into the string you gave me needs to be in a certain place, so please tell me where. The string i got was something like it wasn't able to find the def

skullywag

based on your above code you should add WoodSynth not WoodSynthR, its the defName of the research youve added thats required as the prerequisite. So:

<researchPrerequisite>WoodSynth</researchPrerequisite>

Goes on your recipe.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

TTMegee

Might have tried that. not sure, thanks anyway!