SetObjectModel: Difference between revisions

From Onset Developer Wiki
(Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|This function changes the model of the created object. This function calls OnObjectModelChange event on client side.}} {{...")
 
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Info|Function|Server|1.0}}
{{Info|Function|Server|1.1.0}}


{{FuncDescription|This function changes the model of the created object.  This function calls [[OnObjectModelChange]] event on client side.}}
{{FuncDescription|This function changes the model of the created object.  This function calls [[OnObjectModelChange]] event on client side.}}
Line 14: Line 14:
== Example ==
== Example ==
<syntaxhighlight lang="Lua">
<syntaxhighlight lang="Lua">
_EDIT_ME_
-- Spawn a weed object at 1000.0, 1000.0, 100.0
local object = CreateObject(64, 1000.0, 1000.0, 100.0)
-- Change the spawned weed object to a tree
SetObjectModel(object, 66)
</syntaxhighlight>
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
{{ObjectFunctions}}
{{ObjectFunctions}}

Latest revision as of 11:34, 27 September 2020

SetObjectModel

Type: Function
Context: Server
Introduced: v1.1.0

Description

This function changes the model of the created object. This function calls OnObjectModelChange event on client side.

Syntax

SetObjectModel(objectid, modelid)


Parameters

  • objectid
    The object identifier.
  • modelid
    The model identifier for which object to spawn.

Return Value

  • Returns true on success.

Example

-- Spawn a weed object at 1000.0, 1000.0, 100.0
local object = CreateObject(64, 1000.0, 1000.0, 100.0)
-- Change the spawned weed object to a tree
SetObjectModel(object, 66)

See also