Yes, that would require a DLL change. Among other things, something like this loop would need to be added toIs it possible to add the <ImprovementYieldChanges> tag from CivicsInfo to BuildingsInfo? Will it be necessary to make changes to the dll?
CvPlayer::processBuilding
. That is, if it's supposed to affect all cities (wonder effect), might get more complicated if it's supposed to work at a per-city level. Maybe some mod already does this. I thought perhaps Rise of Mankind (AND), but it looks like that mod has only added such a tag to leader traits (and it does so by adding a tag TraitYieldChanges to ImprovementInfo).Looks like the bGraphicalOnly tag is supported by the DLL for all CvInfo types that the Pedia displays, and the Pedia will exclude CvInfo instances with that tag. The tag would have to be added to the Civ4TechnologiesSchema.xml, however:Is there a way to hide technology from Civilopedia?
<ElementType name="TechInfo" content="eltOnly">
<element type="Type"/>
...
<element type="SoundMP"/>
<element type="Button"/>
<element type="bGraphicalOnly" minOccurs="0"/>
</ElementType>
<ElementType name="Button" content="textOnly"/>
<ElementType name="bGraphicalOnly" content="textOnly" dt:type="boolean"/>
<ElementType name="TechInfo" content="eltOnly">
<Button>,Art/Interface/Buttons/TechTree/Mysticism.dds,Art/Interface/Buttons/TechTree_Atlas.dds,4,11</Button>
<bGraphicalOnly>1</bGraphicalOnly>
</TechInfo>
Add the tech upon building construction, remove upon building obsolescence, city raze or foreign city acquisition. That sounds reasonable. Won't cover the WorldBuilder, but I guess that can't be helped. Could only add a periodic check, e.g. once per turn. Such a check could also verify that the other cases are handled correctly. (But maybe more trouble to implement than it's worth.)Is this the correct code? Maybe I forgot something?
This code supports the wonder that gives (or removes) dummy "bonus tech". Wonder may become obsolete.
Thanks, this works well!Looks like the bGraphicalOnly tag is supported by the DLL for all CvInfo types that the Pedia displays, and the Pedia will exclude CvInfo instances with that tag. The tag would have to be added to the Civ4TechnologiesSchema.xml, however:
Thanks, this works well!
But what about hiding a technology from the tech tree?
I'm using <iGridX>0</iGridX> <iGridY>0</iGridY>, but perhaps there is a better way?
It's strange, but using <bGraphicalOnly>1</bGraphicalOnly> makes my code not work.Yes, that would require a DLL change. Among other things, something like this loop would need to be added toCvPlayer::processBuilding
. That is, if it's supposed to affect all cities (wonder effect), might get more complicated if it's supposed to work at a per-city level. Maybe some mod already does this. I thought perhaps Rise of Mankind (AND), but it looks like that mod has only added such a tag to leader traits (and it does so by adding a tag TraitYieldChanges to ImprovementInfo).
Looks like the bGraphicalOnly tag is supported by the DLL for all CvInfo types that the Pedia displays, and the Pedia will exclude CvInfo instances with that tag. The tag would have to be added to the Civ4TechnologiesSchema.xml, however:I've only tried it for Mysticism. This made it disappear from the Pedia, hopefully, there are no undesirable side-effects.Spoiler :The minOccurs means that the tag will default to 0 and won't have to be added explicitly to every tech. And higher up in the same file:Code:<ElementType name="TechInfo" content="eltOnly"> <element type="Type"/> ... <element type="SoundMP"/> <element type="Button"/> <element type="bGraphicalOnly" minOccurs="0"/> </ElementType>
Just the one in the middle, the element types above and below should already exist. In Civ4TechInfos.xml, bGraphicalOnly would then go at the end of your TechInfo element:Code:<ElementType name="Button" content="textOnly"/> <ElementType name="bGraphicalOnly" content="textOnly" dt:type="boolean"/> <ElementType name="TechInfo" content="eltOnly">
Code:<Button>,Art/Interface/Buttons/TechTree/Mysticism.dds,Art/Interface/Buttons/TechTree_Atlas.dds,4,11</Button> <bGraphicalOnly>1</bGraphicalOnly> </TechInfo>
I'll try this.Have you tried -1 as x and y coordinates? Iirc other mods use that value to hide non-researchable techs from the tree.
Mysterious! The code works again.Difficult to see what impact graphical-only could have on the game logic. No Python exception occurring? Maybe you could verify through print statements that your setHasTech calls are reached. One could also modify the Pedia Python code so that techs are excluded e.g. based on bDisabled instead. The tech tree could, on that note, also skip disabled techs – if the coordinate-based approach isn't satisfactory.
Did you change the tech in Events XML too?I tried changing the vedic aryans event to require priesthood instead of polytheism; just replaced with 'TECH_PRIESTHOOD' in CvRandomEventInterface and started a new game. It occurred after one civ had researched polytheism anyway. I made sure nobody had priesthood, then I changed the # of archers that spawned in the event code and reloaded the turn before and that change was reflected. Then I tried removing polytheism and the event didn't happen. So it is reading the changed file but it's still going off of polytheism regardless. Why?
No. It doesn't have any; the event can trigger for any player, then thePythonCanDo checks if polytheism and archery have been researched by any player in the game.Did you change the tech in Events XML too?
def getExtraCost(self, argsList):
ePlayer = argsList[0]
## Ishtar Gate Start ##
pPlayer = gc.getPlayer(ePlayer)
if pPlayer.getBuildingClassCount(gc.getInfoTypeForString("BUILDINGCLASS_ISHTAR_GATE")) == 1:
return -10
## Ishtar Gate End ##
return 0
I figured this out; it's due to the way Taurus is set for BUFFY compatibility. Changing the else polytheism to else priesthood in Buffy.py made it work.I tried changing the vedic aryans event to require priesthood instead of polytheism; just replaced with 'TECH_PRIESTHOOD' in CvRandomEventInterface and started a new game. It occurred after one civ had researched polytheism anyway. I made sure nobody had priesthood, then I changed the # of archers that spawned in the event code and reloaded the turn before and that change was reflected. Then I tried removing polytheism and the event didn't happen. So it is reading the changed file but it's still going off of polytheism regardless. Why?
If your mod includes BUG, then this thread might help. Or, for a quicker solution, you could try placing your code in Python\EntryPoints\CvGameInterface.py instead. If BUG is not involved, then it seems that the DLL should call the function you've modified; no change needed in PythonCallbackDefines.xml either.How to use CvGameUtils.py file? I made a small addition, but it doesn't affect anything.
def cannotConstruct(self,argsList):
pCity = argsList[0]
eBuilding = argsList[1]
bContinue = argsList[2]
bTestVisible = argsList[3]
bIgnoreCost = argsList[4]
## Petra Start ##
if eBuilding == gc.getInfoTypeForString("BUILDING_PETRA"):
if pCity.getPlotCity().getTerrainType()!= gc.getInfoTypeForString("TERRAIN_DESERT"):
return True
## Petra End ##
return False