maptool icon indicating copy to clipboard operation
maptool copied to clipboard

getAIPath(); getAIPathDistance() macro requests

Open aliasmask opened this issue 5 years ago • 2 comments

Is your feature request related to a problem? Please describe. When doing macros with token movement it's often the case you have to try to move a token first to get the path from point A to point B then cancel the movement then apply your own movement logic. There are cases where knowing a path before moving a token is useful or measuring the distance based on the AI pathing, ie with MBL and terrain mods.

Describe the solution you'd like Create 1 or 2 macros to handle AI paths and distance given point A and B.

Additional context I assume all the code for this is already implemented. It would just need to have macro access to it. As for function input/output I'll leave that up to you. It could be x1,y1,x2,y2 or an array of points [{x:0,y:0},{x:1,y:1}] or where A and B are passed as point objects getAIPath(A,B) where A = {x:0,y:0}... or all 3 since they differ in variable types.

So to not bog down the AI with long distance, perhaps have a hard distance limit and an option to specify max distance. afaik, distance should be the map distance, not pixel or grid.

I know it's the normal convention to return one value per macro call like the distance value, but I would be okay with a json object return for getAIPath : {"path":[...],"distance":0} to avoid having the calculate pathing twice with the path and distance with 2 different calls.

aliasmask avatar Nov 06 '20 03:11 aliasmask

Oh, related to this request, I was thinking to avoid a returning of object of objects for getAIPath perhaps have getPathDistance(arrayOfPoints). Basically, you can calculate the distance based on the path. This would also be useful because of getLastPath() return value can be passed to it. This I assume wouldn't be as plug'n play as the above request.

aliasmask avatar Nov 06 '20 03:11 aliasmask

+1, I have just encountered a desire to use getDistance for the shortest navigable distance. Use case: calculating volume levels for proximal sound sources that have intervening path blocking objects. i.e. I can hear the thing on the other side of the wall as if it is the distance around the corners, not the straight line distance to the object.

bubblobill avatar Sep 23 '22 09:09 bubblobill