1212
NPC:AdvancePath

Garry's Mod Wiki

Garry's Mod Wiki

  NPC:AdvancePath()

Description

Advances the NPC on its path to the next waypoint.

Calling this on an NPC without any route will result in an instant crash.

Example

Make your scripted NPC advance to the next waypoint without exactly having to step on the node, making it advance when the NPC's hull is nearby.

function ENT:OverrideMode(flInterval) local vecCurWaypoint = self:GetCurWaypointPos() if !vecCurWaypoint:IsZero() then local threshold = self:BoundingRadius() or 1 local curDistance = self:GetPos():Distance(vecCurWaypoint) if curDistance < threshold then if !self:GetNextWaypointPos():IsZero() then self:AdvancePath() else self:ClearGoal() self:OnMovementComplete() end end end end

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...