Modded Research not showing up in research panel

Started by Zapp Brannigan, May 02, 2015, 04:07:29 AM

Previous topic - Next topic

Zapp Brannigan

Hi guys,

I am pretty new to modding but it seems pretty straight forward and logical (most of the time). I have been playing around with skully's OmniWeapons mod and wanted to add the ability to craft his weapons.

My first step was to create the ability to research the weapons and would add the ability to craft them later. I followed the format used by many of the other mods I have installed (basically used them to reverse engineer research.xml format) and added the weapons and prerequisites I wanted each "tier" to have.

I placed the new Research_Weapons_Ballistic.xml file that I typed out into RimWorld785Win/Mods/OmniWeapons/Defs/ResearchProjectsDefs However when I start a new test colony and click on the research tab, the first research item is not listed.

Is there another file I need to add? Or is my code simply wrong? Here is a link to the .xml file: https://www.dropbox.com/s/055e8p5d4dasvn9/Research_Weapons_Ballistic.xml?dl=0

BBream

I think it need to be deleted line
        <prerequisites></prerequisites>
Other research that not has prerequisites don't have this line.


<?xml version="1.0" encoding="utf-8" ?>
<ResearchProjectDefs>

    <ResearchProjectDef>
        <defName>Research_Weapons_Ballistic_Basic</defName>
        <label>Basic Ballistic Weaponry</label>
        <description>Teaches your colonists how to use basic machining techniques for ballistic weaponry.</description>
        <totalCost>1000</totalCost>
    </ResearchProjectDef>
...

Zapp Brannigan

Quote from: BBream on May 02, 2015, 09:49:28 AM
I think it need to be deleted line
        <prerequisites></prerequisites>
Other research that not has prerequisites don't have this line.


<?xml version="1.0" encoding="utf-8" ?>
<ResearchProjectDefs>

    <ResearchProjectDef>
        <defName>Research_Weapons_Ballistic_Basic</defName>
        <label>Basic Ballistic Weaponry</label>
        <description>Teaches your colonists how to use basic machining techniques for ballistic weaponry.</description>
        <totalCost>1000</totalCost>
    </ResearchProjectDef>
...


I removed that line with no effect, a number of other mods I use leave the line there regardless.

However I did find a number of mistakes in the code (spelling mistakes and missing > once). Luckily the console was happy to point out what and where these mistakes were.

Fixing the mistakes now brings the research up in the research menu. However I now get 3 errors that say:

1. Could not resolve cross-reference to Verse.ResearchProjectDef named Research_Weapons_Ballistic_Pistol
2. Could not resolve cross-reference to Verse.ResearchProjectDef named Research_Weapons_Ballistic_Rifle
3. Cannot call ItemFromXmlFile with resolveCrossRefs=true while loading is already in progress.

Its should be noted that pistol research seems to work fine. It is hidden until I research Basic Ballistics, however the other weapons are shown regardless, except scatterguns, which also shows up once carbines is researched.

skullywag

upload your new version and ill fix it. Still not sure what youre going to do with this as unlocking recipes on a worktable per research is a dll mod only, you ready for that?
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

Zapp Brannigan

#4
I fixed it.... Note to self, learn how to spell the word RESEARCH, before attempting to add research >_<

Basically the higher tier weapons were looking for Research_Weapons_Ballistic_Pistol, but I had named it Reasearch_Weapons_Ballistic_Pistol. Note the extra a.

Code works perfectly now. Next job is to add it to a crafting recipe, which like you said is a dll file structure, which I am completely lost on :P

*EDIT* Going to try my hand at the dll tutorial here on the forums, I will post more if I get stumped (which is likely as I have no #C experience >_<)

skullywag

recipes arent dll, you can do those is xml, the issue is adding the recipes to the worktables as research is done. Thats where the dll would come in.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?