LoadPak: Difference between revisions

From Onset Developer Wiki
No edit summary
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 3: Line 3:
{{FuncDescription|Loads a .pak file.}}
{{FuncDescription|Loads a .pak file.}}


{{FuncSyntax|LoadPak(PakName, RootPath, ContentPath)}}
{{FuncSyntax|LoadPak(PakName [, RootPath, ContentPath])}}


{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|PakName|The name of the Pak file without extension.}}
{{FuncParam|PakName|The name of the Pak file without extension.}}
{{FuncParam|RootPath|Root name of your content path. For example /TestMod/}}
{{FuncParamOptional|RootPath|Root name of your content path. For example /TestMod/}}
{{FuncParam|ContentPath|The full path to bind the root path to. For example: ../../../TestProject/Plugins/TestMod/Content/}}
{{FuncParamOptional|ContentPath|The full path to bind the root path to. For example: ../../../TestProject/Plugins/TestMod/Content/}}
 
Since Onset v1.4.0 the RootPath and ContentPath can be omitted. It will be detected automatically.


{{FuncReturnValue|Returns '''true''' on success. Start the client with the "-dev" parameter switch to enable logging. Useful for errors.}}
{{FuncReturnValue|Returns '''true''' on success. Start the client with the "-dev" parameter switch to enable logging. Useful for errors.}}
Line 19: Line 21:
AddPlayerChat("Loading of "..pakname..": "..tostring(res))
AddPlayerChat("Loading of "..pakname..": "..tostring(res))


res = ReplaceObjectModelMesh(42, "/TestMod/Meshes/SM_Chair")
res = ReplaceObjectModelMesh(42, "/TestMod/SM_Chair")
AddPlayerChat("ReplaceObjectModelMesh: "..tostring(res))
AddPlayerChat("ReplaceObjectModelMesh: "..tostring(res))
end
end
Line 26: Line 28:


{{RelatedFunctions}}
{{RelatedFunctions}}
{{Template:PakFunctions}}
*[[DoesPakExist]]
*[[LoadPak]]
*[[ReplaceObjectModelMesh]]
*[[ReplaceAnimationLibrarySequence]]
*[[GetAllFilesInPak]]

Latest revision as of 18:45, 14 December 2020

LoadPak

Type: Function
Context: Client
Introduced: v1.0

Description

Loads a .pak file.

Syntax

LoadPak(PakName [, RootPath, ContentPath])

Parameters

  • PakName
    The name of the Pak file without extension.
  • RootPath (optional)
    Root name of your content path. For example /TestMod/
  • ContentPath (optional)
    The full path to bind the root path to. For example: ../../../TestProject/Plugins/TestMod/Content/

Since Onset v1.4.0 the RootPath and ContentPath can be omitted. It will be detected automatically.

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 = "TestMod"
	local res = LoadPak(pakname, "/TestMod/", "../../../TestProject/Plugins/TestMod/Content/")
	AddPlayerChat("Loading of "..pakname..": "..tostring(res))

	res = ReplaceObjectModelMesh(42, "/TestMod/SM_Chair")
	AddPlayerChat("ReplaceObjectModelMesh: "..tostring(res))
end
AddEvent("OnPackageStart", OnPackageStart)

See also