Garry's Mod Wiki

ENTITY:TranslateNavGoal

  Vector ENTITY:TranslateNavGoal( NPC or Entity target = GetEnemy() or m_hGoalEnt, Vector currentGoal = GetEnemyLastKnownPos() or m_hGoalEnt:GetPos() )

Description

Called by the engine to alter NPC's final position to reach its enemy or target. This is called twice for GOALTYPE_PATHCORNER; first is for the first path_corner and second for the next connected path_corner.

This hook only exists for ai type SENTs.

Arguments

1 NPC or Entity target = GetEnemy() or m_hGoalEnt
The enemy being chased or the path_corner in query.
2 Vector currentGoal = GetEnemyLastKnownPos() or m_hGoalEnt:GetPos()
The target's origin.

Returns

1 Vector
The actual point that NPC will move to reach its enemy or target. For the path to get updated, the new move path must be away from the current NPC:GetGoalPos by 120 units.

Not returning anything, or returning a non vector will perform the default action.