M MY Multiplayer: Wiki
Side
Kind

engineCreateMaterial

Client

Creates a material: a shader with parameter values, which then replaces or overlays the materials of models.

material engineCreateMaterial([string|shader|material|false base = nil, string name = nil])

Parameters

NameTypeDescription
basestring|shader|material|falseWhat the material builds on: the name of a shader, preset or named material, a shader element or a material element. With no base (nil or false), it starts from the material it replaces and changes only what you set.default nil
namestringA name other scripts and packs find the material by. It cannot be empty.default nil

Returns

The created material element.

Example

local glow = engineCreateMaterial("surface_emissive")
engineSetMaterialValue(glow, "glowTint", tocolor(255, 200, 60))
engineSetModelMaterial("infernus", "*light*", glow)
NoteA base that is not a shader, preset or material is an error. A name another owner's material already has now covers that one, with a warning.

See also