Q: Making a new tech tree: problems with prerequisites

jenks

Prince
Joined
Jan 9, 2006
Messages
494
Location
Yorkshire, UK
- Ive made new technologies for Era I Roanoke in
CIV4TechInfos.xml , basically by copying and pasting code from vanilla techs and changing the name.

- I spaced them where i want them on the F6 science screen using <iGridX> and <iGridY> (they look nice :) )
- changed the icons for the techs
- changed their cost to scale upwards
- put them all in the ancient era
- changed all references to match them in other files (buildings, units, improvements etc.)
- assigned text keys in CIV4GameTextInfos_Tech.xml to read the tech names and pedia data

But I cant seem to get the prerequisites to work right or at all, ive tried using both the And and the OR but neither work. Does the AI need weighting for this to work? Is this what <iAsset> and <iPower> are for?

None of my techs are currently linked, and this lump of code ive been playing with (for my Science 1 tech, should require Energy 1) seems to get a completely different result to what is intended. Using the Or function it makes a line appear on the science screen and shows (the later and not related) Military 2 tech to require Energy 1, though there are no prerequisites declared in that tech. Using the And appears to do the same, only doesnt draw a line.

Code:
		<TechInfo>
			<Type>TECH_SCIENCE_1</Type>
			<Description>TXT_KEY_TECH_SCIENCE_1</Description>
			<Civilopedia>TXT_KEY_TECH_SCIENCE_1_PEDIA</Civilopedia>
			<Help/>
			<Strategy>TXT_KEY_TECH_SCIENCE_1_STRATEGY</Strategy>
			<Advisor>ADVISOR_SCIENCE</Advisor>
			<iAIWeight>0</iAIWeight>
			<iAITradeModifier>0</iAITradeModifier>
			<iCost>100</iCost>
			<Era>ERA_ANCIENT</Era>
			<FirstFreeUnitClass>NONE</FirstFreeUnitClass>
			<iWorkerSpeedModifier>0</iWorkerSpeedModifier>
			<iTradeRoutes>0</iTradeRoutes>
			<iHealth>0</iHealth>
			<iHappiness>0</iHappiness>
			<iFirstFreeTechs>1</iFirstFreeTechs>
			<iAsset>6</iAsset>
			<iPower>0</iPower>
			<bRepeat>0</bRepeat>
			<bTrade>1</bTrade>
			<bDisable>0</bDisable>
			<bGoodyTech>0</bGoodyTech>
			<bExtraWaterSeeFrom>0</bExtraWaterSeeFrom>
			<bMapCentering>0</bMapCentering>
			<bMapVisible>0</bMapVisible>
			<bMapTrading>0</bMapTrading>
			<bTechTrading>0</bTechTrading>
			<bGoldTrading>0</bGoldTrading>
			<bOpenBordersTrading>0</bOpenBordersTrading>
			<bDefensivePactTrading>0</bDefensivePactTrading>
			<bPermanentAllianceTrading>0</bPermanentAllianceTrading>
			<bBridgeBuilding>0</bBridgeBuilding>
			<bIrrigation>0</bIrrigation>
			<bIgnoreIrrigation>0</bIgnoreIrrigation>
			<bWaterWork>0</bWaterWork>
			<iGridX>2</iGridX>
			<iGridY>2</iGridY>
			<DomainExtraMoves/>
			<CommerceFlexible/>
			<TerrainTrades/>
			<Flavors>
				<Flavor>
					<FlavorType>FLAVOR_SCIENCE</FlavorType>
					<iFlavor>10</iFlavor>
				</Flavor>
			</Flavors>
			<OrPreReqs>
				<PrereqTech>TECH_ENERGY_1</PrereqTech>
			</OrPreReqs>
			<AndPreReqs/>
			<Quote>TXT_KEY_TECH_SCIENCE_1_QUOTE</Quote>
			<Sound/>
			<SoundMP/>
			<Button>,Art/Interface/Buttons/TechTree/Networks.dds</Button>
		</TechInfo>

Anyone have any idea what is going on ?
 
Could it also be to do with flavours? Do they have to link somehow?

I get a clean no errors when loading the mod ...

here is the code for the Energy 1 tech i made, from the same CIV4TechInfos.xml file:

Code:
		<TechInfo>
			<Type>TECH_ENERGY_1</Type>
			<Description>TXT_KEY_TECH_ENERGY_1</Description>
			<Civilopedia>TXT_KEY_TECH_ENERGY_1_PEDIA</Civilopedia>
			<Help/>
			<Strategy>TXT_KEY_TECH_ENERGY_1_STRATEGY</Strategy>
			<Advisor>ADVISOR_ECONOMY</Advisor>
			<iAIWeight>0</iAIWeight>
			<iAITradeModifier>0</iAITradeModifier>
			<iCost>50</iCost>
			<Era>ERA_ANCIENT</Era>
			<FirstFreeUnitClass>NONE</FirstFreeUnitClass>
			<iWorkerSpeedModifier>0</iWorkerSpeedModifier>
			<iTradeRoutes>0</iTradeRoutes>
			<iHealth>0</iHealth>
			<iHappiness>0</iHappiness>
			<iFirstFreeTechs>0</iFirstFreeTechs>
			<iAsset>8</iAsset>
			<iPower>4</iPower>
			<bRepeat>0</bRepeat>
			<bTrade>1</bTrade>
			<bDisable>0</bDisable>
			<bGoodyTech>1</bGoodyTech>
			<bExtraWaterSeeFrom>0</bExtraWaterSeeFrom>
			<bMapCentering>0</bMapCentering>
			<bMapVisible>0</bMapVisible>
			<bMapTrading>0</bMapTrading>
			<bTechTrading>0</bTechTrading>
			<bGoldTrading>0</bGoldTrading>
			<bOpenBordersTrading>0</bOpenBordersTrading>
			<bDefensivePactTrading>0</bDefensivePactTrading>
			<bPermanentAllianceTrading>0</bPermanentAllianceTrading>
			<bBridgeBuilding>0</bBridgeBuilding>
			<bIrrigation>0</bIrrigation>
			<bIgnoreIrrigation>0</bIgnoreIrrigation>
			<bWaterWork>0</bWaterWork>
			<iGridX>1</iGridX>
			<iGridY>1</iGridY>
			<DomainExtraMoves/>
			<CommerceFlexible/>
			<TerrainTrades/>
			<Flavors>
				<Flavor>
					<FlavorType>FLAVOR_MILITARY</FlavorType>
					<iFlavor>4</iFlavor>
				</Flavor>
				<Flavor>
					<FlavorType>FLAVOR_GOLD</FlavorType>
					<iFlavor>6</iFlavor>
				</Flavor>
				<Flavor>
					<FlavorType>FLAVOR_SCIENCE</FlavorType>
					<iFlavor>8</iFlavor>
				</Flavor>
			</Flavors>
			<OrPreReqs/>
			<AndPreReqs/>
			<Quote>TXT_KEY_TECH_ENERGY_1_QUOTE</Quote>
			<Sound/>
			<SoundMP/>
			<Button>,Art/Interface/Buttons/TechTree/AppliedPhysics.dds</Button>
		</TechInfo>

I have also tried making prerequisites work with other techs

e.g. I tried to make TECH_IMPROVE_2 require TECH_PRODUCTION_1, and this made my TECH_PRODUCTION_1 lead to TECH_EXPLORE_3.

Its all a bit back to front ! :p Cheers for any help you can give!
 
There seems to be an issue with where the technology appears in the CIV4TechInfos.xml file ...

Im currently having a fiddle with this to see what moving the techs about does.

[edit: not a lot, more and different results but still not what im expecting :(]
 
Can't tell if you'd resolved this problem or not, but here are some pointers:

1. The OR techs give you the arrow links; the AND techs give you the little upper-right-hand icon. Using all ANDs will give you no links. But it looks like you took care of that.

2. I read somewhere (and followed, so therefore can't know if it is crucial or not) that to get the techs to link properly, you need to put them in the right order in the XML. The right order is:

(a) Beginning tech
(b) First tech to require (a) as a prereq
(c) First tech to require (b) as a prereq
(d) First tech to require (c) as a prereq
...
(e) ... until the end of the tree
(f) Go back to the last "fork" in the tree. Let's pretend that's at (c), which would mean Second tech to require (c) as a prereq
(g) ... until the end of the tree
(h) Do all the OTHER siblings of (d) and (f)
(i) Repeat (f)-(h), moving up the tree until you're back at (a)
(j) Do the next major "trunk" of the tree.

I don't recall how AND techs are handled in this case.

Deconstructing the default Civ4 tech tree would answer this question...
 
Padmewan said:
Can't tell if you'd resolved this problem or not, but here are some pointers:

1. The OR techs give you the arrow links; the AND techs give you the little upper-right-hand icon. Using all ANDs will give you no links. But it looks like you took care of that.

2. I read somewhere (and followed, so therefore can't know if it is crucial or not) that to get the techs to link properly, you need to put them in the right order in the XML. The right order is:

(a) Beginning tech
(b) First tech to require (a) as a prereq
(c) First tech to require (b) as a prereq
(d) First tech to require (c) as a prereq
...
(e) ... until the end of the tree
(f) Go back to the last "fork" in the tree. Let's pretend that's at (c), which would mean Second tech to require (c) as a prereq
(g) ... until the end of the tree
(h) Do all the OTHER siblings of (d) and (f)
(i) Repeat (f)-(h), moving up the tree until you're back at (a)
(j) Do the next major "trunk" of the tree.

I don't recall how AND techs are handled in this case.

Deconstructing the default Civ4 tech tree would answer this question...
Is this order 100%? 'Cause when I was messing with techs I eventually figured out how to properly put the ones I had but I never understood the actual pattern.
 
I dunno how accurate what I posted is, but I figured Firaxis had done its ordering for whatever reason.

I also found that you can put two techs in the same X,Y location and the later one (I think) will be on top. Maybe have that backwards. But you can do this (and if the BG was opaque maybe that would be how you "hide" techs).
 
Top Bottom