transports vs pushMoveToMission

primordial stew

Emperor
Joined
Sep 1, 2005
Messages
1,219
Location
a puddle
I'm trying to move an invasion force to a specific plot. The escorts and other ships obey the order, but the transports just sit there :cry: How to get them moving??

Code:
   def AI_unitUpdate(self,argsList):
          pUnit = argsList[0]
          iHannibal = gc.getInfoTypeForString("UNIT_CARTHAGINIAN_HERO1")
          iType = pUnit.getUnitType()
          name = pUnit.getNameNoDesc()
          # CvUtil.pyPrint('checking %s ' %(name) )
          if (iType == iHannibal or name == "Exercitus Hannibal" ):
		  <snip>
	  elif (name == "Gothic raiders") :
		  pGoth = gc.getPlayer(39)
		  self.scriptData = pickle.loads(pGoth.getScriptData())
		  index = self.scriptData['index']
		  list = self.scriptData['objectiveList']
		  try:
		        currentObjective = list[index]
		  except:
			return False
                  xy = currentObjective.split(",") ; x = int(xy[0]) ; y = int(xy[1])
		  if ( pUnit.getX() == x and pUnit.getY() == y ):
			pUnit.setName("Gothic  raiders")
			return True
		  else:
                        pGroup = pUnit.getGroup()
                        pFirstPlot = pGroup.getPathFirstPlot()
			nextX = pFirstPlot.getX()
			nextY = pFirstPlot.getY()
			unitX = pUnit.getX()
			unitY = pUnit.getY()
			CvUtil.pyPrint('gothic seaborne invaders: nextX = %s   nextY = %s   current X = %s  currentY = %s' %(nextX,nextY,unitX,unitY) )
			if ( nextX == unitX and nextY == unitY ): 
                            CvUtil.pyPrint('No path to desination?? %s' %(currentObjective) )
                            ## RuntimeError: unidentifiable C++ exception  ???
    	                    return False

			else:
                            CvUtil.pyPrint('group size = %s   name = %s  To %s please. ' %(pGroup.getNumUnits(),name,currentObjective) )
                            pGroup.clearMissionQueue()
                            pGroup.pushMoveToMission(x,y)
                            pUnit.finishMoves()
    	                    return True
          else :
                  return False


The invading force is created with:
Code:
          iRand = self.getRand(1)
	  for i in range(0,iRand+2):
	      self.slaveUnitName = "Gothic raiders"
	      self.nextUnitPromotions = ["PROMOTION_NAVIGATION1"]
	      pPlayer.initUnit(self.iGalleyID, iX, iY, UnitAITypes.UNITAI_ASSAULT_SEA)
	      self.slaveUnitName = "Gothic raiders"
	      self.nextUnitPromotions = ["PROMOTION_NAVIGATION1"]
	      pPlayer.initUnit(self.iSummaID, iX, iY, UnitAITypes.UNITAI_ESCORT_SEA)
	      pPlayer.initUnit(self.iTribusGermanicaID, iX, iY, UnitAITypes.UNITAI_ATTACK)
	      pPlayer.initUnit(self.iGothBerserkID, iX, iY, UnitAITypes.UNITAI_ATTACK)
	      pPlayer.initUnit(self.iGothBerserkID, iX, iY, UnitAITypes.UNITAI_ATTACK)

	  pPlayer.initUnit(self.iSummaID, iX, iY, UnitAITypes.UNITAI_PILLAGE)
	  pPlayer.initUnit(self.iSummaID, iX, iY, UnitAITypes.UNITAI_PILLAGE)
	  self.nextUnitPromotions = ["PROMOTION_NAVIGATION1"]
	  pPlayer.initUnit(self.iSummaID, iX, iY, UnitAITypes.UNITAI_ATTACK_SEA)
	  self.slaveUnitName = "Gothic raiders"
	  self.nextUnitPromotions = ["PROMOTION_NAVIGATION1"]
	  pPlayer.initUnit(self.iSummaID, iX, iY, UnitAITypes.UNITAI_ATTACK_SEA)

The land units do get loaded in the transports, but I've also tried without creating them and it didn't make a difference.
 
Top Bottom