local time1 = 0 local time2 = g_Time local timepassed = time2 - time1 local imagenumber = 0 math.randomseed(5) --change to however many different images you have local max_images = 2 local delay = 0.05 local lightning = 0 local xpos = math.random(0,95) local ypos = math.random(0,50) function rain_init(e) LoadImages("weather",0) SetImagePosition(0,0) SetImageAlignment(1) LoadImages("weather/lightning",4) end function rain_main(e) if time1 == 0 then time1 = g_Time end time2 = g_Time timepassed = (time2 - time1) / 1000 if timepassed >= delay then SetImagePosition(0,0) --<<<<<<<<< need this to keep the rain images in place ShowImage(imagenumber) if imagenumber < max_images - 1 then imagenumber = imagenumber + 1 if math.random(10) == 5 then lightning = 0 xpos = math.random(0,50) ypos = math.random(0,50) end else imagenumber = 0 end time1 = 0 end if g_PlayerAngX <= -11 then if lightning < 5 then --SetImageAlignment(1) lightning = lightning + 1 SetImagePosition(xpos,ypos) --<<<<<<<<< This places the lightning randomly without going to low ShowImage(math.random(4,6)) ypos = math.random(0,50) xpos = math.random(0,50) PlaySound(e,0) SetSoundVolume(80) end else lightning = 0 xpos = math.random(0,50) ypos = math.random(0,50) end --Prompt(g_PlayerAngX) --]] end