MaterialEx:setTexture(string, string)
There is a crash if the second parameter is not a valid texture asset path, so it must be the texture that will replace the existing one. So I would assume that the first parameter is the name of the texture slot to change. But I've tried everything I can think of for the first parameter and nothing has gotten a result:
"diffuseMap"
"diffuse"
"dif"
"normalMap"
"normal"
etc.
The material still shows its old textures afterwards. Does anyone know what I can enter to actually change a visible texture?
Can't figure out MaterialEx:setTexture()
Can't figure out MaterialEx:setTexture()
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Can't figure out MaterialEx:setTexture()
Try g_diffuseMap, g_normalMap, etc.
Re: Can't figure out MaterialEx:setTexture()
That still doesn't work for me. For example:
"test" gets printed to the console so I know the onUpdate hook is executing, and other operations like setParam, setTexcoordScaleOffset work fine. But any model given this material just stays white.
Code: Select all
defineMaterial{
name = "test",
diffuseMap = "assets/textures/common/white.tga",
doubleSided = false,
lighting = true,
alphaTest = false,
blendMode = "Additive",
textureAddressMode = "Wrap",
glossiness = 0,
depthBias = 0,
onUpdate = function(self, time)
print("test")
self:setTexture("g_diffuseMap","assets/textures/common/black.tga")
end,
}
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Can't figure out MaterialEx:setTexture()
You're right, it doesn't work :/ This feature was never tested because it is not used by the main campaign. Added to the bug list.