<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://g1r-mp.com/wiki/index.php?action=history&amp;feed=atom&amp;title=SetNpcMoveGoal</id>
	<title>SetNpcMoveGoal - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://g1r-mp.com/wiki/index.php?action=history&amp;feed=atom&amp;title=SetNpcMoveGoal"/>
	<link rel="alternate" type="text/html" href="https://g1r-mp.com/wiki/index.php?title=SetNpcMoveGoal&amp;action=history"/>
	<updated>2026-09-19T06:33:50Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://g1r-mp.com/wiki/index.php?title=SetNpcMoveGoal&amp;diff=712&amp;oldid=prev</id>
		<title>QCherry: Document Lua APIs available or improved from G1R:MP 0.1.2</title>
		<link rel="alternate" type="text/html" href="https://g1r-mp.com/wiki/index.php?title=SetNpcMoveGoal&amp;diff=712&amp;oldid=prev"/>
		<updated>2026-09-03T18:40:17Z</updated>

		<summary type="html">&lt;p&gt;Document Lua APIs available or improved from G1R:MP 0.1.2&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= setNpcMoveGoal =&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#fff5f5; border:1px solid #d13b3b; border-left:5px solid #d13b3b; color:#111111; padding:0.85rem 1rem; margin:0.75rem 0 1rem;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;color:#111111; font-weight:bold; letter-spacing:0.04em;&amp;quot;&amp;gt;AVAILABLE FROM UPDATE 0.1.2&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;color:#111111; margin-top:0.25rem;&amp;quot;&amp;gt;This function is available in G1R:MP 0.1.2 and later. The contract below includes the compatibility guarantees introduced in that update.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Assigns one direct, collision-checked movement goal to a resource-owned NPC in scripted navigation mode.&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setNpcMoveGoal(int npcId, number x, number y, number z [, table options])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Name !! Type !! Required !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;npcId&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt; || yes || The server-assigned NPC identifier returned by &amp;lt;code&amp;gt;spawnNpc&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;getNpcs&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || yes || Goal X coordinate in metres.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;y&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || yes || Goal Y coordinate in metres.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;z&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || yes || Ground-location Z reference in metres.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;options&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;table&amp;lt;/code&amp;gt; || no || Optional &amp;lt;code&amp;gt;{ speed = number, arrivalRadius = number }&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;speed&amp;lt;/code&amp;gt; is measured in metres per second, must be 0.1-12, and defaults to 1. &amp;lt;code&amp;gt;arrivalRadius&amp;lt;/code&amp;gt; is measured in metres, must be 0.01-5, and defaults to 0.2.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Returns ==&lt;br /&gt;
Returns &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; when the complete goal is accepted; otherwise returns &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
Move an NPC directly toward a work point:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; line&amp;gt;&lt;br /&gt;
setNpcNavigationMode(npcId, &amp;quot;scripted&amp;quot;)&lt;br /&gt;
setNpcMoveGoal(npcId, 20.0, -7.5, 2.0, {&lt;br /&gt;
    speed = 1.5,&lt;br /&gt;
    arrivalRadius = 0.25,&lt;br /&gt;
})&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
* Available only in server-side resource scripts.&lt;br /&gt;
* Only the owning resource may set a goal, and the NPC must already be in &amp;lt;code&amp;gt;&amp;quot;scripted&amp;quot;&amp;lt;/code&amp;gt; mode.&lt;br /&gt;
* The goal is a direct segment. Scripted mode does not run route path finding, &amp;lt;code&amp;gt;wait&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;avoid&amp;lt;/code&amp;gt; behavior or automatic detours.&lt;br /&gt;
* Static world blockers and authoritative player, NPC and monster capsules remain hard constraints. A blocked goal remains active and resumes only after a valid direct step becomes available.&lt;br /&gt;
* The owning resource receives one &amp;lt;code&amp;gt;onNpcMoveBlocked&amp;lt;/code&amp;gt; edge when continuous blockage begins and one &amp;lt;code&amp;gt;onNpcMoveComplete&amp;lt;/code&amp;gt; event when the arrival radius is reached.&lt;br /&gt;
* Movement is ground-only. The Z value must describe a plausible nearby ground location; this API does not control vertical velocity or moving platforms.&lt;br /&gt;
&lt;br /&gt;
[[Category:Lua Functions]]&lt;br /&gt;
[[Category:Server Functions]]&lt;br /&gt;
[[Category:World Functions]]&lt;br /&gt;
[[Category:NPC Functions]]&lt;/div&gt;</summary>
		<author><name>QCherry</name></author>
	</entry>
</feed>