Difference between revisions of "ContentDesigner:Creating Movement"

Line 5: Line 5:
  
 
{{Header|Movement Functions|BackgroundColor=3d78b4|FontColor=ffffff}}
 
{{Header|Movement Functions|BackgroundColor=3d78b4|FontColor=ffffff}}
There are two functions that can be used to make an NPC move. The first one [[LUA:MovementLoopAddLocation|MovementLoopAddLocation()]] will allow an NPC to move to more than one location like a specific path.
+
There are two functions that can be used to make an NPC move. Below you will find examples of how to use both to make an NPC move around in Norrath.
  
 
{|style="table-layout:fixed; width: 100%;"
 
{|style="table-layout:fixed; width: 100%;"
 
|{{TextBox
 
|{{TextBox
|[[LUA:MovementLoopAddLocation|MovementLoopAddLocation()]] Examples
+
|[[LUA:MovementLoopAddLocation|MovementLoopAddLocation()]]
|
+
|The [[LUA:MovementLoopAddLocation|MovementLoopAddLocation()]] function will allow an NPC to move along a given set of coordinates. This can be along a path, in a circle, or random locations. The below example will show a simple movement script.
 +
 
 +
 
 +
 
 
Syntax is  
 
Syntax is  
 
NPC, x, y, z, speed, delay (in seconds), function name (optional)
 
NPC, x, y, z, speed, delay (in seconds), function name (optional)

Revision as of 14:20, 14 June 2016

ContentDesigner:SpawnScripts - Creating Movement

Return to: ContentDesigner:SpawnScripts | Tutorials | Portal | Forum | Project Manager | Bug Tracker


The Creating Movement guide will show you how to get your NPC's to walk and run around. With many different combinations you can make a specific path for the NPC to follow to walking in circles if you choose.


Movement Functions

There are two functions that can be used to make an NPC move. Below you will find examples of how to use both to make an NPC move around in Norrath.

The MovementLoopAddLocation() function will allow an NPC to move along a given set of coordinates. This can be along a path, in a circle, or random locations. The below example will show a simple movement script.


Syntax is NPC, x, y, z, speed, delay (in seconds), function name (optional)

 function hailed(NPC, Spawn)
   FaceTarget(NPC, Spawn)
end
function spawn(NPC) MovementChoice(NPC)
end



The second one MoveToLocation() will allow the NPC to move to a specific location then stop.