def xpNorm():
if CvEventInfo().getTech() == 10:
if PyPlayer(0).isAlive():
PyPlayer(0).initUnit(18, 49, 56, 1)
def onTechAcquired(self, argsList):
'Tech Acquired'
iTechType, iTeam, iPlayer, bAnnounce = argsList
[B]MyModule.xpNorm(iTechType)[/B]
def xpNorm(eTechType):
if eTechType == 10:
if PyPlayer(0).isAlive():
PyPlayer(0).initUnit(18, 49, 56, 1)
def xpNorm(eTechType, ePlayer):
if eTechType == 10:
player = PyPlayer(ePlayer)
if player.isAlive():
iX, iY = tSpawn[ePlayer]
player.initUnit(18, iX, iY, 1)
tSpawn = (
(23, 45),
(45, 34),
(67, 85),
...
)
#generates Christian missionaries for certain civs every time theology is acquired
def xpNorm(eTechType):
if eTechType == 10:
if PyPlayer(0).isAlive():
PyPlayer(0).initUnit(18, 49, 56, 1)
if PyPlayer(5).isAlive():
PyPlayer(5).initUnit(18, 67, 42, 1)
if PyPlayer(7).isAlive():
if isDate(-770):
PyPlayer(7).initUnit(18, 60, 44, 1)
if PyPlayer(10).isAlive():
PyPlayer(10).initUnit(18, 68, 23, 1)
if PyPlayer(12).isAlive():
if isDate(400):
PyPlayer(12).initUnit(18, 54, 54, 1)
if PyPlayer(13).isAlive():
if isDate(450):
PyPlayer(13).initUnit(18, 55, 50, 1)
if PyPlayer(14).isAlive():
if isDate(475):
PyPlayer(14).initUnit(18, 52, 43, 1)
if PyPlayer(15).isAlive():
if isDate(843):
PyPlayer(15).initUnit(18, 63, 52, 1)
if PyPlayer(16).isAlive():
if isDate(1000):
PyPlayer(16).initUnit(18, 71, 54, 1)
#generates Islamic missionaries for certain civs every time divine right is acquired
def islamNorm(eTechType):
if eTechType == 14:
if PyPlayer(1).isAlive():
PyPlayer(1).initUnit(19, 68, 32, 1)
if PyPlayer(2).isAlive():
PyPlayer(1).initUnit(19, 77, 40, 1)
if PyPlayer(8).isAlive():
if isDate(-625):
PyPlayer(8).initUnit(19, 81, 40, 1)
if PyPlayer(11).isAlive():
if isDate(700):
PyPlayer(11).initUnit(19, 75, 33, 1)
if PyPlayer(2).isAlive():
PyPlayer([COLOR="Red"]1[/COLOR]).initUnit(19, 77, 40, 1)
def isInterval(iDate1=None, iDate2=None):
if iDate1 == None:
iDate1 = cyGame.getStartingYear()
if iDate2 == None:
iDate2 = gc.getTurnYear(gc.getMaxTurns())
return iDate1 <= gc.getGameTurnYear() <= iDate2
isInterval(500)
isInterval(0, 1000)
isInterval(None, 450)
isInterval(451, None)
isInterval(iDate2=-2000)
isInterval(iDate1=1450)
isInterval()
pyRome, pyCeltia, pyIndia, pyCarthage, pyGreece = (PyPlayer(ePlayer) for ePlayer in range(5))
pyRome = PyPlayer(0)
pyCeltia = PyPlayer(1)
pyIndia = PyPlayer(2)
pyCarthage = PyPlayer(3)
pyGreece = PyPlayer(4)
isTurnYearBefore(year):
return gc.getGameTurnYear() < year
isTurnYearAfter(year):
return gc.getGameTurnYear() > year
isTurnYearBetween(firstYear, secondYear):
currentYear = gc.getGameTurnYear()
return currentYear > firstYear and currentYear < secondYear
Good advice overall, and the helper functions should come handy for this project also.Overloading a function to make it take different default values can be helpful, but don't overdo it. There are only three cases you'll need to check usually: is the current date before a year, after a year, or between two years. Also, it helps to put TurnYear into the name because interval by itself can mean so many things.