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

Randomising the timing to start an animation

Messages
57
Country
unitedkingdom
Hi,

I've got a short simple animation around 10 seconds that I would like trigger after a random time interval every 5-10 minutes or even longer. Is it possible with code in the xml to do something like this or isn't it possible at the moment?

regards
Kev
 

tgibson

Resource contributor
Messages
10,770
Country
us-california
Hi,

I use the seconds in the time variables for my random trigger. When you start your process (the trigger), get the seconds value and use it as the seed for your random number. You can use math to change the total length of the random period (i.e. if you want it within 15 seconds of the trigger then it is seconds * 4).
 
Messages
57
Country
unitedkingdom
Hi,

I use the seconds in the time variables for my random trigger. When you start your process (the trigger), get the seconds value and use it as the seed for your random number. You can use math to change the total length of the random period (i.e. if you want it within 15 seconds of the trigger then it is seconds * 4).
Thank you for replying, could you post a xml file showing the syntax please?

Kev
 

tgibson

Resource contributor
Messages
10,770
Country
us-california
Here is some code that sets a random time for an engine to fail, if a user should abuse the engine. It is placed in the (L:ENG1_HEALTH, number) variable, which is in seconds. It sets the minimum length of time to (L:ENG_INIT_HEALTH, number), and allows it to be extended by up to 2 minutes randomly. flr returns the next lowest integer, and % is the modulo operator, which returns the remainder of a division operation. It only runs once due to the (L:ENG1_HEALTH_INIT, bool) variable being set to 1 at the end of the code.

XML:
         (L:ENG1_HEALTH_INIT, bool) ! (A:GENERAL ENG1 COMBUSTION, bool) && if{     
           (P:Local time,seconds) flr 60 % (>L:ENG1_HEALTH, number)
           (L:ENG1_HEALTH, number) 2 * (L:ENG_INIT_HEALTH, number) + (>L:ENG1_HEALTH, number)
           1 (>L:ENG1_HEALTH_INIT, bool) }
 
Top