Custom movement pathfinding

Description

A script which calculates A* priority pathfinding, based on custom pre-defined movement.

In short...

This script allows you to define the possible movements for each AI and let the pathfinding calculate the shortest route from given start to given goal. The function will return a delta queue, which can optionally be converted into a path.

Note: Defined movement has to be mirrorable!

How it works

You define the positions an AI is allowed to move to in the form of deltas. For example:

{1, 0}
{-1, 0}

The example above would allow the AI to move horizontally only (one tile at a time).

Using this method allows you to set up a variety of movement restrictions and/or new possibilities, which is impossible to implement using the built-in movement scripts.

Only one script call is required to calculate the path!

When do you need this?

This script is useful if your game is tile-based, but the AI doesn't always move 1 tile per turn, or has specific patterns (such as 2 to the left followed by 1 downwards, etc.).

Note that this script is a bit slower than the built-in functionality. Try to prevent constant pathing calculation!