- Sets the NPC's goal to the player's location at the time of calculation.
WANDER <int|min_dist * 10000 + int|max_dist>
- Pick a random location for a goal. The parameter is complex because it is actually two values forced into one.
- Various hostile-related goal selection tasks.
- Basic movement tasks.
WITHIN_DISTare useful when the target itself isn't accessible, e.g. is an entity's origin.
- Run this many units. Won't set a goal though, so use it in conjunction with another task.
- Wait this many seconds, then move.
- Bug: Seems to be broken.
- Move to pick up a weapon or item; fail if it is picked up or otherwise removed.
- For scripted movement.
- Move within weapons range. Identical, except that one uses a goal while the other uses a target entity.
- Wait this long for any ongoing movement to complete (pass
0to wait forever if necessary). A very common task.
- Same as above, but fails if the goal is a cover location which a hostile has LOS to.
- Tip: Given the name, Valve presumably intended this task to handle all sorts of "mid-stride" fails that didn't make good interrupts. This makes it a good place to add your own!
- Maximum time to spend building a route. The schedule will fail if it is overrun. Remember that different CPU speeds will give different results - don't use it except as a fail-safe.
- Like, duh.
SetTarget( CBaseEntity )
- The NPC's target is the entity it is acting upon - moving towards, looking at, shooting at, etc. Theoretically, multiple targets can be acted upon in the same frame by changing this value over the course of execution.
CAI_Navigator instance, which defines the core movement functions.
SetGoal(const AI_NavGoal_t &goal, unsigned int flags = 0)
- The standard function for telling an NPC where it should head to when next given the command to move. Can be called with only a vector thanks to an
SetDirectGoal( vector &goalPos, Navigation_t navType = <npc default> )
- Bypasses much of
SetGoal's code. Purpose is unclear.
SetArrivalDirection( vector || qangle || CBaseEntity )
- The direction to face on arrival at the task goal. The NPC will probably begin turning shortly before arrival.
- Tip: If a
CBaseEntityis passed the NPC will turn to look at it. To use an entity's angles themselves, call
StopMoving( bool bImmediate )
bImmediatedoesn't seem to have any effect on walking NPCs - they stop immediately either way.
Combat movement functions.