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

Post Reply  Post Oekaki 
 

Posted By Message

infinitum3d



Registered
  3/3/2012 10:18:24 PM
Points
  66
15th May, 2012 at 5/15/2012 7:28:14 PM -

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
  1/28/2004
Points
  112
15th May, 2012 at 5/15/2012 8:59:19 PM -

TimeX extencion

 
n/a

-UrbanMonk-

Professor Spectrum

Registered
  7/7/2008
Points
  6120

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 Fool
15th May, 2012 at 5/15/2012 9:11:00 PM -

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.

 
http://www.soapcow.com <- Flash games, featuring MMF made games!
http://www.jsoftgames.com <- Old blog I don't keep up anymore

infinitum3d



Registered
  3/3/2012 10:18:24 PM
Points
  66
15th May, 2012 at 5/15/2012 9:22:57 PM -

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

Cakespear - how does timerExtension work?

 
n/a

-UrbanMonk-

Professor Spectrum

Registered
  7/7/2008
Points
  6120

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 Fool
15th May, 2012 at 5/15/2012 9:27:32 PM -

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?

 
http://www.soapcow.com <- Flash games, featuring MMF made games!
http://www.jsoftgames.com <- Old blog I don't keep up anymore

infinitum3d



Registered
  3/3/2012 10:18:24 PM
Points
  66
15th May, 2012 at 5/15/2012 11:20:35 PM -

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
  2/28/2012 3:24:25 PM
Points
  380
16th May, 2012 at 5/16/2012 12:03:23 AM -

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
  1/28/2004
Points
  112
16th May, 2012 at 5/16/2012 2:07:47 AM -

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
  9/14/2002
Points
  2396

GOTW WINNER OCT. 2011
16th May, 2012 at 5/16/2012 3:54:11 AM -

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