SetNPCTargetLocation: Difference between revisions

From Onset Developer Wiki
Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|SetNPCTargetLocation(npc, x, y, z [, speed])}} {{FuncParameters}} {{FuncParam|npc|__EDIT_ME__}} {{..."
 
28days (talk | contribs)
No edit summary
 
Line 1: Line 1:
{{Info|Function|Server|1.0}}
{{Info|Function|Server|1.0}}


{{FuncDescription|__EDIT_ME__}}
{{FuncDescription|Set the NPC's target location where it should go towards to.}}


{{FuncSyntax|SetNPCTargetLocation(npc, x, y, z [, speed])}}
{{FuncSyntax|SetNPCTargetLocation(npc, x, y, z [, speed])}}


{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|npc|__EDIT_ME__}}
{{FuncParam|npc|The Npc identifier}}
{{FuncParam|x|__EDIT_ME__}}
{{FuncParam|x|The X axis}}
{{FuncParam|y|__EDIT_ME__}}
{{FuncParam|y|The Y axis}}
{{FuncParam|z |__EDIT_ME__}}
{{FuncParam|z |The Z axis}}
{{FuncParamOptional|speed|__EDIT_ME__}}
{{FuncParamOptional|speed|The movement speed in cm.}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|Returns '''true''' on success.}}


== Example ==
== Example ==
__EDIT_ME__
<syntaxhighlight lang="Lua">
-- Makes the NPC go towards the player's location.
local x, y, z = GetPlayerLocation(playerId)
SetNPCTargetLocation(NpcId, x, y, z, 200.0)
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
{{NPCFunctions}}

Latest revision as of 07:55, 29 December 2019

SetNPCTargetLocation

Type: Function
Context: Server
Introduced: v1.0

Description

Set the NPC's target location where it should go towards to.

Syntax

SetNPCTargetLocation(npc, x, y, z [, speed])

Parameters

  • npc
    The Npc identifier
  • x
    The X axis
  • y
    The Y axis
  • z
    The Z axis
  • speed (optional)
    The movement speed in cm.

Return Value

  • Returns true on success.

Example

-- Makes the NPC go towards the player's location.
local x, y, z = GetPlayerLocation(playerId)
SetNPCTargetLocation(NpcId, x, y, z, 200.0)

See also