A way to remplace an texture by another with LUA ?

Hello , do you know a way to remplace an texture by another ?

Because i want to change the material of the hands of the viewmodel but i wont change the texture of the weapon (Only the hands) so i can’t use :

[lua]
LocalPlayer():GetViewModel():SetMaterial(blah blah blah)
[/lua]

What i want to do (Example from crysis ) :

Pistol -> Same texture and model
Hands -> Same model but the texture changes.


local mat, mat2
mat = Material( "the one you want to replace" )
mat2 = Material( "the one you want to replace it with" )

mat:SetTexture( "$basetexture", mat2:GetTexture( "$basetexture" ) )

Or something along those lines.

Thanks :smile:

Is it possible to do this to the world textures too? I remember seeing a video or something where someone (maybe garry?) did it with matproxy.

It was game-mount priority ?

It was something garry showed a while back - all textures in the world were replaced by a single ( in this case, scrolling ) texture.

It did not use this method afaik.