The Daily Click ::. Forums ::. Klik Coding Help ::. Random time?
 

Post Reply  Post Oekaki 
 

Posted By Message

infinitum3d



Registered
  03/03/2012 22:18:24
Points
  66
15th May, 2012 at 15/05/2012 19:28:14 -

I think I asked this before, but...

Is there an easy way (or correct way) to set a random time event? Currently I'm using

Every 1 second, set Alterable Value A to Random(10)
If Alterable Value A = 1, doEvent

But it seems like there should be a better way.

 
n/a

CakeSpear



Registered
  28/01/2004
Points
  112
15th May, 2012 at 15/05/2012 20:59:19 -

TimeX extencion

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
15th May, 2012 at 15/05/2012 21:11:00 -

Set a variable to something random, then have a second variable count one every loop, and when they're equal do the event.

So

Start of the frame
-Set Val A to random(10)

Always
-Add one to Val B

If Val B = Val A
-Do stuff!

Hope that helps.

 
n/a

infinitum3d



Registered
  03/03/2012 22:18:24
Points
  66
15th May, 2012 at 15/05/2012 21:22:57 -

Thanks Urban Monk. That's kinda what I'm doing.

Cakespear - how does timerExtension work?

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
15th May, 2012 at 15/05/2012 21:27:32 -

Well then you're on track. The TimeX extension won't do any differently.

What do you want to happen exactly, besides what you described?

 
n/a

infinitum3d



Registered
  03/03/2012 22:18:24
Points
  66
15th May, 2012 at 15/05/2012 23:20:35 -

Well, I have a cell which I would like to have divide every 10 to 20 seconds, with frequency depending on a set of variables (upgrades). At random times I want to create two smaller cells and destroy the current cell.

Edited by infinitum3d

 
n/a

jamesh



Registered
  28/02/2012 15:24:25
Points
  381
16th May, 2012 at 16/05/2012 00:03:23 -

Have an object to store a value

Every 1 second Alterable Value A of Object is greater than 0: subtract 1 from Alterable value A

Alterable value A of Object = 0: (do something, then) set Alterable Value A to Random(10)+10

 
n/a

CakeSpear



Registered
  28/01/2004
Points
  112
16th May, 2012 at 16/05/2012 02:07:47 -

Just want to say, for the sake of cross platform compatebility, you should not use the TimeX Extencion if you can avoid it.
If you just plan on making Game/ Application for Windows only then its fine.

The TimeX Extencion is an extencion you have to download before you can use it in MMF2.
What the TimeX Extencion allows you to do is make condition saying:
'Every X milliseconds'

 
n/a

Chris Burrows



Registered
  14/09/2002
Points
  2396

GOTW WINNER OCT. 2011
16th May, 2012 at 16/05/2012 03:54:11 -

Every 1 second set Value to Random (x)

If Value = 1
Then do your action

X is how likely you want the event to occur.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click