engineSetModelTexture
Client
Swaps a texture on every instance of a model. Only that model's materials change, not the txd the texture comes from.
bool engineSetModelTexture(string|element model, string name, texture|dui|bool source [, int priority = 0])
Parameters
| Name | Type | Description |
|---|---|---|
| model | string|element | The model's name, or a model element from engineCreateModel. It need not be loaded yet. |
| name | string | The texture name its materials use, or a glob pattern. |
| source | texture|dui|bool | A texture, a dui, or false to hide the texture. |
| priority | int | Among several swaps for the same texture, the highest priority answers; among equals, the newest.default 0 |
Returns
true once the swap is set. Raises an error if no model has that name or the source is not an image or false.
A model's swaps answer under an element's (engineSetElementTexture) and over the world's (engineSetWorldTexture).
Example
local lights = engineCreateTexture("images/lights.png")
engineSetModelTexture("infernus", "vehiclelights128", lights)