PathFollower:Compute
Description
Compute shortest path from bot to 'goal' via A* algorithm.
Arguments
1 NextBot bot
The nextbot we're generating for. This can also be a nextbot player (player.CreateNextbot).
3 function generator = nil
A funtion that allows you to alter the path generation. See example below for the default function.
Function callback arguments are:
- CNavArea area - The area to move to.
- CNavArea fromArea - The area to move from.
- CNavLadder ladder - The ladder to move to or from (Validation required), if any.
- Entity elevator - Will probably be always NULL
- number length - Precomputed length between
area
andfromArea
.
Function callback return values are:
- number cost - The cost of movement between
area
andfromArea
.
Returns
1 boolean
- If returns true, path was found to the goal position.
- If returns false, path may either be invalid (use IsValid() to check), or valid but doesn't reach all the way to the goal.
Example
The default path generator. You do not have to provide the PathFollower.Compute
any generator functions if you want to use the default generator.