Fabrysse
Charming-snake learner
Here is what I want to do :
I've tried 2 ways (with 1 + 2 = 3 tries).
First method is something like that (when I saw that it doesn't work, I erased it : I try here to give you the idea) :
Result : no python error, but there is not any city producing something !!
Second method is exactly (first try) :
Result : 2 cities are producing ManhattanProject, 1 is producing a Palace, all others product nothing !
Note that nobody was producing Manhattan Project or Palace before acquireCity()...
Second method again (second try) :
Result : several cities are producing Manhattan Project (about 50% of the cities), one is producing a Palace.
Note the same than previous.
PLEASE HEEEEEELP !!!!!
- Player1 is producting something in a city.
- At a turn, via python, Player2 acquires the city. Just before this, the city was producting something, and the progression was "some int"...
- If Player2 is Human, I want to put back the same production and the progression.
I've tried 2 ways (with 1 + 2 = 3 tries).
First method is something like that (when I saw that it doesn't work, I erased it : I try here to give you the idea) :
Code:
for pyCity in apCityList:
pCity = pyCity.GetCy()
#Get Production
if(pCity.isProductionUnit ()):
iProdUnit = pCity.getProductionUnit ()
iProdBuilding = -1
iProdProject = -1
iProgressProd = pCity.getProduction ()
elif(pCity.isProductionBuilding ()):
iProdUnit = -1
iProdBuilding = pCity.getProductionBuilding ()
iProdProject = -1
iProgressProd = pCity.getProduction ()
elif(pCity.isProductionBuilding ()):
iProdUnit = -1
iProdBuilding = -1
iProdProject = pCity.getProductionBuilding ()
iProgressProd = pCity.getProduction ()
else:
iProdUnit = gc.getInfoTypeForString ("UNIT_INFANTRY")
iProdBuilding = -1
iProdProject = -1
iProgressProd = 0
newPlayer.acquireCity( pCity, False, False )
#Here, I add some units in the city : not interesting here, so I cut.
#Set Production
pCity.chooseProduction (iProdUnit, iProdBuilding, iProdProject, False, True)
pCity.setProduction (iProgressProd)
Second method is exactly (first try) :
Code:
for pyCity in apCityList:
pCity = pyCity.GetCy()
#Get Production
lOrder = []
for iOrder in range (pCity.getOrderQueueLength() ):
lOrder.append(pCity.getOrderFromQueue(iOrder))
newPlayer.acquireCity( pCity, False, False )
#Here, I add some units in the city : not interesting here, so I cut.
#Set Production
if(len(lOrder) > 0):
for iOrder in range( len(lOrder) ):
pCity.pushOrder (lOrder[iOrder].eOrderType, lOrder[iOrder].iData1, lOrder[iOrder].iData2, lOrder[iOrder].bSave, False, True, True)
Note that nobody was producing Manhattan Project or Palace before acquireCity()...
Second method again (second try) :
Code:
for pyCity in apCityList:
pCity = pyCity.GetCy()
#Get Production
lOrder = []
if(pCity.getOrderFromQueue(0)):
lOrder.append(pCity.getOrderFromQueue(0))
elif(pCity.getOrderFromQueue(1)):
lOrder.append(pCity.getOrderFromQueue(1))
newPlayer.acquireCity( pCity, False, False )
#Here, I add some units in the city : not interesting here, so I cut.
#Set Production
if(len(lOrder) > 0):
for iOrder in range( len(lOrder) ):
pCity.pushOrder (lOrder[iOrder].eOrderType, lOrder[iOrder].iData1, lOrder[iOrder].iData2, lOrder[iOrder].bSave, True, True, True)
Note the same than previous.

PLEASE HEEEEEELP !!!!!