[Question] Is it possible to use other prerequisites for technologies than another tech?

I am currently trying to add a new "resource" to the game similiar to a Lost Library.

The difference is that it should open up new technologies when an improvement is build on it.

 

There is a prereq field in the techdef field for each technolgy e.g.:

Code: xml
  1.         <Prereq>
  2.             <Type>Tech</Type>
  3.             <Attribute>Keepers_of_Avarice_Trogs</Attribute>
  4.             <Value>0</Value>
  5.         </Prereq>

 

Has anybody successfully added another type than "Tech" as pre-requisite?

 

I have tried "ImprovementType" or "Improvement" and as attribute the internal name of the resource improvement, but

without success.

2,911 views 8 replies
Reply #1 Top

I have not done it, but it is already designed so that you can require gold, materials, techs, mana, improvements, or whathaveyou as a prereq.  Can you post your attempt?

Reply #2 Top

EDIT: There are some Serious Complications(TM) with this solution. Read on for more.
I'm actually doing something similar right now! Here's how I've worked around it:

-  Create a new tech called "Claimed_Resource_Node_Tech" or something.
-  Add a game modifier to the improvement building they build on the resource to unlock Claimed_Resource_Node_Tech
-  Use Claimed_Resource_Node_Tech as the prereq for the technology you only want them to have access to after they've built the building.

Gnilbert

Reply #3 Top

Another question can a tech from one tree be a prereq to a tech from another tree?

 

 

Reply #4 Top

I think it can at that.

Reply #5 Top

Quoting Gnilbert, reply 2
I'm actually doing something similar right now! Here's how I've worked around it:

-  Create a new tech called "Claimed_Resource_Node_Tech" or something.
-  Add a game modifier to the improvement building they build on the resource to unlock Claimed_Resource_Node_Tech
-  Use Claimed_Resource_Node_Tech as the prereq for the technology you only want them to have access to after they've built the building.

Gnilbert
End of Gnilbert's quote

When you did that, did destroying the building result in the tech being unavailable again?

Reply #6 Top

Quoting Heavenfall, reply 5
When you did that, did destroying the building result in the tech being unavailable again?
End of Heavenfall's quote
Doh. No, no it didn't. With that, the fact that you have to recreate the entire tech tree, and the (very small) chance that the tech might show up during normal research, I'd like to withdraw my earlier suggestion. :blush:

Gnilbert

Reply #7 Top

GuidingSpirit, recruited units have a prereq called BuildingRequirement, as example'd:

<Prereq>
            <Type>BuildingRequirement</Type>
            <Attribute>example</Attribute>
        </Prereq>

it is linked from a special improvement tag called <SpecialBuildingType>example</SpecialBuildingType> (defined in the ImprovementType)

 

I have no idea if this would actually work for techs, but it might be worth checking out.

Reply #8 Top

@Heavenfall

I tried the BuildingRequirement (ImprovementRequirement) type but it seems that it does not work for techs.

 

@Gnilbert

What ModType did you use to unlock the tech in your work-around?

 

I found another entry in the ImprovementType category:

RequiresCityImprovement + RequiredImprovement

But it seems that these have been replaced with the Prereq entries

and are, at least for techs, simply ignored by the game.

 

Thanks for your help until now, I will try some other things.

 

 

 


@seanw3

Here is the XML code I am working with at the moment:

Code: xml
  1. &lt;?xml version="1.0" encoding="utf-8"?&gt;
  2. &lt;ResourceTypes&gt;
  3.     &lt;DataChecksum NoParse="1"&gt;
  4.         &lt;Ignore&gt;DispName&lt;/Ignore&gt;
  5.         &lt;Translate&gt;DispName,Description&lt;/Translate&gt;
  6.     &lt;/DataChecksum&gt;
  7.     &lt;!--**********************************************--&gt;
  8.     &lt;!--************** Core Resources ****************--&gt;
  9.     &lt;!--**********************************************--&gt;
  10. &lt;/ResourceTypes&gt;
  11. &lt;!--********************--&gt;&lt;!--** Golem Library World Resource**--&gt;&lt;!--********************--&gt;
  12.     &lt;ResourceType InternalName="GolemLibraryType01"&gt;
  13.         &lt;DisplayName&gt;Ancient golem library&lt;/DisplayName&gt;
  14.         &lt;Type&gt;GolemLibraryBonusType&lt;/Type&gt;
  15.         &lt;Description&gt;Build a Golem research facility here to learn how to build golems&lt;/Description&gt;
  16.         &lt;LongDescription&gt;Once the construction of golems was a common art around the kingdoms of men. Now it is lost but a few places remain where this art can be learned again.&lt;/LongDescription&gt;
  17.         &lt;RequiresCityToHarvest&gt;0&lt;/RequiresCityToHarvest&gt;
  18.         &lt;PreferredTerrain&gt;Land&lt;/PreferredTerrain&gt;
  19.         &lt;NeedsToBeUnlocked&gt;0&lt;/NeedsToBeUnlocked&gt;
  20.         &lt;IconColor&gt;50,0,0&lt;/IconColor&gt;
  21.         &lt;Icon&gt;Gfx//Icons//Icon_Water.png&lt;/Icon&gt;
  22.         &lt;ClothIcon&gt;gfx\\TacticalIcons\\Res_LostLibrary1.png&lt;/ClothIcon&gt;
  23.         &lt;TileDesign&gt;R_Golem_Library_01&lt;/TileDesign&gt;
  24.         &lt;ModelColor&gt;0,0,0&lt;/ModelColor&gt;
  25.         &lt;Production&gt;5.0&lt;/Production&gt;
  26.         &lt;Worth&gt;25&lt;/Worth&gt;
  27.         &lt;Global&gt;0&lt;/Global&gt;
  28.         &lt;Rarity&gt;1000&lt;/Rarity&gt;
  29.         &lt;Medallions&gt;
  30.             &lt;All&gt;Library.png&lt;/All&gt;&lt;/Medallions&gt;
  31.         &lt;OnSelectSFX&gt;Click_CrumblingStatue_01&lt;/OnSelectSFX&gt;&lt;/ResourceType&gt;
  32. &lt;!-- ************************** --&gt;
  33.     &lt;!-- ** Claimed Golem Library Wild Improvement** --&gt;
  34.     &lt;!-- ************************** --&gt;
  35.     &lt;ImprovementType InternalName="K_Claimed_Golem_Library"&gt;
  36.         &lt;DisplayName&gt;Ancient Golem Library&lt;/DisplayName&gt;
  37.         &lt;Description&gt;Ancient Golem Libraries harbour detailed researches about golem manufacturing. Due to this sophisticated matter it will take some time to regain this ancient art of golem construction. This library does not contain anymore knowledge about other techniques so it will not provide value to other researchs.&lt;/Description&gt;
  38.         &lt;!-- Improvement Data --&gt;
  39.         &lt;TileDesign&gt;KF_Golem_Library_01&lt;/TileDesign&gt;
  40.         &lt;ConstructionTileDesign&gt;KF_Golem_Library_Build_01&lt;/ConstructionTileDesign&gt;
  41.         &lt;SupportedTerrainType&gt;Land&lt;/SupportedTerrainType&gt;
  42.         &lt;SupportedTerrainType&gt;City&lt;/SupportedTerrainType&gt;
  43.         &lt;DrawnIcon&gt;Gfx/TacticalIcons/K_Library1.png&lt;/DrawnIcon&gt;
  44.         &lt;DrawnIconConstruction&gt;Gfx/TacticalIcons/K_Library1_C.png&lt;/DrawnIconConstruction&gt;
  45.         &lt;Thumbnail&gt;Gfx/Medallions/K_Lost_Library_02_Thumb.png&lt;/Thumbnail&gt;
  46.         &lt;IgnoreDuplicateImpLimit&gt;true&lt;/IgnoreDuplicateImpLimit&gt;
  47.         &lt;!-- Medallion Data --&gt;
  48.         &lt;Medallions InternalName=""&gt;
  49.             &lt;All&gt;Gfx/Medallions/K_Lost_Library_02_Thumb.png&lt;/All&gt;
  50.             &lt;Border_All&gt;&lt;/Border_All&gt;
  51.         &lt;/Medallions&gt;
  52.         &lt;!-- Prerequisites --&gt;
  53.         &lt;RequiresCity&gt;False&lt;/RequiresCity&gt;
  54.         &lt;RequiresResource&gt;True&lt;/RequiresResource&gt;
  55.         &lt;SupportedResourceType&gt;GolemLibraryBonusType&lt;/SupportedResourceType&gt;
  56.         &lt;!-- Cost --&gt;
  57.         &lt;LaborToBuild&gt;1.0&lt;/LaborToBuild&gt;
  58.         &lt;GameModifier&gt;
  59.             &lt;ModType&gt;ConstructionResourceCost&lt;/ModType&gt;
  60.             &lt;Attribute&gt;Materials&lt;/Attribute&gt;
  61.             &lt;Value&gt;-1&lt;/Value&gt;
  62.         &lt;/GameModifier&gt;
  63.         &lt;!-- Building Production/Consumption. --&gt;
  64.     &lt;AIData AIPersonality="AI_General"&gt;
  65.       &lt;AITag&gt;Economy&lt;/AITag&gt;
  66.     &lt;/AIData&gt;
  67.     &lt;/ImprovementType&gt;
  68. &lt;!-- ************************** --&gt;
  69. &lt;!-- ** Minor Golem Construction Tech ** --&gt;
  70. &lt;!-- ************************** --&gt;    
  71.     &lt;TechDef InternalName="T_Minor_Golem_Construction"&gt;
  72.         &lt;DisplayName&gt;Minor Golem Construction Techniques&lt;/DisplayName&gt;
  73.         &lt;Description&gt;This breakthrough allows us to construct our first golem manufacture.&lt;/Description&gt;
  74.         &lt;Image&gt;Medallions_Advanced_Foot_Solders.png&lt;/Image&gt;
  75.         &lt;Color&gt;161,59,184&lt;/Color&gt;
  76.         &lt;HotColor&gt;240,154,243&lt;/HotColor&gt;
  77.         &lt;Rarity&gt;100&lt;/Rarity&gt;
  78.         &lt;Category&gt;Warfare&lt;/Category&gt;
  79.         &lt;Infinite&gt;0&lt;/Infinite&gt;
  80.         &lt;AppearanceChance&gt;100&lt;/AppearanceChance&gt;    
  81.         &lt;Prereq&gt;
  82.         &lt;!-- How to add an improvement as prereq? --&gt;        
  83.         &lt;Type&gt;BuildingRequirement&lt;/Type&gt;
  84.         &lt;Attribute&gt;K_Workshop&lt;/Attribute&gt;
  85.         &lt;/Prereq&gt;
  86.         &lt;AIData AIPersonality="AI_General"&gt;
  87.             &lt;AIResearchPriority&gt;80&lt;/AIResearchPriority&gt;
  88.             &lt;AITradeToGetValue&gt;75&lt;/AITradeToGetValue&gt;
  89.             &lt;AITradeOutValue&gt;90&lt;/AITradeOutValue&gt;
  90.             &lt;AIAtWarMultiplier&gt;2.0&lt;/AIAtWarMultiplier&gt;
  91.             &lt;AIEarlyBuildUpMultiplier&gt;2.0&lt;/AIEarlyBuildUpMultiplier&gt;
  92.         &lt;/AIData&gt;
  93.     &lt;/TechDef&gt;
  94. &lt;!-- ************ --&gt;
  95.     &lt;!-- ** Minor golem manufacture Improvement ** --&gt;
  96.     &lt;!-- ************ --&gt;
  97.     &lt;ImprovementType InternalName="K_Minor_Golem_Manufacture"&gt;
  98.         &lt;DisplayName&gt;Minor golem manufacture&lt;/DisplayName&gt;
  99.         &lt;Description&gt;The minor golem manufacture allows construction of the most basic golem types of old ages.&lt;/Description&gt;
  100.         &lt;TileDesign&gt;KF_Minor_Golem_Manufacture_01&lt;/TileDesign&gt;
  101.         &lt;ConstructionTileDesign&gt;KF_Minor_Golem_Manufacture_Build_01&lt;/ConstructionTileDesign&gt;
  102.         &lt;RequiresCity&gt;True&lt;/RequiresCity&gt;
  103.         &lt;SupportedTerrainType&gt;Land&lt;/SupportedTerrainType&gt;
  104.         &lt;SupportedTerrainType&gt;City&lt;/SupportedTerrainType&gt;
  105.         &lt;DrawnIcon&gt;Gfx/TacticalIcons/K_Blacksmith1.png&lt;/DrawnIcon&gt;
  106.         &lt;DrawnIconConstruction&gt;Gfx/TacticalIcons/K_Blacksmith1_C.png&lt;/DrawnIconConstruction&gt;
  107.         &lt;Thumbnail&gt;K_Forge_01_Card.png&lt;/Thumbnail&gt;
  108.         &lt;ReqCityLevel&gt;1&lt;/ReqCityLevel&gt;
  109.         &lt;!-- Medallion Data --&gt;
  110.         &lt;Medallions InternalName=""&gt;
  111.             &lt;All&gt;K_Forge_01_Card.png&lt;/All&gt;
  112.             &lt;Border_All&gt;
  113.             &lt;/Border_All&gt;
  114.         &lt;/Medallions&gt;
  115.         &lt;!-- Can only have one minor golem manufacture per kingdom/empire--&gt;
  116.         &lt;AllowedPerFaction&gt;1&lt;/AllowedPerFaction&gt;
  117.         &lt;LaborToBuild&gt;5.0&lt;/LaborToBuild&gt;
  118.         &lt;GameModifier InternalName="Consumption1"&gt;
  119.             &lt;ModType&gt;ConstructionResourceCost&lt;/ModType&gt;
  120.             &lt;Attribute&gt;Materials&lt;/Attribute&gt;
  121.             &lt;Value&gt;-10&lt;/Value&gt;
  122.         &lt;/GameModifier&gt;
  123.         &lt;Prereq&gt;
  124.             &lt;Type&gt;Tech&lt;/Type&gt;
  125.             &lt;Attribute&gt;T_Minor_Golem_Construction&lt;/Attribute&gt;
  126.             &lt;Value&gt;0&lt;/Value&gt;
  127.         &lt;/Prereq&gt;
  128.     &lt;AIData AIPersonality="AI_General"&gt;
  129.             &lt;AITag&gt;CommandPost&lt;/AITag&gt;
  130.         &lt;/AIData&gt;
  131.     &lt;/ImprovementType&gt;