Garry's Mod Wiki

Revision Difference

NPC:NavSetWanderGoal#527685

<function name="NavSetWanderGoal" parent="NPC" type="classfunc"> <description>Sets a goal in x, y offsets for the NPC to wander to</description> <realm>Server</realm> <args> <arg name="xoffset" type="number">X offset</arg> <arg name="yoffset" type="number">Y offset</arg> <arg name="xOffset" type="number">X offset</arg> <arg name="yOffset" type="number">Y offset</arg> </args> </function> <example> <description>Given an npc makes them wander to a location 100 units in both the x and y directions</description> <description>Given an NPC makes them wander to a location 100 units in both the x and y directions</description> <code> if npc:IsValid() then npc:NavSetWanderGoal(100, 100) npc:SetSchedule(SCHED_IDLE_WANDER) if IsValid( npc ) then npc:NavSetWanderGoal( 100, 100 ) npc:SetSchedule( SCHED_IDLE_WANDER ) end </code> </example>