Ball Lightning BLLT

  • Videogamer555
    14th Jan 2012 Member 2 Permalink
    Here's my Lua script to make BLLT from ELEC. BLLT will appear in the "explosives" menu because it explodes after it runs out of "Life". It also can electrify metal or other conductors when the ring of LIGH (the edge of the ball lightning) touches the conductor. The explosion does a decent ammount of damage.

    Lua code:
    tpt.el.elec.menusection=3
    tpt.el.elec.color=0x9555ff
    tpt.el.elec.description="Ball Lightning. Travels in strait lines and bounces of solids. It electrifies conductors. Explodes when Life=1."
    tpt.el.elec.name="BLLT"
    math.randomseed(os.time())
    function ball_lightning(i,x,y,s,n)
    if tpt.get_property("tmp",i)==0 then
    tpt.set_property("life",math.random(50,150),i)
    tpt.set_property("tmp",1,i)
    end
    for n = 1,50 do
    xoff=math.random(-7,7)
    yoff=math.sqrt((49)-(xoff^2))
    if tpt.get_property("type",x+xoff,y+yoff)==0 then
    tpt.create(x+xoff,y+yoff,"ligh")
    tpt.set_property("life",4,x+xoff,y+yoff)
    tpt.set_property("tmp",math.atan2(-yoff,xoff)/3.14159*180,x+xoff,y+yoff)
    tpt.set_property("tmp2",1,x+xoff,y+yoff)
    end
    if tpt.get_property("type",x-xoff,y-yoff)==0 then
    tpt.create(x-xoff,y-yoff,"ligh")
    tpt.set_property("life",4,x-xoff,y-yoff)
    tpt.set_property("tmp",math.atan2(yoff,-xoff)/3.14159*180,x-xoff,y-yoff)
    tpt.set_property("tmp2",1,x-xoff,y-yoff)
    end
    end
    if tpt.get_property("life",i)==1 then
    for yoff=-38,38 do
    for xoff=-math.sqrt((38^2)-(yoff^2)),math.sqrt((38^2)-(yoff^2)) do
    if (x+xoff)>3 and (x+xoff)<608 and (y+yoff)>3 and (y+yoff)<380 then<br/> if tpt.get_property("type",x+xoff,y+yoff)==0 then
    tpt.create(x+xoff,y+yoff,"plsm")
    tpt.set_property("life",30,x+xoff,y+yoff)
    tpt.set_pressure((x+xoff)/4,(y+yoff)/4,1,1,10)
    end
    end
    end
    end
    tpt.delete(i)
    end
    end
    tpt.element_func(ball_lightning,tpt.el.elec.id,1)
  • mniip
    14th Jan 2012 Developer 0 Permalink
    i havent run the script, but i see it will work cool.
    Good idea af using ELEC as base
  • The-Fall
    14th Jan 2012 Member 0 Permalink
    Great job, best yet.
  • ArtMaster
    14th Jan 2012 Banned 0 Permalink
    This post is hidden because the user is banned
  • TPTlover1012
    14th Jan 2012 Banned 0 Permalink
    This post is hidden because the user is banned
  • The-Fall
    14th Jan 2012 Member 0 Permalink
    You should add more code to make it do more. This script has so much potential.

  • SkinnySatinTiger
    14th Jan 2012 Member 0 Permalink
    Edited once by SkinnySatinTiger. Last: 3rd Oct 2022
  • Plasmoid
    14th Jan 2012 Member 0 Permalink
    Awesome. got make it into a mod like this one.
  • plead-for-destruction
    14th Jan 2012 Member 0 Permalink
    @Plamoid (View Post)
    dont advertise
  • MassacreLand
    14th Jan 2012 Member 0 Permalink
    @mniip (View Post)
    This script has never worked for me for some reason xD
    line 30 take out the <br/> LOL