P3D v4.4 PBR Lua scripting

Discussion related to terrain/scenery design.
redouane_bpw
Posts: 31
Joined: Sat Dec 01, 2018 1:29 pm

P3D v4.4 PBR Lua scripting

Postby redouane_bpw » Sat Dec 15, 2018 11:52 pm

Hello
i wanted to make a script for my object to appear only when it rains ( my objects has pbr materials )
i made a box and assigned a scrpit to it
i tested : it doesn't work
i tried if else things editting .................. a bunch of things but couldsn't get it right
here is my script hope you help me :)
thnx in advacne :)

!lua

local raining = 0x00000004
local snowing = 0x00000008

local precipState = varget("A:AMBIENT PRECIP STATE", "Mask")
precipState = math.floor(precipState)

local colorRed = 1.0
local colorGreen = 1.0
local colorBlue = 1.0
local colorAlpha = 1.0
local colorAlphaN = 0.0

varset("T:AlbedoTexture", "string", "")

if precipState == raining then


varset("T:AlbedoAlpha", "Number", colorAlpha)
varset("T:AlbedorRed","Number",colorRed)
varset("T:AlbedoGreen","Number",colorGreen)
varset("T:AlbedorBlue","Number",colorBlue)

else
varset("T:AlbedoAlpha", "Number", colorAlphaN)
varset("T:AlbedorRed","Number",colorRed)
varset("T:AlbedoGreen","Number",colorGreen)
varset("T:AlbedorBlue","Number",colorBlue)


end

if precipState == snowing then


varset("T:AlbedoAlpha", "Number", colorAlpha)
varset("T:AlbedorRed","Number",colorRed)
varset("T:AlbedoGreen","Number",colorGreen)
varset("T:AlbedorBlue","Number",colorBlue)

else
varset("T:AlbedoAlpha", "Number", colorAlphaN)
varset("T:AlbedorRed","Number",colorRed)
varset("T:AlbedoGreen","Number",colorGreen)
varset("T:AlbedorBlue","Number",colorBlue)



end

carlosgomez44
Posts: 2
Joined: Fri Feb 08, 2019 4:41 am

Re: P3D v4.4 PBR Lua scripting

Postby carlosgomez44 » Fri Feb 08, 2019 5:17 am

Hi. Im trying to do something similar with not good results. In my ContentErrors log there is an error for each line
error=Gauge/script ErrorType: UnknownName: UnknownError: Invalid Script
For me is not recognized as lua script. I have no yet found a solution for this. You should check the ContentErrors log to see if you have the same errors.


Return to “Scenery Development Questions”

Who is online

Users browsing this forum: No registered users and 13 guests