Since I expect frequent merges I don't want to sort them manually each time. I'll try to find some XML editor that allows to sort certain items alphabetically.
iNumUnits = pPlayer.getNumUnits
for i in range iNumUnits:
PUnit = pPlayer.getUnit(i)
if pUnit.getUnitClassType() == gc.getInfoTypeForString("UNITCLASS_GALLEY") or pUnit.getUnitClassType() == gc.getInfoTypeForString("UNITCLASS_TRIREME"):
iX = pUnit.getX()
iY = pUnitX.getY()
pPlot = CyMap().plot(iX(),iY())
if pPlot.getTerrainType() == gc.getInfoTypeForString("TERRAIN_OCEAN"):
iChance = 50
elif pPlot.getTerrainType() == gc.getInfoTypeForString("TERRAIN_COAST"):
iChance = 1
elif pPlot.getTerrainType() == gc.getInfoTypeForString("TERRAIN_TIEFSEE"):
iChance = 80
self.iUntergang = self.getRandomNumber( 100 )
if iChance > self.iUntergang:
pUnit.kill(False,iPlayer)
rather thanCode:brackets, we have no way of discerning the all important indentation which could be incorrect and causing problems. Third, you keep using pUnit but never defined it, as this is a case sensitive language and you wrote PUnit instead. Fourth, we need to know where you want to put this code. I think it should probably work in either onBeginPlayerTurn or onEndPlayerTurn in CvEventManager.py, but there may be much better ways to implement it. @Chadwick I don't know much about altering the AI, but I do know that changing the minimum required distance between cities (which applies to the AI as well as human players) is one of the simplest possible changes. Just edit this one number in GlobalDefines.xml: [code] <Define> <DefineName>MIN_CITY_RANGE</DefineName> <iDefineIntVal>[B]2[/B]</iDefineIntVal> </Define>
<Define>
<DefineName>MIN_CITY_RANGE</DefineName>
<iDefineIntVal>(Whatever number is the default)</iDefineIntVal>
</Define>
(NOTE: THIS PROBABLY REQURES SOME C++ PROGRAMMING)
For my mod, I am trying to have a promotion (I will release the version of my mod with this promotion tomorrow) called Counter Sniper that reveals all Sniper units to units with the promotion when a Sniper is in that unit's visible range. Anyone who wants to do this can go to the thread for my mod (look in my sig and click the Special Forces link)