Random Lightning problem

Started by LRH, Thu 02/04/2009 00:10:27

Previous topic - Next topic

LRH

Hey all! I was wondering if someone can help me. I am attempting to make a random lightning event within a room.
This is the code I'm using, which I put into the room's after fadein code. What am I doing wrong? (Note, once this works, I'll replace the Display("etcetc"); with playsound and light effect for lightning.





int lightning = 1;
      if (lightning == 2)
      {
        int RAND = Random(15);
        SetTimer(1, RAND * 100);     // I've tried it without the * 100 too ...
        lightning = 1;
      }
      else if (lightning == 1 && IsTimerExpired(1) == true)
      {
        Display("Random Test!");
        lightning=2;
      }

Any help always appreciated. Thanks!

Trent R

If it's in the 'after fadr-in' code, it'll only be run once. For recurring events, use rep_exec.


~Trent
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

LRH

Quote from: Trent R on Thu 02/04/2009 03:33:25
If it's in the 'after fadr-in' code, it'll only be run once. For recurring events, use rep_exec.


~Trent

Thanks a lot! With that information and some minor tweaking it works great.

Trent R

Don't know if it makes a difference, but I'd move the *100 up a line, rather than putting it inside the SetTimer call.

But, it might not even matter.

~Trent
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

SMF spam blocked by CleanTalk