for i=1, 2 , 1 do startx2=targetx starty2=targety --tpt.create(startx2 , starty2 , "BRAY") raditus2=math.random(1,50) angle2=math.random(0,360) targetx2=startx2+(raditus2*(math.cos(angle2/2))) targety2=starty2+(raditus2*(math.sin(angle2/2))) tpt.create(targetx2 , targety2 , "BRAY") tpt.drawline(startx2, starty2, targetx2, targety2,0,255,0) for i=1, 2 , 1 do startx2b=targetx2 starty2b=targety2 --tpt.create(startx2b , starty2b , "BRAY") raditus2b=math.random(1,50) angle2b=math.random(0,360) targetx2b=startx2b+(raditus2b*(math.cos(angle2b/2))) targety2b=starty2b+(raditus2b*(math.sin(angle2b/2))) tpt.create(targetx2b , targety2b , "BRAY") tpt.drawline(startx2b, starty2b, targetx2b, targety2b,0,0,255) end end end tpt.register_mouseclick(ligh)
then save it as "ligh.lua" in the powder toy directory,then run the script,when you click the mouse,it will create lightning!(just line,and will also create BRAY points at all points which the lightning turns.)