SetNPCLocation: Difference between revisions
From Onset Developer Wiki
Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|SetNPCLocation(npc, x, y, z)}} {{FuncParameters}} {{FuncParam|npc|__EDIT_ME__}} {{FuncParam|x|__ED..." |
FlyingFork (talk | contribs) No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
{{Info|Function|Server|1.0}} | {{Info|Function|Server|1.0}} | ||
{{FuncDescription| | {{FuncDescription|Sets the location of this npc}} | ||
{{FuncSyntax|SetNPCLocation(npc, x, y, z)}} | {{FuncSyntax|SetNPCLocation(npc, x, y, z)}} | ||
{{FuncParameters}} | {{FuncParameters}} | ||
{{FuncParam|npc| | {{FuncParam|npc|NPC which you want to teleport}} | ||
{{FuncParam|x| | {{FuncParam|x|X coordinate}} | ||
{{FuncParam|y| | {{FuncParam|y|Y coordinate}} | ||
{{FuncParam|z| | {{FuncParam|z|Z coordinate}} | ||
{{FuncReturnValue| | {{FuncReturnValue|Returns '''true''' on success.}} | ||
== Example == | == Example == | ||
<syntaxhighlight lang="Lua"> | |||
function bringNPC(player, npc) | |||
local x,y,z = GetPlayerLocation(player) | |||
SetNPCLocation(tonumber(npc), x,y,z) | |||
end | |||
AddCommand('bringnpc', bringNPC) | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
{{Template:NPCFunctions}} |
Latest revision as of 14:25, 26 June 2021
Description
Sets the location of this npc
Syntax
SetNPCLocation(npc, x, y, z)
Parameters
- npc
NPC which you want to teleport - x
X coordinate - y
Y coordinate - z
Z coordinate
Return Value
- Returns true on success.
Example
function bringNPC(player, npc)
local x,y,z = GetPlayerLocation(player)
SetNPCLocation(tonumber(npc), x,y,z)
end
AddCommand('bringnpc', bringNPC)
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