M MY Multiplayer: Wiki
Side
Kind

engineSetModelMaterial

Client

Replaces the chosen materials of every instance of a model with a material.

bool engineSetModelMaterial(string|element model, int|string selector, material material [, int priority = 0])

Parameters

NameTypeDescription
modelstring|elementThe model's name or a model element.
selectorint|stringWhich material: its index from 1 or its name, as engineGetModelMaterials lists them. The name ignores case and takes the * and ? wildcards.
materialmaterialThe material drawn in their place.
priorityintWhen several resources pick the same material, the highest priority wins; between equals, the newest.default 0

Returns

true when it was applied.

Example

local chrome = engineCreateMaterial("surface")
engineSetMaterialValue(chrome, "metallicFactor", 1)
engineSetMaterialValue(chrome, "roughnessFactor", 0.05)
engineSetModelMaterial("infernus", "*chrome*", chrome)
NoteA name that is not a model is an error.

See also