The Navy Seal
Aug 09, 2007, 05:09 PM
How do you make a building require an improvement (like Granary requires wheat)?
|
View Full Version : How to make a building... The Navy Seal Aug 09, 2007, 05:09 PM How do you make a building require an improvement (like Granary requires wheat)? Zebra 9 Aug 09, 2007, 05:30 PM Well in the CvGameUtils.py file find the cannotConstruct function. Then use the city object as a reference point in a for loop that goes through the fat cross. Then check to see if the plots owner is the cities owner and see if it has the required improvement. If so return false. I'll see if I can get the code up for you.:thumbsup: Edit or did you want resources? The Navy Seal Aug 09, 2007, 05:49 PM Well I want it so you have to have an improvement in the cities fat cross (no resouce) in order to build the building. I meant Granary requires wheat to have a farm on it. JeBuS27 Aug 09, 2007, 06:10 PM Umm, near as I can tell, Granary doesn't require wheat, or farms. However, the bonus requires that the city have access to wheat, corn, or rice. That access can come from trade, or a farm/plantation. Is that what you're talking about? The Navy Seal Aug 10, 2007, 04:47 PM Well the granary doesn't ATM but I want it so you have to have a farm in the Cities fat cross. Zebra 9 Aug 10, 2007, 08:30 PM Ok, here is your code. def cannotConstruct(self,argsList): pCity = argsList[0] eBuilding = argsList[1] bContinue = argsList[2] bTestVisible = argsList[3] bIgnoreCost = argsList[4] bCannotConstruct = True if eBuilding == gc.getInfoTypeForString("BUILDING_WALLS"): iX = pCity.getX() iY = pCity.getY() for iiX in range(iX-1, iX+2, 1): for iiY in range(iY-1, iY+2, 1): pPlot = CyMap().plot(iiX,iiY) if pPlot.getOwner() == pCity.getOwner(): if pPlot.getImprovementType() == gc.getInfoTypeForString("IMPROVEMENT_FARM"): bCannotConstruct = False if bCannotConstruct: return True return False and in PythonCallbackDefines.xml change USE_CANNOT_CONSTRUCT_CALLBACK from 0 to 1. :thumbsup: The Navy Seal Aug 10, 2007, 09:07 PM Ok, thanks. :goodjob: |
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.