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__}} {{..." |
No edit summary |
||
Line 1: | Line 1: | ||
{{Info|Function|Server|1.0}} | {{Info|Function|Server|1.0}} | ||
{{FuncDescription| | {{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| | {{FuncParam|npc|The Npc identifier}} | ||
{{FuncParam|x| | {{FuncParam|x|The X axis}} | ||
{{FuncParam|y| | {{FuncParam|y|The Y axis}} | ||
{{FuncParam|z | | {{FuncParam|z |The Z axis}} | ||
{{FuncParamOptional|speed| | {{FuncParamOptional|speed|The movement speed in cm.}} | ||
{{FuncReturnValue| | {{FuncReturnValue|Returns '''true''' on success.}} | ||
== Example == | == Example == | ||
<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}} | ||
{{NPCFunctions}} |
Latest revision as of 07:55, 29 December 2019
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
- GetStreamedNPC
- GetNPCLocation
- SetNPCOutline
- SetNPCPropertyValue
- GetNPCPropertyValue
- CreateNPC
- DestroyNPC
- IsValidNPC
- GetAllNPC
- GetNPCCount
- IsNPCStreamedIn
- SetNPCLocation
- GetNPCLocation
- SetNPCHealth
- GetNPCHealth
- SetNPCAnimation
- SetNPCHeading
- GetNPCHeading
- SetNPCTargetLocation
- SetNPCFollowPlayer
- SetNPCFollowVehicle
- SetNPCRagdoll
- SetNPCRespawnTime