NPC/SetLastPosition

From Garry's Mod
Jump to: navigation, search
 NPC:SetLastPosition( )

Contents

Description

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.

NOTE

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

Vector Position

Where the NPC's last position will be set.

Examples

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.
Personal tools
Navigation