CreateObject: Difference between revisions
From Onset Developer Wiki
Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|CreateObject(modelid, x, y, z [, rx, ry, rz, sx, sy, sz])}} {{FuncParameters}} {{FuncParam|modelid..." |
No edit summary |
||
(3 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
{{Info|Function|Server|1.0}} | {{Info|Function|Server|1.0}} | ||
{{FuncDescription| | {{FuncDescription|This function creates an object at a desired location. See [[Objects]] for a list of models.}} | ||
{{FuncSyntax|CreateObject(modelid, x, y, z [, rx, ry, rz, sx, sy, sz])}} | {{FuncSyntax|CreateObject(modelid, x, y, z [, rx, ry, rz, sx, sy, sz])}} | ||
{{FuncParameters}} | {{FuncParameters}} | ||
{{FuncParam|modelid| | {{FuncParam|modelid|The [[Objects|model identifier]] for which object to spawn.}} | ||
{{FuncParam|x| | {{FuncParam|x|X coordinate}} | ||
{{FuncParam|y| | {{FuncParam|y|Y coordinate}} | ||
{{FuncParam|z | | {{FuncParam|z|Z coordinate}} | ||
{{ | {{FuncParamOptional|rx|Pitch}} | ||
{{ | {{FuncParamOptional|ry|Yaw}} | ||
{{ | {{FuncParamOptional|rz|Roll}} | ||
{{ | {{FuncParamOptional|sx|X scale}} | ||
{{ | {{FuncParamOptional|sy|Y scale}} | ||
{{FuncParamOptional|sz| | {{FuncParamOptional|sz|Z scale}} | ||
{{FuncReturnValue| | {{FuncReturnValue|Returns an identifier to the new object. '''false''' on error.}} | ||
== Example == | == Example == | ||
<syntaxhighlight lang="Lua"> | |||
function cmd_objtest(player) | |||
local x, y, z = 64151.0234375, 48423.33984375, 4516.530273 | |||
for c=1,50 do | |||
for r=1,50 do | |||
CreateObject(592, x + (c * 350.0), y + (r * 350.0), z) | |||
end | |||
end | |||
end | |||
AddCommand("objtest", cmd_objtest) | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
{{ObjectFunctions}} |
Latest revision as of 14:47, 12 August 2019
Description
This function creates an object at a desired location. See Objects for a list of models.
Syntax
CreateObject(modelid, x, y, z [, rx, ry, rz, sx, sy, sz])
Parameters
- modelid
The model identifier for which object to spawn. - x
X coordinate - y
Y coordinate - z
Z coordinate - rx (optional)
Pitch - ry (optional)
Yaw - rz (optional)
Roll - sx (optional)
X scale - sy (optional)
Y scale - sz (optional)
Z scale
Return Value
- Returns an identifier to the new object. false on error.
Example
function cmd_objtest(player)
local x, y, z = 64151.0234375, 48423.33984375, 4516.530273
for c=1,50 do
for r=1,50 do
CreateObject(592, x + (c * 350.0), y + (r * 350.0), z)
end
end
end
AddCommand("objtest", cmd_objtest)
See also
- CreateObject
- DestroyObject
- IsValidObject
- GetObjectCount
- GetObjectModel
- IsObjectStreamedIn
- EnableObjectStreamEvents
- SetObjectStreamDistance
- SetObjectLocation
- GetObjectLocation
- SetObjectRotation
- GetObjectRotation
- SetObjectScale
- GetObjectScale
- SetObjectAttached
- SetObjectDetached
- IsObjectAttached
- GetObjectAttachmentInfo
- IsObjectMoving
- SetObjectMoveTo
- StopObjectMove
- SetObjectRotateAxis
- GetObjectModelCount
- GetObjectMass
- GetStreamedObjects
- GetObjectBoundingBox
- GetObjectSize
- EnableObjectHitEvents
- SetObjectEditable
- SetObjectOutline
- SetObjectColor
- SetObjectEmissiveColor
- SetObjectTexture
- SetObjectAnimatedTexture
- SetObjectCastShadow
- SetObjectDimension
- GetObjectActor
- GetAllObjects
- SetObjectModel