pushOrder partially working

Bad Player

Deity
Joined
Oct 31, 2005
Messages
3,534
Location
(Bris)Vegas!
Hi, I'm making a FFH2 civilisation called Illians produce a project called SAMHAIN. The code forces it to be built even though the program doesn't believe that it should be allowed to be built (it is buildable at the start of the game by the Illians when I play as the Illians so I don't understand that problem either!).

The code sort of works meaning that the SAMHAIN project is the current build item for the Illians' capital city and the setProduction gives it all the hammers to finish the project (400 hammers) and makes the build bar full when I view it in worldbuilder. However, the city never finishes/completes the project and I don't know why!!?? :confused:

Code:
		for iPlayer in range(gc.getMAX_PLAYERS()):
			pTargetPlayer = gc.getPlayer(iPlayer)
			if pTargetPlayer.isAlive():		
				for pyCity in PyPlayer(iPlayer).getCityList():
					pTargetCity = pyCity.GetCy()
					if pTargetCity.isCapital():
						#if iGameTurn == 3:
							#cf.addUnit(gc.getInfoTypeForString('UNIT_HUNTER'))
							if not pTargetPlayer.isHuman():
								if pTargetPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_ILLIANS'):
									#if pTargetCity.canCreate(gc.getInfoTypeForString('PROJECT_SAMHAIN'), True, True):
										pTargetCity.pushOrder(OrderTypes.ORDER_CREATE, gc.getInfoTypeForString('PROJECT_SAMHAIN'), -1, False, False, False, True)
										pTargetCity.setProduction(400)
										return 1
 
Because "the program doesn't believe that it should be allowed to be built"... :rolleyes:

If you want it to be finished, try maybe chooseProduction in CyCity with the bool bFinish set to True.

As a side note, I don't see why you need to loop through all players if it is just for the Illians. Your check for them could be upped before you look for their Capital City (which can be found directly by pTargetPlayer.getCapitalCity()).
 
Top Bottom