Periodic Event Question (was: Easiest Question on the Helper)

THUNDERPOWER

New Member
Reaction score
1
Will this bug? I'm thinking it might as it chooses a random integer to wait, so if let's say, after 1 minute it picked 240 as an integer, then the trigger will run again between then, and if it were to choose a low number, like 15, I'm thinking it could bug. But I don't know.

Code:
Weather
    Events
        Time - Every 60.00 seconds of game time
    Conditions
    Actions
        Wait (Random real number between 0.00 and 240.00) seconds
        For each (Integer A) from 0 to 3, do (Actions)
            Loop - Actions
                Environment - Turn Weather[(Integer A)] Off
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Random integer number between 0 and 2) Equal to 1
            Then - Actions
                Do nothing
            Else - Actions
                Environment - Turn Weather[(Random integer number between 0 and 3)] On
 

0WN3D

New Member
Reaction score
15
Maybe.... As your periodic time maybe smaller than the wait time.... And the action will not cancel and 2 action may happen simultaneosly.... Lets say the 1st time it run the random integer is 65..... Then after 60 second the trigger runs agaian... This time the random integer is 5.... Then they will clash together....
 

tommerbob

Minecraft. :D
Reaction score
110
I know using 2 triggers might be over kill, but another option you could do is have 1 trigger that is set to a random integer = X, and then use a repeating timer that expires in X seconds, and do your weather effects when the timer expires.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
It might bug in the sense of changing the weather really quickly if it picks, say, 110 second wait followed by 60 second wait - which would end up with one weather change lasting 10 seconds.

You can get a more controllable random period if you do something like this:
Trigger:
  • Weather
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Wait (Random real number between 60.00 and 240.00) seconds
      • For each (Integer A) from 0 to 3, do (Actions)
        • Loop - Actions
          • Environment - Turn Weather[(Integer A)] Off
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 0 and 2) Equal to 1
        • Then - Actions
          • Do nothing
        • Else - Actions
          • Environment - Turn Weather[(Random integer number between 0 and 3)] On
      • Trigger - Run (This trigger) (ignoring conditions)
 

THUNDERPOWER

New Member
Reaction score
1
It might bug in the sense of changing the weather really quickly if it picks, say, 110 second wait followed by 60 second wait - which would end up with one weather change lasting 10 seconds.

You can get a more controllable random period if you do something like this:
Trigger:
  • Weather
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Wait (Random real number between 60.00 and 240.00) seconds
      • For each (Integer A) from 0 to 3, do (Actions)
        • Loop - Actions
          • Environment - Turn Weather[(Integer A)] Off
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 0 and 2) Equal to 1
        • Then - Actions
          • Do nothing
        • Else - Actions
          • Environment - Turn Weather[(Random integer number between 0 and 3)] On
      • Trigger - Run (This trigger) (ignoring conditions)

Seems much better! Can't believe I didn't think of that. +Rep
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top