Aussie_Lurker
Dec 01, 2006, 07:02 AM
Hi guys, I want to have one of my civics prevent the building of Monasteries and Missionaries. Now one approach involves using TheLopez's BuildingCivicPrereq and UnitCivicPrereq modcomps, and simply applying it to every civic except the one I want to exclude Monstaries and Missionaries. The other-much quicker way-is to modify CvGameUtils, using the def CannotTrain and def CannotConstruct sections. Using an example from Kael, I have produced the following code:
def cannotConstruct(self,argsList):
ePlayer = argsList[0]
pCity = argsList[1]
eBuilding = argsList[2]
bContinue = argsList[3]
bTestVisible = argsList[4]
bIgnoreCost = argsList[5]
pPlayer = gc.getPlayer(ePlayer)
if eBuilding == gc.getInfoTypeForString('BUILDING_BUDDHIST_MONASTE RY'):
if pPlayer.getCivic() != gc.getInfoTypeForString('CIVIC_INSULAR'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_HINDU_MONASTERY' ):
if pPlayer.getCivic() != gc.getInfoTypeForString('CIVIC_INSULAR'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_ISLAMIC_MONASTER Y'):
if pPlayer.getCivic() != gc.getInfoTypeForString('CIVIC_INSULAR'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_CONFUCIAN_MONAST ERY'):
if pPlayer.getCivic() != gc.getInfoTypeForString('CIVIC_INSULAR'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_CHRISTIAN_MONAST ERY'):
if pPlayer.getCivic() != gc.getInfoTypeForString('CIVIC_INSULAR'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_TAOIST_MONASTERY '):
if pPlayer.getCivic() != gc.getInfoTypeForString('CIVIC_INSULAR'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_JEWISH_MONASTERY '):
if pPlayer.getCivic() != gc.getInfoTypeForString('CIVIC_INSULAR'):
return True
return False
The problem is that it doesn't seem to work :(. So, I have two questions (1) can someone see a reason why this isn't working? and (2) Can anyone remember how to set up the errorlog system so that I can try and determine the source of the error myself?
Any assistance will be very much appreciated :).
Aussie_Lurker.
def cannotConstruct(self,argsList):
ePlayer = argsList[0]
pCity = argsList[1]
eBuilding = argsList[2]
bContinue = argsList[3]
bTestVisible = argsList[4]
bIgnoreCost = argsList[5]
pPlayer = gc.getPlayer(ePlayer)
if eBuilding == gc.getInfoTypeForString('BUILDING_BUDDHIST_MONASTE RY'):
if pPlayer.getCivic() != gc.getInfoTypeForString('CIVIC_INSULAR'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_HINDU_MONASTERY' ):
if pPlayer.getCivic() != gc.getInfoTypeForString('CIVIC_INSULAR'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_ISLAMIC_MONASTER Y'):
if pPlayer.getCivic() != gc.getInfoTypeForString('CIVIC_INSULAR'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_CONFUCIAN_MONAST ERY'):
if pPlayer.getCivic() != gc.getInfoTypeForString('CIVIC_INSULAR'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_CHRISTIAN_MONAST ERY'):
if pPlayer.getCivic() != gc.getInfoTypeForString('CIVIC_INSULAR'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_TAOIST_MONASTERY '):
if pPlayer.getCivic() != gc.getInfoTypeForString('CIVIC_INSULAR'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_JEWISH_MONASTERY '):
if pPlayer.getCivic() != gc.getInfoTypeForString('CIVIC_INSULAR'):
return True
return False
The problem is that it doesn't seem to work :(. So, I have two questions (1) can someone see a reason why this isn't working? and (2) Can anyone remember how to set up the errorlog system so that I can try and determine the source of the error myself?
Any assistance will be very much appreciated :).
Aussie_Lurker.