CaptainMidnight
Warlord
- Joined
- Apr 16, 2006
- Messages
- 141
I wrote (or kind of copied and changed more like) some python. My intention is that under a civic (Chiefdom) you get a Free Citizen specialist in your capital. I tried to implement this via the SDK but it was proving too difficult for me.
CvEventManager.py
I'm not familiar with Python, so if anyone could show me what I've done wrong then I'd be really happy.
CvEventManager.py
Code:
def onBeginPlayerTurn(self, argsList):
'Called at the beginning of a players turn'
iGameTurn, iPlayer = argsList
if not gc.getPlayer( iPlayer ).isHuman():
self.doAIOperations( iPlayer )
## Chiefdom Civic CMedit ##
pPlayer = gc.getPlayer(iPlayer)
iCitizen = CvUtil.findInfoTypeNum(gc.getSpecialistInfo, gc.getNumSpecialistInfos(), 'SPECIALIST_CITIZEN', )
iPalace = gc.getInfoTypeForString("BUILDING_PALACE")
iChiefdom = CvUtil.findInfoTypeNum(gc.getCivicInfo,gc.getNumCivicInfos(),'CIVIC_CHIEFDOM')
if (pPlayer.isCivic(iChiefdom) == true):
for iCity in range(pPlayer.getNumCities()):
ppCity = pPlayer.getCity(iCity)
if ppCity.getNumActiveBuilding(iPalace) == true:
ppCity.changeFreeSpecialistCount(iCitizen, 1)
## Chiefdom Civic CMedit ##
I'm not familiar with Python, so if anyone could show me what I've done wrong then I'd be really happy.