Bad Player
Deity
This code seems to do nothing!!! The idea is that tile (12,12) is triggered if a unit is on it at the start of a turn and it causes any units or improvements on tile (13,13) to be removed.
In Notepad++ my code isn't indented the same length as def onBeginGame but when I pasted here, it is. Can anyone work out what's going wrong with this code please???
Code:
def onBeginGameTurn(self, argsList):
'Called at the beginning of the end of each turn'
iGameTurn = argsList[0]
iOrthusTurn = 75
if not CyGame().isUnitClassMaxedOut(gc.getInfoTypeForString('UNITCLASS_ORTHUS'), 0):
if not CyGame().isOption(gc.getInfoTypeForString('GAMEOPTION_NO_ORTHUS')):
bOrthus = False
if CyGame().getGameSpeedType() == gc.getInfoTypeForString('GAMESPEED_QUICK'):
if iGameTurn >= iOrthusTurn / 3 * 2:
bOrthus = True
if CyGame().getGameSpeedType() == gc.getInfoTypeForString('GAMESPEED_NORMAL'):
if iGameTurn >= iOrthusTurn:
bOrthus = True
if CyGame().getGameSpeedType() == gc.getInfoTypeForString('GAMESPEED_EPIC'):
if iGameTurn >= iOrthusTurn * 3 / 2:
bOrthus = True
if CyGame().getGameSpeedType() == gc.getInfoTypeForString('GAMESPEED_MARATHON'):
if iGameTurn >= iOrthusTurn * 3:
bOrthus = True
if bOrthus:
iUnit = gc.getInfoTypeForString('UNIT_ORTHUS')
cf.addUnit(iUnit)
cf.addPopup(CyTranslator().getText("TXT_KEY_POPUP_ORTHUS_CREATION",()), str(gc.getUnitInfo(iUnit).getImage()))
#MY CODE STARTS HERE!#
pPlot = CyMap().plot(12,12)
if (pPlot.getNumUnits() > 0):
pPlot = CyMap().plot(13,13)
if gc.getImprovementInfo(pPlot.getImprovementType()).isPermanent() == False:
if pPlot.isWater() == False:
pPlot.setImprovementType(-1)
pPlot.setFeatureType(-1, -1)
pPlot.setBonusType(-1)
pPlot.setPlotType(PlotTypes.PLOT_OCEAN, True, True)
for i in range(pPlot.getNumUnits()):
pUnit = pPlot.getUnit(i)
if not pUnit.isHasPromotion(gc.getInfoTypeForString('PROMOTION_WATER_WALKING')):
if not pUnit.isHasPromotion(gc.getInfoTypeForString('PROMOTION_FLYING')):
pUnit.kill(False, PlayerTypes.NO_PLAYER)
if not CyGame().isOption(gc.getInfoTypeForString('GAMEOPTION_NO_PLOT_COUNTER')):
cf.doHellTerrain()
if CyGame().getWBMapScript():
sf.doTurn()
In Notepad++ my code isn't indented the same length as def onBeginGame but when I pasted here, it is. Can anyone work out what's going wrong with this code please???