Chiyu
Prince
Hello all,
I'm trying to implement a Cure For Cancer project in my mod. Since technically, it's not a building or something tangible, I would like to have it as a project instead. I want it to add +3 population to all the player's cities instantly (and if possible, everyone in his team). I know this can be done easily through buildings, but for projects, it's harder so I guess I would have to stick to python. I added some code this under def onProjectBuilt(self, argsList) in the CvEventManager.
Unfortunately, it doesn't work. Since I'm a python noob, it's likely that I did it all wrong. But I don't know what. Could anyone tell me what's wrong with my code and give a suggestion on how to make it work instead?
Thanks,
-Chiyu
I'm trying to implement a Cure For Cancer project in my mod. Since technically, it's not a building or something tangible, I would like to have it as a project instead. I want it to add +3 population to all the player's cities instantly (and if possible, everyone in his team). I know this can be done easily through buildings, but for projects, it's harder so I guess I would have to stick to python. I added some code this under def onProjectBuilt(self, argsList) in the CvEventManager.
Unfortunately, it doesn't work. Since I'm a python noob, it's likely that I did it all wrong. But I don't know what. Could anyone tell me what's wrong with my code and give a suggestion on how to make it work instead?
Code:
## Cure For Cancer ##
if ( iProjectType == gc.getInfoTypeForString("PROJECT_CURE_FOR_CANCER") ):
pPlayer = gc.getPlayer(pCity.plot().getOwner())
iPID = pPlayer.getID()
iTID = pPlayer.getTeam()
iX = pCity.getX()
iY = pCity.getY()
if ( gc.getTeam(pPlayer.getTeam()).isHasTech(obsoleteTech) == false or obsoleteTech == -1 ):
for iCity in range(pPlayer.getNumCities()):
city.changePopulation(3)
## Cure For Cancer ##
Thanks,
-Chiyu