Maniac
Apolyton Sage
Is there some way to make it so that you can build two buildings, but if you build one of them, the other one becomes unbuildable and disappears off the build list? One building excluding another?
Impaler[WrG] said:The building upgrade tags Lopez was planning could be configured to have this effect.
P.S. I HATE it when games have Building Trees with these kinds of A OR B choices, for example you can build Archery Range and build archer OR a Stable and Build Knights but not both! This makes NO SENSE WHAT-SO-EVER and is a poor substiture for an interesting and Balanced Tree of choices. DO NOT MAKE A MOD LIKE THIS![]()
![]()
![]()
M@ni@c said:Don't worry what I was trying to achieve was a Post Office building that can only be built in landlocked cities and gives +50% trade yield. I assumed a way to achieve this was to create a choice between either a Harbor or a Post Office. Since harbors can only be built in coastal cities, in landlocked cities the choice would automatically default to post offices.
Anyway, this was meant for Fall from Heaven, so if it requires an outside mod it won't be possible.![]()
Kael said:The best way to do this is probably a block in cannotConstruct function in CvGameInterface.py. Check it out to see some examples of other buildings we block.
def cannotConstruct(argsList):
pCity = argsList[0]
eBuilding = argsList[1]
bContinue = argsList[2]
bTestVisible = argsList[3]
bIgnoreCost = argsList[4]
pPlayer = gc.getPlayer(pCity.getOwner())
iSettlement = gc.getInfoTypeForString('BUILDING_SETTLEMENT')
if pCity.isHasRealBuilding(iSettlement):
bValid = False
if (eBuilding == gc.getInfoTypeForString('BUILDING_OBELISK') or eBuilding == gc.getInfoTypeForString('BUILDING_WALLS')):
bValid = True
if eBuilding == gc.getInfoTypeForString('BUILDING_CITY'):
if pPlayer.getBuildingClassCount(gc.getInfoTypeForString("BUILDINGCLASS_CITY")) < gc.getDefineINT('SPRAWLING_NUMBER_OF_CITIES'):
bValid = True
if bValid == False:
return True
return False
if eBuilding == gc.getInfoTypeForString('BUILDING_GOLDEN_WOOD'):
for i in range(pPlayer.getNumCities()):
pCity2 = pPlayer.getCity(i)
if pCity2.hasBuilding(gc.getInfoTypeForString('BUILDING_SHADOWED_VALE')):
return True
iBuildingA=gc.getInfoTypeForString('BUILDING_A')
iBuildingB=gc.getInfoTypeForString('BUILDING_B')
if eBuilding in (iBuildingA,iBuildingB):
if pCity.isHasRealBuilding(iBuildingA) or pCity.isHasRealBuilding(iBuildingB):
return True
# Buildings to construct
for i in range ( g_NumBuildingClassInfos ):
if (not isLimitedWonderClass(i)):
eLoopBuilding = gc.getCivilizationInfo(pHeadSelectedCity.getCivilizationType()).getCivilizationBuildings(i)
if (pHeadSelectedCity.canConstruct(eLoopBuilding, False, True, False)):
#### added code
iBuildingA=gc.getInfoTypeForString('BUILDING_A')
iBuildingB=gc.getInfoTypeForString('BUILDING_B')
if eLoopBuilding in (iBuildingA,iBuildingB):
if pHeadSelectedCity.isHasRealBuilding(iBuildingA) or pHeadSelectedCity.isHasRealBuilding(iBuildingB):
continue
#### added code
screen.appendMultiListButton( "BottomButtonContainer", gc.getBuildingInfo(eLoopBuilding).getButton(), iRow, WidgetTypes.WIDGET_CONSTRUCT, i, -1, False )
screen.show( "BottomButtonContainer" )
if ( not pHeadSelectedCity.canConstruct(eLoopBuilding, False, False, False) ):
screen.disableMultiListButton( "BottomButtonContainer", iRow, iCount, gc.getBuildingInfo(eLoopBuilding).getButton() )
iCount = iCount + 1
bFound = True