LUA script MetallicTexture and NormalTexture

Teufelsrochen811
Posts: 3
Joined: Sat Mar 28, 2015 7:51 am

LUA script MetallicTexture and NormalTexture

Postby Teufelsrochen811 » Tue Apr 28, 2020 1:16 pm

Hello!

I recently had a look into LUA scripting and would like to let the metalic and normal map change when it's raining.

This is what I've tried, but it doesn't work:

!lua
--Get precip state.
local raining = 0x00000004
local precipState = varget("A:AMBIENT PRECIP STATE", "Mask")
precipState = math.floor(precipState)
--Define textures.
textureDry= "CONCRETO_BUMP.dds"
textureWet = "CONCRETO_BUMP_WET.dds"
textureDry1= "CONCRETO_SMOOTHNESS.dds"
textureWet1 = "CONCRETO_SMOOTHNESS_WET.dds"
if precipState == raining then
varset("T:NormalTexture", "string", textureWet)
varset("T:MetallicTexture", "string", textureWet1)
else
varset("T:NormalTexture", "string", textureDry)
varset("T:MetallicTexture", "string", textureDry1)
end

What do you think?

Thanks.

User avatar
YoYo
Posts: 259
Joined: Thu Nov 28, 2013 2:53 pm

Re: LUA script MetallicTexture and NormalTexture

Postby YoYo » Thu Apr 30, 2020 4:25 pm

Dynamic reflection ON?
webmaster of www.yoyosims.pl
spec: W10, i9 9900K, RTX 3090, 32 RAM | P3Dv5 | VR only: HP Reverb v2

Teufelsrochen811
Posts: 3
Joined: Sat Mar 28, 2015 7:51 am

Re: LUA script MetallicTexture and NormalTexture

Postby Teufelsrochen811 » Thu Apr 30, 2020 6:33 pm

Hi!

Dynamic Reflection is turned on in the P3D options/settings, if that's what you mean.

User avatar
YoYo
Posts: 259
Joined: Thu Nov 28, 2013 2:53 pm

Re: LUA script MetallicTexture and NormalTexture

Postby YoYo » Thu Apr 30, 2020 9:44 pm

Stay with this lua and check with Dynamic Reflection OFF if you can. Thx.
webmaster of www.yoyosims.pl
spec: W10, i9 9900K, RTX 3090, 32 RAM | P3Dv5 | VR only: HP Reverb v2

Teufelsrochen811
Posts: 3
Joined: Sat Mar 28, 2015 7:51 am

Re: LUA script MetallicTexture and NormalTexture

Postby Teufelsrochen811 » Fri May 01, 2020 11:27 am

Just tried it and unfortunately it still doesn't work.. Does the script look corrrect though in general?


Return to “Software Development Kit (SDK) Questions”

Who is online

Users browsing this forum: No registered users and 18 guests