strategyonly
C2C Supreme Commander
OK now CvMainInterface.py and the art files should be good. What repeatable error are you referring to?
For some reason now, it CTD's


Plus like i said, still no Join City etc.
OK now CvMainInterface.py and the art files should be good. What repeatable error are you referring to?
For some reason now, it CTD'sThis is exactly what happend when i tried to make this mod also, its just something i nor anyone else could figure out what is going on
Plus like i said, still no Join City etc.
I have a Join City in my Capture slaves.
However, if it is the immigration mod, then you likely have an XML error somewhere where you have merged the mod.
1. Make sure you have installed the BTS 3.19 patch for Civ4.
2. Make sure you have merged the CvMainInterface.py properly, including the import at the top of the file.
OK. Check the following folder:
Code:Modules\OrionsMods\Immigration\Art\Interface\Buttons\Units
Make sure these files are placed in that folder:
Immigrant.dds
JoinCity.dds
ive checked it out
but still no button to join city
moreover when i select the unit, the game seems slightly laggy![]()
## Sid Meier's Civilization 4
## Copyright Firaxis Games 2005
from CvPythonExtensions import *
import CvUtil
import ScreenInput
import CvScreenEnums
import CvEventInterface
import time
[COLOR="Red"]import Immigration[/COLOR]
# Immigration Mod
# ##### Join City Button ######
pUnit = g_pSelectedUnit
iUnitType = pUnit.getUnitType()
iUnitOwner = pUnit.getOwner( )
pUnitOwner = gc.getPlayer(iUnitOwner)
if pUnitOwner.isTurnActive( ):
if gc.getMap().plot(pUnit.getX(), pUnit.getY() ).isCity():
if iUnitType == gc.getInfoTypeForString("UNIT_IMMIGRANT"):
if Immigration.showJoinCityButton(pUnit):
screen.appendMultiListButton( "BottomButtonContainer", ArtFileMgr.getInterfaceArtInfo("INTERFACE_JOIN_CITY").getPath(), 0, WidgetTypes.WIDGET_GENERAL, 680, 680, False )
screen.show("BottomButtonContainer")
iCount = iCount + 1
return
# End Immigration Mod
elif (CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_HIDE_ALL and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_MINIMAP_ONLY):
self.setMinimapButtonVisibility(True)
return 0
def handleInput (self, inputClass):
# Immigration Mod
if (inputClass.getNotifyCode() == 11 and inputClass.getData1() == 680 and inputClass.getData2() == 680):
self.pPushedButtonUnit = g_pSelectedUnit
iOwner = g_pSelectedUnit.getOwner()
iUnitID = g_pSelectedUnit.getID()
pPlayer = gc.getPlayer(iOwner)
pUnit = pPlayer.getUnit(iUnitID)
Immigration.doJoinCity(pUnit)
CyInterface().setDirty(InterfaceDirtyBits.SelectionButtons_DIRTY_BIT, True)
# End Immigration Mod
<!-- Orion's Immigration Mod -->
<InterfaceArtInfo>
<Type>INTERFACE_JOIN_CITY</Type>
<Path>Art/Interface/Buttons/Units/JoinCity.dds</Path>
</InterfaceArtInfo>
<!-- Orion's Immigration Mod -->
# call handle input on that screen
if ( screen and not ret):
[B]return screen.handleInput(inputClass)[/B]
return 0
# Immigration Mod
if (inputClass.getNotifyCode() == 11 and inputClass.getData1() == 680 and inputClass.getData2() == 680):
self.pPushedButtonUnit = g_pSelectedUnit
iOwner = g_pSelectedUnit.getOwner()
iUnitID = g_pSelectedUnit.getID()
pPlayer = gc.getPlayer(iOwner)
pUnit = pPlayer.getUnit(iUnitID)
[B][B]Immigration.doJoinCity(pUnit)[/B][/B]
CyInterface().setDirty(InterfaceDirtyBits.SelectionButtons_DIRTY_BIT, True)
# End Immigration Mod
def doJoinCity(pUnit):
# Orion's Immigration Mod
iOwner = pUnit.getOwner()
pPlayer = gc.getPlayer(iOwner)
iPlotX = pUnit.getX()
iPlotY = pUnit.getY()
pPlot = CyMap( ).plot( pUnit.getX( ), pUnit.getY( ) )
pCity = pPlot.getPlotCity()
[B]NewCityPopulation = pCity.getPopulation() + 1[/B]
Got this error when an immigrant tried to join a city?
Traceback (most recent call last):
File "CvScreensInterface", line 950, in handleInput
Spoiler :Code:# call handle input on that screen if ( screen and not ret): [B]return screen.handleInput(inputClass)[/B] return 0
File "CvMainInterface", line 6384, in handleInput
Spoiler :Code:# Immigration Mod if (inputClass.getNotifyCode() == 11 and inputClass.getData1() == 680 and inputClass.getData2() == 680): self.pPushedButtonUnit = g_pSelectedUnit iOwner = g_pSelectedUnit.getOwner() iUnitID = g_pSelectedUnit.getID() pPlayer = gc.getPlayer(iOwner) pUnit = pPlayer.getUnit(iUnitID) [B][B]Immigration.doJoinCity(pUnit)[/B][/B] CyInterface().setDirty(InterfaceDirtyBits.SelectionButtons_DIRTY_BIT, True) # End Immigration Mod
File "Immigration", line 58, in doJoinCity
AttributeError: 'NoneType' object has no attribute 'getPopulation'
ERR: Python function handleInput failed, module CvScreensInterface
Spoiler :Code:def doJoinCity(pUnit): # Orion's Immigration Mod iOwner = pUnit.getOwner() pPlayer = gc.getPlayer(iOwner) iPlotX = pUnit.getX() iPlotY = pUnit.getY() pPlot = CyMap( ).plot( pUnit.getX( ), pUnit.getY( ) ) pCity = pPlot.getPlotCity() [B]NewCityPopulation = pCity.getPopulation() + 1[/B]
You must specify the file where the getPopulation function runs, which is: PyHelpers
You need to add the following line at the top of your Immigration.py file:
import PyHelpers
Its already there?
OK i have got it working ??? Wellbut i think it is mistakenly taking the immigrant as a settler? see pic
<UnitAIs>
<UnitAI>
<UnitAIType>UNITAI_SETTLE</UnitAIType>
<bUnitAI>1</bUnitAI>
</UnitAI>
</UnitAIs>
I'm trying to merge this with RFCMarathon, and it looks good for the most part, but I don't think the cityCanTrainImmigrant function in Immigration.py is working properly... For some reason, cities of any size can train them, resulting in cities with 0 and negative populations XD
Any advice?
<Define>
<DefineName>USE_CAN_TRAIN_CALLBACK</DefineName>
<iDefineIntVal>1</iDefineIntVal>
</Define>
Unit stuck in loop: Immigrant(Zara Yaqob)[105, 38] (settle)
def doImmigrantPlacementAI(pUnit, pCity):
# Orion's Immigration Mod
iOwner = pUnit.getOwner()
pPlayer = gc.getPlayer(iOwner)
MyPopulation = pCity.getPopulation()
if MyPopulation > 0 and MyPopulation < 7:
if pUnit.getX() != pCity.getX() or pUnit.getY() != pCity.getY():
pUnit.getGroup().pushMission(MissionTypes.MISSION_MOVE_TO, pCity.getX(), pCity.getY(), 0, False, True, MissionAITypes.NO_MISSIONAI, pUnit.plot(), pUnit)
#CyInterface().addImmediateMessage("Push Immigrant", "")
else:
#CyInterface().addImmediateMessage("Do Join City", "")
doJoinCityAI(pUnit)
# Orion's Immigration Mod
Hi,
I´ve merged this great component into my mod and it seems to work great. Since we use this mod in multiplayer and we had some OOS I had to check the MPLog. There I´ve found several entries like this for the AI-Player:
Code:Unit stuck in loop: Immigrant(Zara Yaqob)[105, 38] (settle)
The numbers are coordinates of the cities of the AI.
I´m pretty sure that this is not causing the problem with the OOS (I´m using ModNetMessages for humans and AI works well without) but perhaps some other problems. Is there any way to find the code which is causing the loop? Or is this maybe just the following one, where he doesn´t find any city to join, because there are no cities with less than 7 population?
Code:def doImmigrantPlacementAI(pUnit, pCity): # Orion's Immigration Mod iOwner = pUnit.getOwner() pPlayer = gc.getPlayer(iOwner) MyPopulation = pCity.getPopulation() if MyPopulation > 0 and MyPopulation < 7: if pUnit.getX() != pCity.getX() or pUnit.getY() != pCity.getY(): pUnit.getGroup().pushMission(MissionTypes.MISSION_MOVE_TO, pCity.getX(), pCity.getY(), 0, False, True, MissionAITypes.NO_MISSIONAI, pUnit.plot(), pUnit) #CyInterface().addImmediateMessage("Push Immigrant", "") else: #CyInterface().addImmediateMessage("Do Join City", "") doJoinCityAI(pUnit) # Orion's Immigration Mod
def doImmigrantPlacementAI(pImmigrantUnit):
# Orion's Immigration Mod
iOwner = pImmigrantUnit.getOwner()
pPlayer = gc.getPlayer(iOwner)
intCity = getLeastPopulatedCity(iOwner)
pMigrationCity = pPlayer.getCity(intCity)
#pMigrationCityPlot = CyMap().plot(pMigrationCity.getX(), pMigrationCity.getY())
bMoveOK = False
if (pMigrationCity.getPopulation() < 7):
if pImmigrantUnit.generatePath(pMigrationCity.plot(), 0, False, None):
bMoveOK = True
if pImmigrantUnit.getX() != pMigrationCity.getX() or pImmigrantUnit.getY() != pMigrationCity.getY():
pImmigrantUnit.getGroup().pushMission(MissionTypes.MISSION_MOVE_TO, pMigrationCity.getX(), pMigrationCity.getY(), 0, False, True, MissionAITypes.NO_MISSIONAI, pImmigrantUnit.plot(), pImmigrantUnit)
elif pImmigrantUnit.getX() == pMigrationCity.getX() and pImmigrantUnit.getY() == pMigrationCity.getY():
doJoinCity(pImmigrantUnit)
if not bMoveOK:
pImmigrantUnit.finishMoves()
# Orion's Immigration Mod