def onUnitBuilt(self, argsList):
if (AutologOpt.isLogBuildCompleted()):
pCity = argsList[0]
unit = argsList[1]
if pCity.getOwner() == CyGame().getActivePlayer():
message = BugUtil.getText("TXT_KEY_AUTOLOG_FINISH_UNIT", (pCity.getName(), gc.getUnitInfo(unit.getUnitType()).getDescription()))
Logger.writeLog(message, vColor="Purple")
# Immigration Mod
iOwner = city.getOwner()
pPlayer = gc.getPlayer(iOwner)
UnitType = unit.getUnitType()
iImmigrant = gc.getInfoTypeForString("UNIT_IMMIGRANT")
intCity = Immigration.getLeastPopulatedCity(iOwner)
if UnitType == iImmigrant: [COLOR="Red"]'this seems to be the line it don't like'[/COLOR]
#CyInterface().addImmediateMessage("B", "")
if pPlayer.isAlive() and not pPlayer.isBarbarian():
ReducedCityPopulation = city.getPopulation() - 2
city.setPopulation(ReducedCityPopulation)
if intCity != -1:
MigrationCity = pPlayer.getCity(intCity)
Immigration.doImmigrantPlacementAI(unit, MigrationCity)
# End Immigration Mod
How do you assign starting units to a civ?
I thought it was the ifreeunits bit in the civinfo.xml, but in my file it only has settler there, and everyone also starts with a scout.. and when i try to add an extra unit, they still only have a settler and scout (this may be because the extra unit i add has a ibuild of -1, I don't know)
def onUnitBuilt(self, argsList):
if (AutologOpt.isLogBuildCompleted()):
pCity = argsList[0]
unit = argsList[1]
if pCity.getOwner() == CyGame().getActivePlayer():
message = BugUtil.getText("TXT_KEY_AUTOLOG_FINISH_UNIT", (pCity.getName(), gc.getUnitInfo(unit.getUnitType()).getDescription()))
Logger.writeLog(message, vColor="Purple")
# Immigration Mod
iOwner = city.getOwner() [COLOR="Red"]<--this is the line[/COLOR]
pPlayer = gc.getPlayer(iOwner)
UnitType = unit.getUnitType()
iImmigrant = gc.getInfoTypeForString("UNIT_IMMIGRANT")
intCity = Immigration.getLeastPopulatedCity(iOwner)
if UnitType == iImmigrant:
#CyInterface().addImmediateMessage("B", "")
if pPlayer.isAlive() and not pPlayer.isBarbarian():
ReducedCityPopulation = city.getPopulation() - 2
city.setPopulation(ReducedCityPopulation)
if intCity != -1:
MigrationCity = pPlayer.getCity(intCity)
Immigration.doImmigrantPlacementAI(unit, MigrationCity)
# End Immigration Mod
if (AutologOpt.isLogBuildCompleted()):
pCity = argsList[0]
unit = argsList[1]
pCity = argsList[0]
unit = argsList[1]
if (AutologOpt.isLogBuildCompleted()):