Create weather with random integers

Hi !

I created a weather system wich is intended to work this way : Every amount of time (here 5 for debugging purposes) the system cheks if it’s raining or not. If not, a random integer is drawn. If this random int is greater than my “weather_change_cap” (=50) it starts to rain (and i’m playing the sound).

But it’s not working. It is totally random : sometimes it’s raining but the random int is 3, and sometimes it’s not even if the random int is 78 (for example).

Could someone help me please ?

Thanks !

Having the Tick and then a Delay is not good practice - That means that each frame, you create a delay of 5 seconds then do something. Therefore, after 5 seconds, your blueprint will be continually running through the code after the delay.

Also, why not random between 0 and 1 and then use that as your 50/50 chance?

Thanks for your help !

I made this 50/50 because at start it was “if my random int is > 80 —> make it rain” but for debugging purposes, I lowered the value !
But I made it an other way, I draw a random int between 0 and 5 (included) and if my random int is equal to 4, then it’s raining.

So, I managed to recreate your blueprint, so I’ve created a custom event which is called : when it’s not already raining ; when my random int is not equal to 4 ; and at the end of my blue print.

So here’s what I’ve got :

But it’s still not working, I made a print between the first branch node and the second one in order to see which number was draw. But sometimes it draws 3 and it’s starting to rain, and sometimes 4 and it’s not raining… Event sometimes, it draws 3, nothing happens, it draws other numbers, and then it draws 3 again and it starts to rain.

I don’t know if it’s linked to the delay ? Or the Condition on the seconde branch node which isn’t working ?