<?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=TestNpcMove</id>
	<title>TestNpcMove - 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=TestNpcMove"/>
	<link rel="alternate" type="text/html" href="https://g1r-mp.com/wiki/index.php?title=TestNpcMove&amp;action=history"/>
	<updated>2026-09-19T06:22:14Z</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=TestNpcMove&amp;diff=714&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=TestNpcMove&amp;diff=714&amp;oldid=prev"/>
		<updated>2026-09-03T18:40:21Z</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;= testNpcMove =&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;
Tests a direct NPC move against the current authoritative world and character collision state without changing movement.&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
table|false testNpcMove(int npcId, number x, number y, number z)&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 || Test destination 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 || Test destination 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 || Test ground-location Z reference in metres.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Returns ==&lt;br /&gt;
Returns a table with &amp;lt;code&amp;gt;allowed&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;reason&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;blockerType&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;blockerId&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; when the arguments, ownership or service are invalid. Reasons are &amp;lt;code&amp;gt;clear&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;unknown-npc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;invalid-input&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;distance-limit&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;world-collision&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;dynamic-collision&amp;lt;/code&amp;gt;. Blocker types are &amp;lt;code&amp;gt;none&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;world&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;npc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;monster&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt;; &amp;lt;code&amp;gt;blockerId&amp;lt;/code&amp;gt; is an identifier string and is empty when no dynamic entity is identified.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
Inspect a direct goal before assigning it:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; line&amp;gt;&lt;br /&gt;
local result = testNpcMove(npcId, 20.0, -7.5, 2.0)&lt;br /&gt;
if result and result.allowed then&lt;br /&gt;
    setNpcMoveGoal(npcId, 20.0, -7.5, 2.0)&lt;br /&gt;
elseif result then&lt;br /&gt;
    outputDebugString(result.reason .. &amp;quot; blocker=&amp;quot; .. result.blockerType .. &amp;quot;:&amp;quot; .. result.blockerId)&lt;br /&gt;
end&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 resource that created the NPC may test its movement.&lt;br /&gt;
* This is a read-only, ground-only direct-segment test. It does not run route path finding, mutate a goal or provide moving-platform vertical control.&lt;br /&gt;
* World and dynamic occupancy may change after the test. &amp;lt;code&amp;gt;setNpcMoveGoal&amp;lt;/code&amp;gt; and every simulation step still perform authoritative validation.&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>