KeeperOT7Keys
did nothing wrong
I am having a couple of problems with adding a new victory condition to an existing mod (history rewritten but I don't think this part is very important).
I want to add some kind of a double score victory, like if you are in digital age and your score is more than x2 of your closest opponent you win, or if you have x8 score in the ancient age.
but somehow my win condition triggers when everybody has the same score at turn 10~. I don't get what triggers the bug, here's my XML and python code:
another bigger problem is, somehow debug codes I have aren't working either, I have all logging and exception stuff open, but neither "interface.addmessage" nor plain "print" produce any output in the game or in the logs. any ideas what might be the cause?
I want to add some kind of a double score victory, like if you are in digital age and your score is more than x2 of your closest opponent you win, or if you have x8 score in the ancient age.
but somehow my win condition triggers when everybody has the same score at turn 10~. I don't get what triggers the bug, here's my XML and python code:
XML:
<VictoryInfo>
<Type>QUICK_DOMINATION</Type>
<Description>TXT_KEY_VICTORY_QUICK_DOMINATION</Description>
<Civilopedia>TXT_KEY_VICTORY_QUICK_DOMINATION_PEDIA</Civilopedia>
<bTargetScore>0</bTargetScore>
<bEndScore>0</bEndScore>
<bConquest>0</bConquest>
<bDiploVote>0</bDiploVote>
<bPermanent>1</bPermanent>
<iPopulationPercentLead>0</iPopulationPercentLead>
<iLandPercent>0</iLandPercent>
<iMinLandPercent>0</iMinLandPercent>
<iReligionPercent>0</iReligionPercent>
<CityCulture>NONE</CityCulture>
<iNumCultureCities>0</iNumCultureCities>
<iTotalCultureRatio>0</iTotalCultureRatio>
<iVictoryDelayTurns>0</iVictoryDelayTurns>
<VictoryMovie>ART_DEF_MOVIE_VICTORY_DOMINATION</VictoryMovie>
</VictoryInfo>
def onEndGameTurn(self, argsList):
...
if CyGame().isVictoryValid(gc.getInfoTypeForString('VICTORY_QUICK_DOMINATION')):
iPlayerHighestScore = -1
secondHighestScore = -1
highestScore = -1
for iPlayer in xrange(gc.getMAX_PLAYERS()):
pPlayer = gc.getPlayer(iPlayer)
if pPlayer.isAlive():
# this is how scores in board is calculated
iPopulationScore = CvUtil.getScoreComponent(pPlayer.getPopScore(), gc.getGame().getInitPopulation(), gc.getGame().getMaxPopulation(), gc.getDefineINT("SCORE_POPULATION_FACTOR"), True, False, False)
iLandScore = CvUtil.getScoreComponent(pPlayer.getLandScore(), gc.getGame().getInitLand(), gc.getGame().getMaxLand(), gc.getDefineINT("SCORE_LAND_FACTOR"), True, False, False)
iTechScore = CvUtil.getScoreComponent(pPlayer.getTechScore(), gc.getGame().getInitTech(), gc.getGame().getMaxTech(), gc.getDefineINT("SCORE_TECH_FACTOR"), True, False, False)
iWondersScore = CvUtil.getScoreComponent(pPlayer.getWondersScore(), gc.getGame().getInitWonders(), gc.getGame().getMaxWonders(), gc.getDefineINT("SCORE_WONDER_FACTOR"), False, False, False)
playerScore = iPopulationScore + iLandScore + iWondersScore + iTechScore
# compare scores
if playerScore > highestScore:
secondHighestScore = highestScore
highestScore = playerScore
iPlayerHighestScore = iPlayer
elif playerScore > secondHighestScore:
secondHighestScore = playerScore
era = gc.getPlayer(iPlayerHighestScore).getCurrentEra()
iFinalEra = CvUtil.findInfoTypeNum(gc.getEraInfo,gc.getNumEraInfos(),'ERA_DIGITAL')
if highestScore > (secondHighestScore * (iFinalEra-era+2)):
gc.getGame().setWinner(iPlayerHighestScore, 8)
another bigger problem is, somehow debug codes I have aren't working either, I have all logging and exception stuff open, but neither "interface.addmessage" nor plain "print" produce any output in the game or in the logs. any ideas what might be the cause?