Rellek
Jan 07, 2007, 11:32 AM
Hello modders,
I'm currently working on a really well grown new mod and am needing one specific option in there: I want to realize alternative technologies.
I have already created a tech tree with different ways to go on by creating "basic" technologies needed for proceed on a specific way. For now i just disabled two options for each civilization so each civilization has only one possible way to go.
But I would strongly prefer another way to realize specialization. What I would like to do is, that discovering tech A disables automatically the research on tech B and C (and so on).
I have to admit, that I only know xml-editing yet and there's obviousely no way to do that. I also couldnt find something similar already done, so I hope someone in here can help me.
;)
Rellek
Jan 09, 2007, 12:45 PM
Hello again, I did try a bit and found a solution myself. Not very nice, but working.
XML (civ4techinfos.xml)
1. Define a technology (T0) and dont allow it to be acquired
<iCost>-1</iCost>
.
.
.
<bTrade>0</bTrade>
<bDisable>1</bDisable>
<bGoodyTech>0</bGoodyTech>
You may also make it invisible by <iGridX>-1</iGridX>
It shouldn't have any effect itself.
2. Define the technologies, which should be alternative (Ta, Tb, und Tc) and let T0 be their prerequisite (AndPreReq). Further special technologies can have one of these as their prerequisite.
XML (CIV4CivilizationInfos.xml)
3. Give every(!) civilizationen T0 as a starting technology
<FreeTechs>
<FreeTech>
<TechType>TECH_T0</TechType>
<bFreeTech>1</bFreeTech>
</FreeTech>
</FreeTechs>
Phyton (CvEventManager.py):
4. Extend the def onTechAcquired entry by this lines:
#deactivate technologies
if iTechType == CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTec hInfos(),"TECH_Ta"):
gc.getTeam(iTeam).setHasTech(CvUtil.findInfoTypeNu m(gc.getTechInfo,gc.getNumTechInfos(),"TECH_T0"), False, iPlayer, False, False)
if gc.getPlayer(iPlayer).isHuman():
message = localText.getText("TXT_KEY_ALTERNATIVE_A", ())
CyInterface().addMessage(CyGame().getActivePlayer( ), True, 10, message, None, 2, None, ColorTypes(8), 0, 0, False, False)
if iTechType == CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTec hInfos(),"TECH_Tb"):
gc.getTeam(iTeam).setHasTech(CvUtil.findInfoTypeNu m(gc.getTechInfo,gc.getNumTechInfos(),"TECH_T0"), False, iPlayer, False, False)
if gc.getPlayer(iPlayer).isHuman():
message = localText.getText("TXT_KEY_ALTERNATIVE_B", ())
CyInterface().addMessage(CyGame().getActivePlayer( ), True, 10, message, None, 2, None, ColorTypes(8), 0, 0, False, False)
if iTechType == CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTec hInfos(),"TECH_Tc"):
gc.getTeam(iPlayer).setHasTech(CvUtil.findInfoType Num(gc.getTechInfo,gc.getNumTechInfos(),"TECH_T0"), False, iPlayer, False, False)
if gc.getPlayer(iPlayer).isHuman():
message = localText.getText("TXT_KEY_ALTERNATIVE_C", ())
CyInterface().addMessage(CyGame().getActivePlayer( ), True, 10, message, None, 2, None, ColorTypes(8), 0, 0, False, False)
This code works like this: Every time a player acquires a technology, there will be controlled if is one of the alternative technlogies Ta, Tb or Tc. If so, technology T0 is set as not acquired. By this the prerequisit of the other alternative technolgies will be missing. Additionally the code will issue a message if the player is human.
XML (CIV4GameTextInfos.xml):
5. This message now has to be set for example like this:
<TEXT>
<Tag>TXT_KEY_ATERNATIVE_A</Tag>
<English>Your Civilization has acquired 'Ta'! Technologies Tb and Tc are not anymore available.</English>
<French>...</French>
<German>...</German>
<Italian>...</Italian>
<Spanish>...</Spanish>
</TEXT>
T0, Ta, Tb, Tc of course have to fit the usual scheme (e.g. TECH_AGRICULTURE).
Like I said, this solution isn't ideal but working. The AI doesnt understand of course, but you can manage that the AI wont always resaerch for the same technologies by making the alternatives about equivalent and by setting different flavors.