Garry's Mod Wiki

Garry's Mod Wiki

  NPC:SetLastPosition( Vector position )

Description

Sets the last registered or memorized position for this 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. (https://developer.valvesoftware.com/wiki/Info_node)

Arguments

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

Example

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.

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...