moopoo
King
Ok. As an attempt to learn Python, I want to code a little piece of code that says once you have the tech astronomy, when you found a city it comes with a granary, aquaduct and forge, and to give them a pop of 3
In psuedo-code, this is how I envisage it will turn out. Note that the pop thing I've taken from Tsentom1's Ag trait:
As you can see, i don't have much there.
Is what I have there structured right, and all that? Any suggestions about how the code identifying Astronomy should look? Any suggestions about what to do about getting buildings in there? Please help, I'm trying really hard to get this
In psuedo-code, this is how I envisage it will turn out. Note that the pop thing I've taken from Tsentom1's Ag trait:
Spoiler :
Code:
#original Code
def onCityBuilt(self, argsList):
'City Built'
city = argsList[0]
## Agr Trait Start ## I don't know why iTrait is doing that in here
player = PyPlayer(city.getOwner())
pPlayer = gc.getPlayer(city.getOwner())
iTrait = CvUtil.findInfoTypeNum(gc.getTraitInfo,gc.getNumTraitInfos(),'TRAIT_AGRICULTURAL')
if (pPlayer.hasTrait(iTrait)):
city.changePopulation(2) # Tsentom originally had a 1 here
## Agr Trait End ##
#My kinda-code start#
itech = <Insert code that finds and identifies Astronomy>
if (pPlayer.isHasTech(itech)
<something to put aquaduct, granary, forge>
#My kinda-code end#
#Back to Original Code
if (city.getOwner() == gc.getGame().getActivePlayer()):
self.__eventEditCityNameBegin(city, False)
CvUtil.pyPrint('City Built Event: %s' %(city.getName()))
As you can see, i don't have much there.
Is what I have there structured right, and all that? Any suggestions about how the code identifying Astronomy should look? Any suggestions about what to do about getting buildings in there? Please help, I'm trying really hard to get this