So I have this code from Orion immigration mod, that makes an immigrant cost two pop. to build:
What I would like is to expand this to do 2 extra things.
1. Make all Units cost 1 pop to build.
2. Have a list of exempted units that do not cost any pop to build preferably using UNITCOMBAT_ROBOT(which would be less of a list)
Then I need to adapt this next bit of code to stop a city building 'pop cost' units if it is below a certain pop. value say 3. This bit will be a bit more difficult because it is written in an immigaration specific bit of code, so I would also need to know where to place the modded code to get it working, i.e. under what callback.
I still don't speak codese, so please, please provide me with the actual complete code
Thanks in advance guys!
Spoiler :
Code:
def onUnitBuilt(self, argsList):
pCity = argsList[0]
unit = argsList[1]
if (AutologOpt.isLogBuildCompleted()):
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 = pCity.getOwner()
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 = pCity.getPopulation() - 2
pCity.setPopulation(ReducedCityPopulation)
if intCity != -1:
MigrationCity = pPlayer.getCity(intCity)
Immigration.doImmigrantPlacementAI(unit, MigrationCity)
# End Immigration Mod
What I would like is to expand this to do 2 extra things.
1. Make all Units cost 1 pop to build.
2. Have a list of exempted units that do not cost any pop to build preferably using UNITCOMBAT_ROBOT(which would be less of a list)
Then I need to adapt this next bit of code to stop a city building 'pop cost' units if it is below a certain pop. value say 3. This bit will be a bit more difficult because it is written in an immigaration specific bit of code, so I would also need to know where to place the modded code to get it working, i.e. under what callback.
Spoiler :
Code:
def cityCanTrainImmigrant(pCity):
# Orion's Immigration Mod
iOwner = pCity.getOwner()
pPlayer = gc.getPlayer(iOwner)
ImmigrantTech = gc.getInfoTypeForString("TECH_SAFE_HAVEN")
# Does the Player have the required Tech
if gc.getTeam(pPlayer.getTeam()).isHasTech(ImmigrantTech):
# Does the city have a Population of at least 10
if pCity.getPopulation() > 9:
#CyInterface().addImmediateMessage("Can Train Immigrant", "")
return True
return False
# Orion's Immigration Mod
I still don't speak codese, so please, please provide me with the actual complete code
Thanks in advance guys!