Difference between revisions of "LUA:MovementLoopAddLocation"

m (cosmetic)
(Examples)
 
(2 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
The MovementLoopAddLocation LUA function can be used to assign a circular grid for npc pathing.
 
The MovementLoopAddLocation LUA function can be used to assign a circular grid for npc pathing.
  
Adding this several times into an init function of an npc will allow the npc to start walking from spawning and continue to do so until killed or another defined condition.
+
Adding this several times into an spawn function of an npc's spawnscript will allow the npc to start walking from spawning and continue to do so until killed or another defined condition.
  
 
== Examples ==
 
== Examples ==
  
 +
<pre>
 
function spawn(NPC)
 
function spawn(NPC)
 +
--Syntax is NPC, x, y, z, speed, delay (in seconds), function name (optional)
 +
MovementLoopAddLocation(NPC, -233.71, -1.32, -78.60, 1 , 5)
 +
MovementLoopAddLocation(NPC, -199.22, -1.30, -65.10, 1 , 5, "Comment")
 +
end
  
--Syntax is NPC, x, y, z, speed, delay (in seconds)
+
function Comment(NPC)
 
+
    Say(NPC, "Nice day for a walk, isn't it?")
MovementLoopAddLocation(NPC, -233.71, -1.32,-78.60,1,0)
 
 
 
MovementLoopAddLocation(NPC, -199.22, -1.30,-65.10,1,0)
 
 
 
 
end
 
end
 +
</pre>

Latest revision as of 17:06, 25 October 2013

About

The MovementLoopAddLocation LUA function can be used to assign a circular grid for npc pathing.

Adding this several times into an spawn function of an npc's spawnscript will allow the npc to start walking from spawning and continue to do so until killed or another defined condition.

Examples

function spawn(NPC)
 	--Syntax is NPC, x, y, z, speed, delay (in seconds), function name (optional)
 	MovementLoopAddLocation(NPC, -233.71, -1.32, -78.60, 1 , 5)
	MovementLoopAddLocation(NPC, -199.22, -1.30, -65.10, 1 , 5, "Comment")
end

function Comment(NPC)
    Say(NPC, "Nice day for a walk, isn't it?")
end