This update changes pathfinding so that it occurs through a navigation mesh built automatically from the level geometry. At present, the algorithm requires all reachable sectors to be convex polygons, though it tends to work even if they're not. In order to enable pathfinding, inherit an actor from Pathfinder. In addition to a 'See' state, it must also have a 'See.Plan' state. Then add these two action functions:
A_Chase2(StateLabel meleeState = 'Melee', StateLabel rangedState = 'Missile', StateLabel planState = 'See.Plan')Makes the monster chase its target as long as they are in the same sector, or it has an up-to-date path to its target. Goes in the 'See' state.
Params:
- meleeState: The state to jump to when the monster decides to perform a melee attack.
- rangedState: The state to jump to when the monster decides to perform a ranged attack.
- planState: The state to jump to when the monster doesn't have a path to follow.
A_Star(StateLabel meleeState = 'Melee', StateLabel rangedState = 'Missile', StateLabel seeState = 'See')Creates a plan to reach the target, or waits if it's unreachable. Goes in the 'See.Plan' state.
Params:
- meleeState: The state to jump to when the monster decides to perform a melee attack.
- rangedState: The state to jump to when the monster decides to perform a ranged attack.
- seeState: The state to jump to when the monster finds a path.
Download