[Modding] Creating improvement dependencies (prereq)

I'd like to make it so that certain planetary improvements require another improvement to already be present (but not upgraded from it).  

In the current ImprovementDefs, improvements have certain Tech requirements, but none have Improvement requirements other than upgrades.

In the StarbaseModuleDefs, it is clear to see that the Prerequ tag can process this.  For instance:

<Prerequ>
<Techs>
<Option>KineticAugmentation</Option>
</Techs>
<StarbaseModule>MilitaryRingModule</StarbaseModule>
</Prerequ>

 

Here StarbaseModule is defined in the PrerequiteDefs.xsd, just as Improvements is defined:

<xs:element name="Improvement" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="StarbaseModule" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>

It would seem then that the same method could be used for building planetary improvements.  This tried to make an improvement upon which the basic factory is dependent.  I successfully created the improvement (it shows up in game) with the InternalName "Kuja_GrowthFramework".  Then for the factory, in the prerequ tag I have:

<Prerequ>
<Techs>
<Option>ColonizationTech</Option>
</Techs>
<Improvement>Kuja_GrowthFramework</Improvement>
</Prerequ>

However, in game, the factory can still be built without the newly created improvement.  

Any suggestions?  

13,522 views 3 replies
Reply #1 Top

hrmm i made a post a little while back where i tried to do the opposite make terraforming work when it was broken 
i had the race trait adaptable and the tech terraforming both listed as options but the game treated it as an and so you needed both the trait and the tech to be able to terraform the planets
ill see if i can find it and hope it helps 

Reply #2 Top

so heres what i did in beta 5

<ColonizationPrerequ>
<Stat>
<Option>CanColonizeExtremeWorld</Option>
</Stat>
<Techs>
<Option>ExtremeWorldColonization</Option>
<Option>PropagationTech</Option>
</Techs>
</ColonizationPrerequ>

what this did was make it so that you needed 
 

<Option>CanColonizeExtremeWorld</Option>

and you needed either of the following 

<Option>ExtremeWorldColonization</Option>
<Option>PropagationTech</Option>

this diddent help what i was trying to do but it might help you

Reply #3 Top

Thanks for trying. :)  In your case, it seemed like making it matter of tech prereqs.  I could, I suppose just make certain buildings tech dependent.  But it sort of... just doesn't go with the flow of what I'm trying to do.

 

I am, essentially, working on a race mod that is mainly "story" driven.  I want the race to have certain restrictions on colonization or on how planets can be used because of their backstory.  Alas, I can't make it so that the race is not able to colonize certain types of planets.  I can't make it so they can only colonize things around a certain type of star. So... I've tried to go the route of making it so that all improvements require the same base unit to allow growth of new structures.  (That is... taking say, "base structure" and upgrading that to a variety of different types of things... making all buildings dependent on this foundation).  But that isn't possible either, since it, by default, only takes the first improvement in the xml for which the base foundation is listed as upgrading from.  

So... it has led me to see if I can make it so every colony, no matter the planet type, needs a structure that is like a terraforming structure (in story)... that allows the race to use the planet freely.  Like, an environment control system, without which, the race is not willing to build even basic buildings.

I suppose I can make it so the race is inherently nerfed in all areas of production... allowing a unique building to normalize the relevent stats and make them on par with other races.  Hmm....

 

(Sorry for the ramblings)