• 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.

Christian Bahr

Resource contributor
Messages
951
Country
germany
I'm in the process of getting some of my 3-D models ready for the MFS. A few of these models are said to have some intelligence. That worked with the windsock and a clock. The clock shows the local time and the windsock turns into the wind when the wind direction changes. So far so good, but ...

But I just got stuck with one topic: Objects that should only be displayed at a certain time of the Year/Day ...

mfs_bahrometrix_spezielle_objekte.jpg


Specifically, it is about a parasol as a SimObject that is on the visitor terrace ...

mfs_edle_umbrella.jpg

This umbrella should be on the terrace in the summer months. However, the umbrella should not be visible in the winter months.

I know that the MFS works with so-called model bevahiors. But the old recipes from the P3D modeldef.xml no longer work. Here is the contents of the XML file:
<?xml version="1.0" encoding="utf-8" ?>
<ModelInfo version="1.1" guid="{e0c85e87-f282-4a4d-9f09-6c995c95a776}">

<LODS>
<LOD MinSize="0" ModelFile="edle_sonnenschirm.gltf"></LOD>
</LODS>

<PartInfo>
<Name>edle_sonnenschirm_sommer</Name>
<Visibility>
<Parameter>
<Code>
(E:ZULU MONTH OF YEAR, number) 6.0 &gt;= (E:ZULU MONTH OF YEAR, number) 8.0 &lt;= and if{ 1 } els{ 0 }
</Code>
</Parameter>
</Visibility>
</PartInfo>

</ModelInfo>

Does anyone have any advice on what the VisCode should look like, which contains a season's condition?
 
Messages
238
Country
unitedstates
I don't know if this has anything to do with it, but, as I understand it, MSFS does not yet support seasons. Perhaps this is part of that? IOW, it's not just that the seasonal textures don't exist yet, but the whole season timeline thing might not yet be implemented?

I might be wrong, just a guess...

Doesn't summer end in 9? Short changing the customers, eh? ;)
 
Last edited:
Messages
238
Country
unitedstates
Hmm, is this why the beacons I add to my airport are on all the time, because modeldef is not working yet? I'm just using the default scenery object airport beacon at the moment and turning on the beacon.
 

Christian Bahr

Resource contributor
Messages
951
Country
germany
I don't know if this has anything to do with it, but, as I understand it, MSFS does not yet support seasons.

I can't say for sure whether seasons are supported. I don't want to work with seasonal textures either. Some objects should only be displayed for certain months. The MFS SDK has a "Time"-Variable:


mfs_sdk_variables.jpg



Some objects should not be displayed in rainy weather, so this is by no means limited to the season.. Maybe I didn't use the correct formatting and that's the only reason the Code doesn't work.
 
Messages
238
Country
unitedstates
I can't say for sure whether seasons are supported. I don't want to work with seasonal textures either. Some objects should only be displayed for certain months. The MFS SDK has a "Time"-Variable:


View attachment 63908


Some objects should not be displayed in rainy weather, so this is by no means limited to the season.. Maybe I didn't use the correct formatting and that's the only reason the Code doesn't work.
Exactly, the beacon should only be on during the night OR if the airport is in IFR conditions (unless you choose to have it on 24 hours). But I haven't figured out if that's the way MSFS works (FSX did) or how to get it to work. Good luck.

(Just because it's in the SDK doesn't necessarily mean it works, haha :) ... hope it does).
 

Christian Bahr

Resource contributor
Messages
951
Country
germany
What are your findings so far? Perhaps you would like to share them with us so that we can learn something from them ;)
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,883
Country
netherlands
As far as I know visibility conditions don't work on scenery objects in MSFS at the moment. But I could be wrong.
 

Christian Bahr

Resource contributor
Messages
951
Country
germany
Thanks Arno, that's how I understood it. This is why I created the objects as SimObjects and SimObjects can be assigned a role via "Model Behavior". And, as far as I understand, SimObjects can be treated very differently. Hence my idea that SimObjects can also be assigned a visibility code :)
 
Messages
104
Country
pakistan
The code structure is slightly different in the case of 'Model Behaviours'. Firstly, the custom code for any simobject needs to go in a separate <ModelBehaviours> tag within the .XML and not within the <ModelInfo> tag. Secondly, The 'node' name is missing which defines exactly which part will use the code. Try with the attached code and see if it helps. Just replace the text in red with your required conditions. PS: I haven't tried this for visibility conditions, but it's working for other purposes and it should work here too.


XML:
<ModelBehaviors>
    
        <Component ID="Any Name of your choice" Node="3ds max object name">
            <Visibility>
                <Parameter>
                    <Code>***Insert Code here***</Code>
                </Parameter>
            </Visibility>
        </Component>
    
</ModelBehaviors>
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,883
Country
netherlands
Hi,

I believe the proper way is to put them inside the ModelInfo in a Behaviours tag. As with the ModelBehaviour you get an invalid XML file with multiple roots. It seems they changed that a while ago. I bumped into this a few days ago while working on visibility condition support in MCX. But I am also still in the testing phase to see if it works :)
 

Christian Bahr

Resource contributor
Messages
951
Country
germany
I changed the VisCode as suggested. The entire XML file looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<ModelInfo version="1.1" guid="{e0c85e87-f282-4a4d-9f09-6c995c95a776}">

<LODS>
<LOD MinSize="0" ModelFile="edle_sonnenschirm.gltf"></LOD>
</LODS>

<ModelBehaviors>
<Component ID="edle_sonnenschirm_sommer" Node="edle_sonnenschirm">
<Visibility>
<Parameter>

<Code>(A:LOCAL MONTH OF YEAR, Number) 4 == if{ 1 } els{ 0 }</Code>

</Parameter>
</Visibility>
</Component>
</ModelBehaviors>

</ModelInfo>

Unfortunately it doesn't work :(
 
Messages
104
Country
pakistan
Try it with something like this. Edited the .XML slightly for syntax issues.

Secondly, where are you getting the code from? I checked the MSFS SDK and didn't find any variables linked to time/seasons etc. Maybe I'm missing something here?

XML:
<?xml version="1.0" encoding="utf-8" ?>
<ModelInfo version="1.1" guid="{e0c85e87-f282-4a4d-9f09-6c995c95a776}">

<LODS>
    <LOD MinSize="0" ModelFile="edle_sonnenschirm.gltf"/>
</LODS>
</ModelInfo>

<ModelBehaviors>
    <Component ID="edle_sonnenschirm_sommer" Node="edle_sonnenschirm">
        <Visibility>
            <Parameter>
                <Code>(E:LOCAL MONTH OF YEAR, Number) 4 == if{ 1 } els{ 0 }</Code>
            </Parameter>
        </Visibility>
    </Component>
</ModelBehaviors>
 
Last edited:

Christian Bahr

Resource contributor
Messages
951
Country
germany
Try it with something like this. Edited the .XML slightly for syntax issues.

Thanks for the help, but unfortunately it didn't work. The parasol is displayed for all months. Initially, it should only and exclusively be displayed in month 4 (April).

Secondly, where are you getting the code from? I checked the MSFS SDK and didn't find any variables linked to time/seasons etc. Maybe I'm missing something here?

To be honest, I have little to no idea about coding. I still have some of the above code from the P3D, on the other hand variables are also documented in the MFS SDK. These are Simconnect variables. I don't know if you can use it in SimObjects:


mfs_sdk_simconnect_variables.jpg



These are simulator variables that looks promising:

mfs_sdk_time_variables.jpg
 

Attachments

  • mfs_sdk_ambient_variables.jpg
    mfs_sdk_ambient_variables.jpg
    50.8 KB · Views: 247
  • mfs_sdk_variables.jpg
    mfs_sdk_variables.jpg
    62.8 KB · Views: 240
Messages
104
Country
pakistan
I still have some of the above code from the P3D, on the other hand variables are also documented in the MFS SDK. These are Simconnect variables. I don't know if you can use it in SimObjects:
That's a nice find. I'm seeing two 'simulation variables' pages in the Documentation. Not sure what's the difference is between them though.
Screenshot_23.png


But anyway, This topic got me interested so I thought to try this out. So I compiled a sample object using the same code as I posted in post#13(With changed node ID), and the visibility conditions worked. The object was only visible in the 4th month as per the condition set. The object was added in as a simobject instead of a scenery (But that shouldn't be an issue since you are already using simobjects)


Attached are my 3ds max settings and complete .XML file. Let me know if this helps
Screenshot_24.png

XML:
<?xml version="1.0" encoding="utf-8" ?>
<ModelInfo version="1.1" guid="{899f4aa1-b771-48c3-bbe4-69084c824f70}">
    <LODS>
        <LOD MinSize="0" ModelFile="SimArc_vischeck.gltf"/>
    </LODS>
</ModelInfo>

<ModelBehaviors>
    <Include Path="Asobo\Misc\SimObjects.xml"/>
        <Component ID="Wigwag" Node="Wigwag">
            <Visibility>
                <Parameter>
                    <Code>(E:LOCAL MONTH OF YEAR, Number) 4 == if{ 1 } els{ 0 }</Code>
                </Parameter>
            </Visibility>
        </Component>
        
</ModelBehaviors>
 

Christian Bahr

Resource contributor
Messages
951
Country
germany
I'll try that now. I have already found a small mistake. It's about completing ModelInfo (</ModelInfo>). I had the entry at the very end of the XML file, maybe it was that. I'll get back to you after testing.
 

Lagaffe

Resource contributor
Messages
864
Country
france
A question: what do you understand by "<Include Path="Asobo\Misc\SimObjects.xml"/>" ? I don't think it was a PATH, so ?
 
Messages
104
Country
pakistan
A question: what do you understand by "<Include Path="Asobo\Misc\SimObjects.xml"/>" ? I don't think it was a PATH, so ?
Oops, I'm afraid I left it there by mistake. It should not have any effect on this particular code. It's relevant only when using the default templates available inside the base sim.
 

Christian Bahr

Resource contributor
Messages
951
Country
germany
Short feedback, it worked!!!

The parasol can only be seen in month 4 (April). In the other months it is hidden:



I had to adapt your code to my 3-D model, so the tag WigWag had to be changed into edle_sonnenschirm. Here is the changed code:

<?xml version="1.0" encoding="utf-8" ?>
<ModelInfo version="1.1" guid="{e0c85e87-f282-4a4d-9f09-6c995c95a776}">
<LODS>
<LOD MinSize="0" ModelFile="edle_sonnenschirm.gltf"/>
</LODS>
</ModelInfo>

<ModelBehaviors>
<Include Path="Asobo\Misc\SimObjects.xml"/>
<Component ID="edle_sonnenschirm" Node="edle_sonnenschirm">
<Visibility>
<Parameter>
<Code>(E:LOCAL MONTH OF YEAR, Number) 4 == if{ 1 } els{ 0 }</Code>
</Parameter>
</Visibility>
</Component>

</ModelBehaviors>

Based on this XML file, I will now make further experiments. For example, the animated people should not be visible on the visitor terrace when it rains. But now I want to call out HipHipHooray first. Veeeeeeery loud! :D

Once again, many thanks for this extremely good help!
 
Top