Garry's Mod Wiki

NPC:MoveGroundStep

  number NPC:MoveGroundStep( Vector pos, Entity targetEntity = nil, number yaw = -1, boolean asFarAsCan = true, boolean testZ = true )

Recently Added

This was recently added in version (2025.09.03). It might only be available on the Dev Branch right now.

Description

Similar to other NPC:Move* functions, invokes internal code to move the NPC to a given location.

Meant to be used within ENTITY:OverrideMove.

Arguments

1 Vector pos
The position we want to reach.
2 Entity targetEntity = nil
Used to test whether we hit the move target when deciding success.
3 number yaw = -1
Target Yaw angle at the end of the move.
4 boolean asFarAsCan = true
Whether to move as far as possible.
5 boolean testZ = true
Also test the Z axis of the target position and NPC position to decide success.

Returns

1 number
Whether the movement succeeded or not.

AIMotorMoveResult_t enum:

  • AIM_FAILED = 0
  • AIM_SUCCESS = 1
  • AIM_PARTIAL_HIT_NPC = 2
  • AIM_PARTIAL_HIT_WORLD = 3
  • AIM_PARTIAL_HIT_TARGET = 4