How to calculate if a unit can reach a specific plot?

Paolo80

Chieftain
Joined
Dec 20, 2019
Messages
85
Hy guys,

I want a unit to reach a specific variable plot where there is another specific unit.

I want this unit to use CyGroup().pushMission if it can't reach the final plot in one turn and CyUnit.setXY if it can reach the plot in one turn.

I used CyMap().calculatePathDistance(unitPlot, targetPlot) to calculate the distance between the unit plot and the plot to reach. It returns a value. I tried to compare it with the value from CyUnit.getMoves(), but this function returns 120, not the distance in plot, it doesn't match to iMoves in CIV4UnitInfos.xml

How can I do to compare the distance between two plots and the distance the unit can travel?
 
Last edited:
Top Bottom