Hi,
I am trying to give a new unit on every second turn of the player turn. I have the following code
But however the new unit doesn't go into fortify mode. I would like to know if this is possible. I am assuming the UNITAI_CITY_DEFENSE is fortify. Other thing is as per the python API - unit type Mechanized Infantry is 37 but it seems to make a marine unit. Any ideas on why this could be happening.
Thanks
I am trying to give a new unit on every second turn of the player turn. I have the following code
Code:
def checkPlayerTurnEvents(self, iGameTurn, iPlayer):
'Check for events on every turn and give a unit on on the 10 turns'
print "Called checkPlayerTurnEvents"
if(iGameTurn % 2 == 0):
popup = PyPopup.PyPopup()
popup.setHeaderString("NEW UNIT")
popup.setBodyString("New unit Mechanized Infantry created")
popup.launch()
player = gc.getPlayer(iPlayer)
city = player.getCapitalCity()
print city.getName()
self.makeUnit(37, iPlayer, city.plot())
def makeUnit( self, iUnit, iPlayer, plot):
print plot
print iPlayer
print iUnit
player = gc.getPlayer(iPlayer)
unit = player.initUnit(iUnit, plot.getX(), plot.getY(), UnitAITypes.UNITAI_CITY_DEFENSE)
return unit
But however the new unit doesn't go into fortify mode. I would like to know if this is possible. I am assuming the UNITAI_CITY_DEFENSE is fortify. Other thing is as per the python API - unit type Mechanized Infantry is 37 but it seems to make a marine unit. Any ideas on why this could be happening.
Thanks