Garry's Mod Wiki


NPC:SetLastPosition( Vector Position )


Sets the last registered or memorized position for an npc. When using scheduling, the NPC will focus on navigating to the last position via nodes.

The navigation requires ground nodes to function properly, otherwise the NPC could only navigate in a small area. (


1 Vector Position
Where the NPC's last position will be set.


Make an NPC chase a player

function NPCGoGoRun(npc, ply) npc:SetLastPosition( ply:GetPos() ) npc:SetSchedule( SCHED_FORCED_GO_RUN ) end
Output: The NPC will chase the player.

Page Links

Special Pages



Render Time: 79ms

DB GetPage 52
Generate Html 4
SaveChanges (1) 9
Render Body 0
Render Sidebar 11