User Tag List

Results 1 to 5 of 5

Thread: Random time?

  1. #1
    No Products Registered

    Join Date
    Sep 2008
    Location
    St. Peterburg, Russia
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Random time?

    I want to create similar event using Platform Movement Object;
    ---Every "Random"
    ---Jump
    But the base Timer object and TimeX has`nt any functions to run action in random time.
    Is there any way to create this?

  2. #2
    Clicker Multimedia Fusion 2
    Algul's Avatar
    Join Date
    Feb 2008
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Random time?

    Function Eggtimer may do the trick

  3. #3
    Clicker Multimedia Fusion 2

    Join Date
    Jun 2007
    Location
    Suffolk, UK
    Posts
    435
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Random time?

    There are a number of different ways you could achieve this.

    One option would be to store a value in either an object alterable value, a counter, or a global value. Each frame you reduce this value and when it hits 0, you do your jump action then in the same event set the stored value to a random value using Random()
    Example 1: with a framerate of 50 frames/sec this will make the object jump after 1 second then reset the global value to between 50 and 200 so it will next jump anywhere between 1 sec and 4 sec later
    Code:
    (Using Global Value A for our countdown set to 50 at start)
    
    Condition: Always
    Action: Subtract 1 from Global Value A
    
    Condition: Global Value A <= 0
    Action: Jump
    Action: Set Global Value A to random(151)+50

  4. #4
    No Products Registered

    Join Date
    Feb 2007
    Location
    Sydney, Australia
    Posts
    1,654
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Random time?

    Do:

    **Compare 2 general values:
    Seconds =Equal to= Random(whatever)

    -Jump

    You can also do Minutes, hours and more instead of seconds. Just go to "Retrieve data from an object" and go to the timer thing.

  5. #5
    No Products Registered

    Join Date
    Jun 2006
    Location
    Land of raging rockets
    Posts
    1,231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Random time?

    I'd go for TreeHugger's solution. Dynamite's way is pretty "shaky", depending on the random number you use, you get very odd results. E.g. you use Random(30), your event will trigger every frame at the chance of 1:30, but ONLY in the first half of a minute - after that nothing will happen with any of your objects for 30 seconds.

    If you don't want to use an alterable value, what Algul said is pretty good. The eggtimer extension can run a "function" after a fixed time. So you can just tell it to wait Random(x) seconds and then do something.

    If you just want a random chance every frame, instead of a random time of waiting do
    > Compare two general values: Random(x) Equal To 0

    This way you get a chance of 1:x every frame. Of course this does not, as TreeHugger's approach, guarantee a minimum waiting time (it might just trigger 10 times a second and then not for 5).

Similar Threads

  1. Fast loops leave a space at a random time? why?
    By LittleTinyBabyMan in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 28th May 2012, 09:20 PM
  2. Some more random Klik questions (only 7 this time)
    By oldkliker in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 17th September 2011, 01:05 AM
  3. random time and x
    By solarstorm in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 18th May 2011, 09:17 AM
  4. Random background each time game is run
    By Srandy in forum The Games Factory 2 - Technical Support
    Replies: 1
    Last Post: 3rd August 2009, 07:05 PM
  5. Make a time machine run with lower time complexity
    By Pixelthief in forum Multimedia Fusion 2 - Technical Support
    Replies: 48
    Last Post: 12th March 2009, 10:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •