Need help with python script


Jan 20, 2007
Hello I need help with a python code:

def doGoldPerTurn(self, argsList):
"controls the gold result of pillaging"
pPlot = argsList[0]
pUnit = argsList[1]

iGoldPerTurn = 0
iGoldPerTurn = self.player.getTotalPopulation * getNumCities()
iGoldPerTurn += self.player.getTotalPopulation * getNumCities()

iGoldPerTurn += ((pCity.getCulture() / 5) + (pCity.getFoodRate() + pCity.getProductionRate() \
+ pCity.calculateGoldRate())) * pCity.getPopulation()

return self.player.getGoldPerTurn()

I've been studying python (a lot) and what I am trying to do is create a new way for people to receive gold per turn. The code is suppose to be read like this: The total population of a civilization times production rate divided by maintenance cost equals gold per turn.

iGoldPerTurn += self.player.getTotalPopulation * getNumCities()
This is suppose to read Your total population multiplied by your total number of cities divided by inflation cost will be the total amount of gold you receive per turn.

You see I am making a mod that will make gold per turn your taxes. I need help please. Thanks. Ignore the foodrate thingy I was just testing the script at the time.
Well whatever you set iGoldPerTurn to you have to acually return it. At the moment you have
return self.player.getGoldPerTurn()
which means it is returning the standard gold per turn and not using your added equations at all.
Top Bottom