ReplaceObjectModelMesh: Difference between revisions

From Onset Developer Wiki
(Created page with "{{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 spawn...")
 
No edit summary
(One intermediate revision by the same user not shown)
Line 18: Line 18:
AddPlayerChat("Loading of "..pakname..": "..tostring(res))
AddPlayerChat("Loading of "..pakname..": "..tostring(res))


res = ReplaceObjectModelMesh(42, "/TestDLC/Meshes/SM_Chair")
res = ReplaceObjectModelMesh(42, "/TestDLC/SM_Chair")
AddPlayerChat("ReplaceObjectModelMesh: "..tostring(res))
AddPlayerChat("ReplaceObjectModelMesh: "..tostring(res))
end
end
Line 25: Line 25:


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

Revision as of 13:04, 19 December 2019

ReplaceObjectModelMesh

Type: Function
Context: Client
Introduced: v1.0

Description

Replaces a model on the known object model list. Will not replace already spawned objects. So call this before any object spawns.

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