2 problems but 1 simple mod

Started by confusedwings, April 17, 2014, 05:04:36 PM

Previous topic - Next topic

confusedwings

Hi,

For my first mod i wanted to add a special plant...
Everything is working fine, the plant grows (you see it become bigger and bigger).
I can harvest it and get the intended goods from it.
But i still have 2 problems:

- Texture problem:            _--> fixed thx to iame6162013 <--_
When the plant is panted it's like a white square with the plant. So it doesn't change the white to the background of the game. If the plant grows the white square grows with it...
I guess my 'TestPlant.png' is fine since it's just the basic clear white i used.

- Research problem:
The plant should be researched first. So that part doesn't work at all... at the start the plant is free to plant... and not only after research... the research project is added to research and kan be researched but since it's already possible there is no fuction for it.

This is my 'TestPlant.xml'

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


   <ThingDef Name="PlantBase" Abstract="True">
      <researchPrerequisite>ResearchProjects_TestPlant</researchPrerequisite>
      <eType>Plant</eType>
      <category>Plant</category>
      <thingClass>Plant</thingClass>
      <altitudeLayer>LowPlant</altitudeLayer>
      <flammability>0.1</flammability>
      <useStandardHealth>True</useStandardHealth>
      <maxHealth>75</maxHealth>
      <tickerType>Rare</tickerType>
      <selectable>False</selectable>
      <neverMultiSelect>True</neverMultiSelect>
      <drawerType>MapMeshOnly</drawerType>
      <baseMaterialType>PlantCutout</baseMaterialType>
      <plant>
         <minFertility>0.5</minFertility>
         <fertilityFactorGrowthRate>0.2</fertilityFactorGrowthRate>
         <topWindExposure>0.1</topWindExposure>
         <growthPer20kTicks>0.18</growthPer20kTicks>
         <lifeSpan>200000</lifeSpan>
         <destroyOnHarvest>true</destroyOnHarvest>
         <minGlowToGrow>Overlit</minGlowToGrow>
         <seedShootMinGrowthPercent>0.6</seedShootMinGrowthPercent>
         <visualSizeRange>
            <min>0.3</min>
            <max>1.00</max>
         </visualSizeRange>
      </plant>
   </ThingDef>
   
   
   <!--=========================== Crops ==============================-->


   <ThingDef ParentName="PlantBase">
      <researchPrerequisite>ResearchProjects_TestPlant</researchPrerequisite>
      <defName>TestPlant</defName>
      <label>Test Plant</label>
      <maxHealth>85</maxHealth>
      <description>A cross breading that you researched. </description>
      <beauty>NiceTiny</beauty>
      <textureFolderPath>Plant/TestPlant</textureFolderPath>
      <selectable>true</selectable>
      <pathCost>10</pathCost>
      <plant>
         <harvestedThingDef>***</harvestedThingDef>
         <groundPlantable>true</groundPlantable>
         <maxFoodYield>2.0</maxFoodYield>
         <topWindExposure>0.1</topWindExposure>
         <growthPer20kTicks>0.10</growthPer20kTicks>
         <lifeSpan>2000000</lifeSpan>
         <fertilityFactorGrowthRate>0.4</fertilityFactorGrowthRate>
         <destroyOnHarvest>true</destroyOnHarvest>
         <visualSizeRange>
            <min>0.3</min>
            <max>1.05</max>
         </visualSizeRange>
      </plant>
      <researchPrerequisite>ResearchProjects_TestPlant</researchPrerequisite>
   </ThingDef>
   
</Plants>

[/tt]

I don't want to let other know what i'm working on so that's why i use those '***'

could somebody help me?

iame6162013

#1
what's in the log?

do u have transparency (alpha colors)  instead of white?

do u have both "ResearchProjects_MetalPlant" and "ResearchProjects_TestPlant" research?

u have 2xtimes in "<researchPrerequisite>ResearchProjects_TestPlant</researchPrerequisite>" in your "Crops" (remove one)
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"
Robert J. Hanlon: "Never attribute to malice that which is adequately explained by stupidity."

confusedwings

Quote from: iame6162013 on April 17, 2014, 05:08:13 PM
do u have transparency (alpha colors)  instead of white?

do u have both "ResearchProjects_TestPlant" and "ResearchProjects_TestPlant" research?
what's in the log?

u have 2xtimes in "<researchPrerequisite>ResearchProjects_TestPlant</researchPrerequisite>" in your "Crops"

I used paint so i don't think there is 'transparent' color in paint :p

And yes i know i have 2 times
'ResearchProjects_TestPlant' it's just in the hope 1 would work :p

iame6162013

Quote from: confusedwings on April 17, 2014, 05:13:50 PM
Quote from: iame6162013 on April 17, 2014, 05:08:13 PM
do u have transparency (alpha colors)  instead of white?

do u have both "ResearchProjects_TestPlant" and "ResearchProjects_TestPlant" research?
what's in the log?

u have 2xtimes in "<researchPrerequisite>ResearchProjects_TestPlant</researchPrerequisite>" in your "Crops"

I used paint so i don't think there is 'transparent' color in paint :p

And yes i know i have 2 times
'ResearchProjects_TestPlant' it's just in the hope 1 would work :p

:) (i use gimp to add alpha colours)
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"
Robert J. Hanlon: "Never attribute to malice that which is adequately explained by stupidity."

confusedwings

Quote from: iame6162013 on April 17, 2014, 05:16:04 PM
Quote from: confusedwings on April 17, 2014, 05:13:50 PM
Quote from: iame6162013 on April 17, 2014, 05:08:13 PM
do u have transparency (alpha colors)  instead of white?

do u have both "ResearchProjects_TestPlant" and "ResearchProjects_TestPlant" research?
what's in the log?

u have 2xtimes in "<researchPrerequisite>ResearchProjects_TestPlant</researchPrerequisite>" in your "Crops"

I used paint so i don't think there is 'transparent' color in paint :p

And yes i know i have 2 times
'ResearchProjects_TestPlant' it's just in the hope 1 would work :p

:) (i use gimp to add alpha colours)

THX for the help it worked like a charm...

now the problem is only the research thing :p

confusedwings

i keep on failing on letting my plant be grown after it researched...

Tynan

There is no support for researchable plants yet. I don't think this is something you could feasibly add. Sorry.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Vendan

Muahahahaha!

Just add an "Assemblies" folder to your mod, drop the attached dll into it, and add

Class="ResearchablePlant.ResearchablePlantDef, ResearchablePlant"

to your plant thingdef tag.  It should end up looking like

<ThingDef ParentName="PlantBase" Class="ResearchablePlant.ResearchablePlantDef, ResearchablePlant">

with the rest of the normal thingdef stuff after that.  Then just make sure it has a <researchPrerequisite> tag with a valid research project, and you should be good to go!

Note, not heavily tested, but it's a really simple mod, so should be good

[attachment deleted by admin: too old]

mrofa

Well you could always make the plant specific to custom growing pot
And make that growing pot researchable.
This would basicly make that this plant can be only planted in your custom growing pot only.
All i do is clutter all around.

confusedwings

Quote from: Vendan on April 18, 2014, 01:03:56 PM
Muahahahaha!

Just add an "Assemblies" folder to your mod, drop the attached dll into it, and add

Class="ResearchablePlant.ResearchablePlantDef, ResearchablePlant"

to your plant thingdef tag.  It should end up looking like

<ThingDef ParentName="PlantBase" Class="ResearchablePlant.ResearchablePlantDef, ResearchablePlant">

with the rest of the normal thingdef stuff after that.  Then just make sure it has a <researchPrerequisite> tag with a valid research project, and you should be good to go!

Note, not heavily tested, but it's a really simple mod, so should be good

should i adjust the DLL file in any way or just blindly copy paste it?

iame6162013

Quote from: confusedwings on April 18, 2014, 04:57:02 PM
Quote from: Vendan on April 18, 2014, 01:03:56 PM
Muahahahaha!

Just add an "Assemblies" folder to your mod, drop the attached dll into it, and add

Class="ResearchablePlant.ResearchablePlantDef, ResearchablePlant"

to your plant thingdef tag.  It should end up looking like

<ThingDef ParentName="PlantBase" Class="ResearchablePlant.ResearchablePlantDef, ResearchablePlant">

with the rest of the normal thingdef stuff after that.  Then just make sure it has a <researchPrerequisite> tag with a valid research project, and you should be good to go!

Note, not heavily tested, but it's a really simple mod, so should be good

should i adjust the DLL file in any way or just blindly copy paste it?

DLL changing is hard so i guess that u copy it but a source file woud be the best so u could change it in the future ;)
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"
Robert J. Hanlon: "Never attribute to malice that which is adequately explained by stupidity."

confusedwings

Quote from: iame6162013 on April 18, 2014, 05:06:16 PM
DLL changing is hard so i guess that u copy it but a source file woud be the best so u could change it in the future ;)

i just learned some of XML modding so pls don't go to hard on me... DLL... source file...
do you mean my resources file in ThingsDefs?
<?xml version="1.0" encoding="utf-8"?>
<Plants>


<ThingDef Name="PlantBase" Abstract="True">
<eType>Plant</eType>
<category>Plant</category>
<thingClass>Plant</thingClass>
<altitudeLayer>LowPlant</altitudeLayer>
<flammability>0.1</flammability>
<useStandardHealth>True</useStandardHealth>
<maxHealth>75</maxHealth>
<tickerType>Rare</tickerType>
<selectable>False</selectable>
<neverMultiSelect>True</neverMultiSelect>
<drawerType>MapMeshOnly</drawerType>
<baseMaterialType>PlantCutout</baseMaterialType>
<plant>
<minFertility>0.5</minFertility>
<fertilityFactorGrowthRate>0.2</fertilityFactorGrowthRate>
<topWindExposure>0.1</topWindExposure>
<growthPer20kTicks>0.18</growthPer20kTicks>
<lifeSpan>200000</lifeSpan>
<destroyOnHarvest>true</destroyOnHarvest>
<minGlowToGrow>Overlit</minGlowToGrow>
<seedShootMinGrowthPercent>0.6</seedShootMinGrowthPercent>
<visualSizeRange>
<min>0.3</min>
<max>1.00</max>
</visualSizeRange>
</plant>
</ThingDef>


<!--=========================== Crops ==============================-->


<ThingDef ParentName="PlantBase" Class="ResearchablePlant.ResearchablePlantDef, ResearchablePlant">
<defName>TestPlant</defName>
<label>Test Plant</label>
<maxHealth>85</maxHealth>
<description>A cross breading that you researched. The core of this plant is pure Silver, to bad the rest is useless.</description>
<beauty>NiceTiny</beauty>
<textureFolderPath>Plant/TestPlant</textureFolderPath>
<selectable>true</selectable>
<pathCost>10</pathCost>
<plant>
<harvestedThingDef>Silver</harvestedThingDef>
<groundPlantable>true</groundPlantable>
<maxFoodYield>5.0</maxFoodYield>
<topWindExposure>0.1</topWindExposure>
<growthPer20kTicks>0.80</growthPer20kTicks>
<lifeSpan>2000000</lifeSpan>
<fertilityFactorGrowthRate>0.4</fertilityFactorGrowthRate>
<destroyOnHarvest>true</destroyOnHarvest>
<visualSizeRange>
<min>0.3</min>
<max>1.05</max>
</visualSizeRange>
</plant>
<researchPrerequisite>ResearchProject_TestPlant</researchPrerequisite>
</ThingDef>

</Plants>


That's it.

anyway this is the error that i got ingame:
10 Could not resolve cross-reference: No ResearchProjectDef named ResearchProject_TestPlant found to give to researchablePlant.researchablePlantDef TestPlant

i guess i beter stop trying

iame6162013

Quote from: confusedwings on April 18, 2014, 05:27:13 PM
Quote from: iame6162013 on April 18, 2014, 05:06:16 PM
DLL changing is hard so i guess that u copy it but a source file woud be the best so u could change it in the future ;)

i just learned some of XML modding so pls don't go to hard on me... DLL... source file...
do you mean my resources file in ThingsDefs?
<?xml version="1.0" encoding="utf-8"?>
<Plants>


<ThingDef Name="PlantBase" Abstract="True">
<eType>Plant</eType>
<category>Plant</category>
<thingClass>Plant</thingClass>
<altitudeLayer>LowPlant</altitudeLayer>
<flammability>0.1</flammability>
<useStandardHealth>True</useStandardHealth>
<maxHealth>75</maxHealth>
<tickerType>Rare</tickerType>
<selectable>False</selectable>
<neverMultiSelect>True</neverMultiSelect>
<drawerType>MapMeshOnly</drawerType>
<baseMaterialType>PlantCutout</baseMaterialType>
<plant>
<minFertility>0.5</minFertility>
<fertilityFactorGrowthRate>0.2</fertilityFactorGrowthRate>
<topWindExposure>0.1</topWindExposure>
<growthPer20kTicks>0.18</growthPer20kTicks>
<lifeSpan>200000</lifeSpan>
<destroyOnHarvest>true</destroyOnHarvest>
<minGlowToGrow>Overlit</minGlowToGrow>
<seedShootMinGrowthPercent>0.6</seedShootMinGrowthPercent>
<visualSizeRange>
<min>0.3</min>
<max>1.00</max>
</visualSizeRange>
</plant>
</ThingDef>


<!--=========================== Crops ==============================-->


<ThingDef ParentName="PlantBase" Class="ResearchablePlant.ResearchablePlantDef, ResearchablePlant">
<defName>TestPlant</defName>
<label>Test Plant</label>
<maxHealth>85</maxHealth>
<description>A cross breading that you researched. The core of this plant is pure Silver, to bad the rest is useless.</description>
<beauty>NiceTiny</beauty>
<textureFolderPath>Plant/TestPlant</textureFolderPath>
<selectable>true</selectable>
<pathCost>10</pathCost>
<plant>
<harvestedThingDef>Silver</harvestedThingDef>
<groundPlantable>true</groundPlantable>
<maxFoodYield>5.0</maxFoodYield>
<topWindExposure>0.1</topWindExposure>
<growthPer20kTicks>0.80</growthPer20kTicks>
<lifeSpan>2000000</lifeSpan>
<fertilityFactorGrowthRate>0.4</fertilityFactorGrowthRate>
<destroyOnHarvest>true</destroyOnHarvest>
<visualSizeRange>
<min>0.3</min>
<max>1.05</max>
</visualSizeRange>
</plant>
<researchPrerequisite>ResearchProject_TestPlant</researchPrerequisite>
</ThingDef>

</Plants>


That's it.

anyway this is the error that i got ingame:
10 Could not resolve cross-reference: No ResearchProjectDef named ResearchProject_TestPlant found to give to researchablePlant.researchablePlantDef TestPlant

i guess i beter stop trying


NO don't give up do u have  a research def?
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"
Robert J. Hanlon: "Never attribute to malice that which is adequately explained by stupidity."

Vendan

I notice that your first post had ResearchProjects_TestPlant, and you've changed it to ResearchProject_TestPlant.  Did you change the defName in the researchProjectDef as well?  And no, you shouldn't need to change anything in the dll, but I will get the source code up soon.  In the mean time, if anyone is interested in the source, ILSpy works fine :)

iame6162013

Quote from: Vendan on April 18, 2014, 05:34:31 PM
I notice that your first post had ResearchProjects_TestPlant, and you've changed it to ResearchProject_TestPlant.  Did you change the defName in the researchProjectDef as well?  And no, you shouldn't need to change anything in the dll, but I will get the source code up soon.  In the mean time, if anyone is interested in the source, ILSpy works fine :)

IlSpy? never heard about this one :)
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"
Robert J. Hanlon: "Never attribute to malice that which is adequately explained by stupidity."