Lightning not working properly

Started by Ethan D, Fri 03/04/2009 14:16:03

Previous topic - Next topic

Ethan D

I just set up the room to have lightning and it calls the script at the right times, all I need to know is how do I have it actually show the lightning.  I already have an animated background so I cant use setbackgroundframe, and I already tried using regionlighting and regiontint.  So what should I use to change the window to white momentarily?

Gilbert

Hmmm is the window part of the background?

RegionTint, Lighting etc. are actually not for background effects, they actually affect characters passing those areas. Instead you may use an object or character and experiment with changing its Tint property.

Ethan D

The only problem I have with doing that is that the window is animated (rain) and if its a character or object its going to be much more difficult to animate.  Although I could probably make an object that was white that fits the window and make it visible/ invisible, one question though.  How many objects can there be in a room before it causes problems. (I already have 8)

Gilbert

As of V3.1.2 you can have at most 40 objects per room, so that shouldn't be a problem.

Ethan D


Ethan D

Alright, I had it going great with this script
  if (lightning == 2)
      {
        int RANDOM = Random(10);
        SetTimer(2, RANDOM * 24);     
        lightning = 1;
      }
      else if ((lightning == 1) && (IsTimerExpired(2) == true))
     {
      windowlightning.Visible = true;
      Wait(5);
      windowlightning.Visible = false;
      lightning = 2;
        }

But after the lightning goes several times I wait 6 seconds which should be the longest wait between lightning strikes and nothing happens.  I waited a few more minutes and its not flashing anymore lightning.  Not sure why it would stop executing.  It is under repetedly execute.

ThreeOhFour

It might be that the RANDOM variable gets set to 0, which, unless I am sorely mistaken, will disable the timer. Try recalculating the RANDOM variable whenever it gets set to 0 :).

Gilbert

The problem is, is the variable lightning initially set to 2? If not, the codes won't be executed for even the first time.

Ethan D

Thanks Ben304

Instead of changing the variable I just added a +1 to the timer so its always at least 1.

ThreeOhFour

Awww haha your solution is so much cooler and simpler than mine.

I feel like a dummy  ;D

Glad to help :D

SMF spam blocked by CleanTalk