Constant Path for turn based /grid game

Would be possible to use Constant path (the one seen in exaple 8_ pathsTypes) for grid/turn based game such as Xcom or Heroes ?
The Idea is when you select a character, it will display a grids/squares around that character showing where and how far it can go, of course I d like to have a character stop walking once it reaches its max search distance …
and character should only able to move to the mouse click point, only if it is inside its Max search distance.

and depending on a class i d like to set diferent max search distances for diferent characters, so some
of them could walk further…

is this a way to go? or something do-able ? or is there a better way ?

thanks in advance for all your help

Beri

That is indeed possible. If you query a constantpath like in the example scene, you could show the range, you could then only allow the player to click on squares/nodes which the constantpath found in the search. This could be done by looping through all found nodes and checking for the closest one, it is clicked on if it is within some small distance from where the mouse pointer ray actually hit the ground. Then you could simply path to that point which is guaranteed to be within the maximum search distance.

What you also could do is to use the XPath class and create a custom EndReachedDistance object. That is a bit more tricky however and does not give you all nodes it can reach as a byproduct (as the constantpath does), so the first approach is probably the best for you.

thank you, I was really thinking a lot if this could be done and what would be the best way :slight_smile: