SetNPCAnimation: Difference between revisions

From Onset Developer Wiki
(Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|SetNPCAnimation(npc, animation, loop)}} {{FuncParameters}} {{FuncParam|npc|__EDIT_ME__}} {{FuncPar...")
 
No edit summary
Line 1: Line 1:
{{Info|Function|Server|1.0}}
{{Info|Function|Server|1.0}}


{{FuncDescription|__EDIT_ME__}}
{{FuncDescription|Plays an animation on an NPC.}}


{{FuncSyntax|SetNPCAnimation(npc, animation, loop)}}
{{FuncSyntax|SetNPCAnimation(npc, animation, loop)}}


{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|npc|__EDIT_ME__}}
{{FuncParam|npc|The NPC identifier you get from [[CreateNPC]]}}
{{FuncParam|animation|__EDIT_ME__}}
{{FuncParam|animation|The animation name as a string.}}
{{FuncParam|loop|__EDIT_ME__}}
{{FuncParam|loop|'''true''' to loop the animation, '''false''' to play it a single time.}}


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


== Example ==
== Example ==
__EDIT_ME__
<syntaxhighlight lang="Lua">
function cmd_tscene4(player)
local n1 = CreateNPC(2, 47547.23046875, 138174.515625, 1574.7159423828, -53.268035888672)
SetNPCAnimation(n1, "CLAP", true)
end
AddCommand("tscene4", cmd_tscene4)
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
[[CreateNPC]]

Revision as of 09:15, 8 August 2019

SetNPCAnimation

Type: Function
Context: Server
Introduced: v1.0

Description

Plays an animation on an NPC.

Syntax

SetNPCAnimation(npc, animation, loop)

Parameters

  • npc
    The NPC identifier you get from CreateNPC
  • animation
    The animation name as a string.
  • loop
    true to loop the animation, false to play it a single time.

Return Value

  • Returns true on success.

Example

function cmd_tscene4(player)
	local n1 = CreateNPC(2, 47547.23046875, 138174.515625, 1574.7159423828, -53.268035888672)
	SetNPCAnimation(n1, "CLAP", true)
end
AddCommand("tscene4", cmd_tscene4)

See also

CreateNPC