ReplaceObjectModelMesh: Difference between revisions
From Onset Developer Wiki
No edit summary |
No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
{{Info|Function|Client|1.0}} | {{Info|Function|Client|1.0}} | ||
{{FuncDescription|Replaces a model on the known object model list. Will not replace already spawned objects. So call this before any object spawns.}} | {{FuncDescription|Replaces a model on the known object model list. Will not replace already spawned objects. So call this before any object spawns. | ||
Since 1.2.1 you can also use non-existent ModelIds (add new objects).}} | |||
{{FuncSyntax|ReplaceObjectModelMesh(ModelId, PathToMesh)}} | {{FuncSyntax|ReplaceObjectModelMesh(ModelId, PathToMesh)}} | ||
Line 18: | Line 20: | ||
AddPlayerChat("Loading of "..pakname..": "..tostring(res)) | AddPlayerChat("Loading of "..pakname..": "..tostring(res)) | ||
res = ReplaceObjectModelMesh(42, "/TestDLC | res = ReplaceObjectModelMesh(42, "/TestDLC/SM_Chair") | ||
AddPlayerChat("ReplaceObjectModelMesh: "..tostring(res)) | AddPlayerChat("ReplaceObjectModelMesh: "..tostring(res)) | ||
end | end |
Latest revision as of 19:37, 29 June 2020
Description
Replaces a model on the known object model list. Will not replace already spawned objects. So call this before any object spawns.
Since 1.2.1 you can also use non-existent ModelIds (add new objects).
Syntax
ReplaceObjectModelMesh(ModelId, PathToMesh)
Parameters
- ModelId
The object model identifier to replace the mesh for, see Objects. - PathToMesh
Path to your mesh asset.
Return Value
- Returns true on success. Start the client with the "-dev" parameter switch to enable logging. Useful for errors.
Example
function OnPackageStart()
local pakname = "TestDLC"
local res = LoadPak(pakname, "/TestDLC/", "../../../TestProject/Plugins/TestDLC/Content/")
AddPlayerChat("Loading of "..pakname..": "..tostring(res))
res = ReplaceObjectModelMesh(42, "/TestDLC/SM_Chair")
AddPlayerChat("ReplaceObjectModelMesh: "..tostring(res))
end
AddEvent("OnPackageStart", OnPackageStart)
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