Custom Improvement Question

I've created a Mod_ImprovementsDefs and a Mod_ImprovementText. There is one item in each. My custom faction is using a modified version of the Yor tree and my new improvement replaces the Manufacturing Yor improvement. I ran the game and the Yor version is still present. How do I make it so it uses my Improvements? I cannot find any pointers in the TechDef xml file. What files controls that aspect?

6,272 views 5 replies
Reply #1 Top


What files controls that aspect?
End of quote

ImprovementDefs.XML. Specifically, the <Tech><Option>(techname)(/Option></Tech> bit inside the <Prerequ></Prerequ> tags in each improvement definition for improvements that have prerequisite techs (note that if there's an improvement unlocked with different techs for different factions, then there will be more than one <Option>(tech internal name)</Option> within the <Tech></Tech> tags).

However, as you're looking to replace existing improvements rather than add additional improvements, I would suggest that you simply reuse the internal names of the improvements that you're trying to replace. If you don't, you're going to have to disable the existing improvements in some way, say by adding <Unavailable>True</Unavailable> to the prerequisites list; if the improvement is shared between multiple factions, then you'll probably want to render it unbuildable for only the faction you want to change (meaning you cannot use <Unavailable>True</Unavailable>), which may be as simple as removing the <Option></Option> tag with the appropriate faction's tech listed if it's an improvement unlocked by a tech, or somewhat more involved if the tech in question is common to both factions (in such a case, you could try using a faction ability as a prerequisite, or you might need to edit the appropriate tech trees to change the internal names of the techs of at least one tree so that you can have the improvements key off of different techs).

Reply #2 Top

 <Improvement>
    <InternalName>ConstructionExo</InternalName>
    <DisplayName>ConstructionExo_Name</DisplayName>
    <ShortDescription>ConstructionExo_ShortDec</ShortDescription>
    <Description>ConstructionExo_Dec</Description>
    <Icon>ManufacturingYor.png</Icon>
    <BuildIcon>ManufacturingYor_Build.png</BuildIcon>
    <ListIcon>ManufacturingYor_Icon.png</ListIcon>
    <ImprovementType>Manufacturing</ImprovementType>
    <PlacementType>Manufacturing</PlacementType>
 
    <!-- Stats -->
 
    <Stats>
      <EffectType>ManufacturingCost</EffectType>
      <Scope>Queue</Scope>
      <Target>
        <TargetType>Improvement</TargetType>
      </Target>
      <BonusType>Flat</BonusType>
      <Value>20</Value>
    </Stats>
 
    <Stats>
      <EffectType>MaxManufacturing</EffectType>
      <Target>
        <TargetType>Colony</TargetType>
      </Target>
      <BonusType>Multiplier</BonusType>
      <Value>0.2</Value>
    </Stats>
 
    <Stats>
      <EffectType>Maintenance</EffectType>
      <Target>
        <TargetType>Improvement</TargetType>
      </Target>
      <BonusType>Flat</BonusType>
      <Value>0.25</Value>
    </Stats>
 
    <!-- Triggers -->
 
    <!-- Level Effect Trigers -->
 
    <!-- Level Effect Stats -->
 
    <LevelEffectStats>
      <EffectType>MaxManufacturing</EffectType>
      <Target>
        <TargetType>Colony</TargetType>
      </Target>
      <BonusType>Multiplier</BonusType>
      <Value>0.05</Value>
    </LevelEffectStats>
 
    <!-- Adjacency Bonuses -->
 
    <NeighborBonuses>
      <GiveBonusToNeighborType>Manufacturing</GiveBonusToNeighborType>
      <NeighborBonusValue>2</NeighborBonusValue>
    </NeighborBonuses>
 
    <NeighborBonuses>
      <GiveBonusToNeighborType>Military</GiveBonusToNeighborType>
      <NeighborBonusValue>0</NeighborBonusValue>
    </NeighborBonuses>
 
    <!-- Prerequisites -->
 
    <Prerequ>
      <Techs>
        <Option>PropagationTech</Option>
      </Techs>
    </Prerequ>
 
  </Improvement>

Reply #3 Top

The above Improvement doesn't replace the Manufacturing Yor improvement in game for my custom faction.

 

<Prerequ>
      <Techs>
        <Option>PropagationTech</Option>
      </Techs>
    </Prerequ>

 

Do I need to change out the PropagationTech in this part to something else? While that is referenced here and in much of the Yor's tech tree - I cannot find what defines that. This is my first attempt at a mod (in any game) and I might just be overlooking it.

Reply #4 Top

Huzzah. That item points back to the tech in the techdef with that generic name. Thank you for pointing me in the right direction! Now to begin the long process of modifying all the improvements!

Reply #5 Top

The easiest way to do what you want to do is to change the internal name of your custom improvement from ConstructionExo to ManufacturingYor, which redefines the ManufacturingYor improvement to be the custom improvement that you've created rather than the improvement in the game files.

Otherwise, you're going to have to create an entry in your mod file for the ManufacturingYor improvement and add something to the improvement definition that disables the improvement - adding <Unavailable>True</Unavailable> to the prerequisites of the ManufacturingYor improvement, for example, would be one way to do that.