Grey Fox said:
In the CvGameInterface or the CvGameUtils python files you can take over the AI movement during certain conditions.
What I would want to do is to give the unit a mission to go to a certain tile, and it will move towards that tile with as many of its movement points it can, taking the shortest route (both in distance and movement cost per tile considered). Is there a built in function I could use to make the unit do that?
Do you mean to make it go the amount of moves for one turn and then stop (i.e. Don't continue on)? Or just give the unit the order to move to a plot?
If it's the latter, just using pGroup.pushMoveToMission(x, y) should do it.
If it's the first, it's a bit more tricky. I belive at one point I did this:
1.) Use pGroup.generatePath (although I think it wants to take in a pointer to a *int as the last argument, which obviously python can't do, so you might have to make your own function that just returns the last variable. You could also write a wrapper for it to make sure you never forget to store the answer into your iPathTurns variable, but that shouldn't be too necessary
Edit: And now that I think about it, unecessary, since you'd have to remember to get the variable returned by the function anyway!)
2.) Push a moveto mission using the plot found in pGroup.getPathFirstPlot(). This will get you the first plot on the path found.
3.) Redo these two steps until you're as far as you want (for example, I used this to keep moving one step closer to an enemy until I was within 2 plots of them).