Garry's Mod Wiki

NPC:NavSetWanderGoal

  boolean NPC:NavSetWanderGoal( number xOffset, number yOffset )

Description

Sets a goal in x, y offsets for the NPC to wander to

Arguments

1 number xOffset
X offset
2 number yOffset
Y offset

Returns

1 boolean
Whether path generation was successful or not

Example

Given an NPC makes them wander to a location 100 units in both the x and y directions

if IsValid( npc ) then npc:NavSetWanderGoal( 100, 100 ) npc:SetSchedule( SCHED_IDLE_WANDER ) end