Revision Difference
NPC:NavSetGoalTarget#546762
<function name="NavSetGoalTarget" parent="NPC" type="classfunc">
<description>Set the goal target for an NPC.</description>
<realm>Server</realm>
<args>
<arg name="target" type="Entity">The targeted entity to set the goal to. This can be NULL.</arg>
<arg name="offset" type="Vector">The offset to apply to the targeted entity's position.</arg>
</args>
<rets>
<ret type="boolean">Whether path generation was successful or not</ret>
</rets>
</function>
⤶
⤶
<example>⤶
<description>Example usage of this function.</description>⤶
<code>⤶
function NPC:MoveToPos( pos, run )⤶
⤶
self:SetSaveValue( "m_vecLastPosition", pos )⤶
self:NavSetGoalTarget( nil, pos )⤶
⤶
if ( run ) then⤶
self:SetSchedule( SCHED_FORCED_GO_RUN )⤶
else⤶
self:SetSchedule( SCHED_FORCED_GO )⤶
end⤶
end⤶
</code>⤶
</example>