Difference between revisions of "LUA:MoveToLocation"

 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{PageHeaderChild|LUA|MoveToLocation}}
 +
 +
 
= LUA Functions: MoveToLocation() =
 
= LUA Functions: MoveToLocation() =
 
Has the spawn move to the given location
 
Has the spawn move to the given location
Line 4: Line 7:
  
 
==== Syntax ====
 
==== Syntax ====
MoveToLocation(param1, param2, param3, param4, [param5], [param6])
+
MoveToLocation(param1, param2, param3, param4, [param5], [param6], [param7])
  
  
Line 13: Line 16:
 
: ''param3'' is the y coordinate to move to
 
: ''param3'' is the y coordinate to move to
 
: ''param4'' is the z coordinate to move to
 
: ''param4'' is the z coordinate to move to
;Optional - ''param5'' (float), ''param6'' (string)
+
: ''param5'' is the speed (Walk speed is 2)
: ''param5'' is the speed
+
;Optional - ''param5'' (float), ''param6'' (string), ''param7'' (bool)
 
: ''param6'' is a lua call back function
 
: ''param6'' is a lua call back function
 
+
: ''param7'' is true if you plan to add more points, false when it is the last point
  
 
==== Usage ====
 
==== Usage ====
 
<pre>
 
<pre>
 
function hailed(NPC, Spawn)
 
function hailed(NPC, Spawn)
     MoveToLocation(NPC, 10, 0, 20)
+
     MoveToLocation(NPC, 10, 0, 20, 2)
 
end
 
end
 
</pre>
 
</pre>
  
 
When hailed the NPC will move to 10, 0, 20
 
When hailed the NPC will move to 10, 0, 20
 +
 +
 +
<pre>
 +
function hailed(NPC, Spawn)
 +
    MoveToLocation(NPC, 10, 0, 20, 2, "FooBar")
 +
end
 +
</pre>
 +
 +
When hailed the NPC will move to 10, 0, 20 at a speed of 2 and will execute the call back function FooBar

Latest revision as of 10:30, 16 February 2020

LUA - MoveToLocation

Return to: LUA | Tutorials | Portal | Forum | Project Manager | Bug Tracker


LUA Functions: MoveToLocation()

Has the spawn move to the given location


Syntax

MoveToLocation(param1, param2, param3, param4, [param5], [param6], [param7])


Parameters

Required - param1 (Spawn), param2 (float), param3 (float), param4 (float)
param1 is the spawn to move
param2 is the x coordinate to move to
param3 is the y coordinate to move to
param4 is the z coordinate to move to
param5 is the speed (Walk speed is 2)
Optional - param5 (float), param6 (string), param7 (bool)
param6 is a lua call back function
param7 is true if you plan to add more points, false when it is the last point

Usage

function hailed(NPC, Spawn)
    MoveToLocation(NPC, 10, 0, 20, 2)
end

When hailed the NPC will move to 10, 0, 20


function hailed(NPC, Spawn)
    MoveToLocation(NPC, 10, 0, 20, 2, "FooBar")
end

When hailed the NPC will move to 10, 0, 20 at a speed of 2 and will execute the call back function FooBar