• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

P3D v4 material scripting

Messages
522
Country
france
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 editiing .................. 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
 
Messages
522
Country
france
@Lagaffe thnx for that link
i tested it in the SIM and here is what i got :(
the right one is the plane in the zip file that works fine
the left is the same MDL but scenery object can't load scrpit
so i opened MCX and found this ( 2nd photo ) i mean with both P3D v4 and v4.4 export
the scrpit attribute isn't exported in the BGL lib
and the script attribute is present before the export ( 3rd photo )
so the BGL comp is deleting that value from the mdl when converting to BGL :(
 

Attachments

  • 2018-12-17_21-43-48-613.png
    2018-12-17_21-43-48-613.png
    1.3 MB · Views: 287
  • Sans titre.png
    Sans titre.png
    68 KB · Views: 420
  • Sans titre2.png
    Sans titre2.png
    121.2 KB · Views: 387
Messages
522
Country
france
The unic solution is that i make an Engine that spawn some simobjects as scenery objects
 
Messages
522
Country
france
no i want to make my own objects
for jetways and papis i use sode but for my water
bus
cars
trucks
and scripted objects
i like to make my own engine so i can debug it
and i did that in 20 min by spawning an A320 in a runway and it works
all i need now is to continu the developing and build my new sceneries :)

maybe i'll share it for developers who want some advanced objects but still a WIP
i'll work on it tomorrow
 
Messages
26
Country
colombia
Hi. You have found a solution? Im trying to script a ground poly texture exported from 3dsmax and mcx and the error reporting in prepar3d does not recognize anything. It shows something like this. Do you know if its supported for ground polys in mcx?


"error=Gauge/Script Error
Type: Unknown
Name: Unknown
Error: Invalid script (command not found - perhaps a space is missing or there's an extra space?): "" in: 
!lua

local raining = 0x00000004

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

Attachments

  • ContentErrors.txt
    31.6 KB · Views: 206
Last edited:
Messages
522
Country
france
Hello @DaveWG
i tried to use TExtureOffsetU / V but it doesn't work :|
if i try to set the deffuse texture to null it works (i get a white texture) but if i change to UV rotation or offset it doesn't change
any thoughts ?
 
Messages
125
Country
moldova
Can you please tell us how you resolved the problem?

Trimis de pe al meu Redmi Note 5 folosind Tapatalk
 
Top