1.
I want a function in python that adds a Specialist for free in the capital under a certain civic. Kindow straight forward to add the specialist, the problems start when switching of the civic condition, i just try to "reverse" add the specialists in an unsophisticated manner... and I get a typeerror that totally perplexes me:
File "CvEventManager", line 522, in onBeginPlayerTurn
TypeError: this constructor takes no arguments
(that is the last line of the code posted below)
the code looks perfect to me, but python says otherwise...
2.
if the above problem was easy to solve perhaps someone would know how to make the Specialist random for X amount of turns (say 5), I have absolutly no idea how to solve the randomness idea in terms of removing the specialist ...
I want a function in python that adds a Specialist for free in the capital under a certain civic. Kindow straight forward to add the specialist, the problems start when switching of the civic condition, i just try to "reverse" add the specialists in an unsophisticated manner... and I get a typeerror that totally perplexes me:
File "CvEventManager", line 522, in onBeginPlayerTurn
TypeError: this constructor takes no arguments
(that is the last line of the code posted below)
the code looks perfect to me, but python says otherwise...
Code:
pPlayer = gc.getPlayer(iPlayer)
if (player.isCivic(gc.getInfoTypeForString("CIVIC_OLIGARCHY"))):
for iCity in range(pPlayer.getNumCities()):
ppCity = pPlayer.getCity(iCity)
if ppCity.isGovernmentCenter():
if ppCity.getNumRealBuilding(gc.getInfoTypeForString("BUILDING_DRILL")) > 0:
pPlayer.getCity(ppCity).setFreeSpecialistCount(gc.getInfoTypeForString("SPECIALIST_GENERAL"), 2)
else:
pPlayer.getCity(ppCity).setFreeSpecialistCount(gc.getInfoTypeForString("SPECIALIST_GENERAL"), 1)
else:
for iCity in range(pPlayer.getNumCities()):
ppCity = pPlayer.getCity(iCity)
if ppCity.isGovernmentCenter():
if ppCity.getNumRealBuilding(gc.getInfoTypeForString("BUILDING_DRILL")) > 0:
pPlayer.getCity(ppCity).setFreeSpecialistCount(gc.getInfoTypeForString("SPECIALIST_GENERAL"), 1)
else:
pPlayer.getCity(ppCity).setFreeSpecialistCount(gc.getInfoTypeForString("SPECIALIST_GENERAL"), 0)
2.
if the above problem was easy to solve perhaps someone would know how to make the Specialist random for X amount of turns (say 5), I have absolutly no idea how to solve the randomness idea in terms of removing the specialist ...