My first element SHEG

  • KOTOM
    30th Sep 2013 Member 0 Permalink
    --I dont know why i do this.
    local element1 = elements.allocate("KSMOD", "SHEG")
    elements.element(elements.KSMOD_PT_SHEG, elements.element(elements.DEFAULT_PT_HYGN))
    elements.property(elements.KSMOD_PT_SHEG, "Name", "SHEG")
    elements.property(elements.KSMOD_PT_SHEG, "Description", "Strange heavy gas. Very explosive.")
    elements.property(elements.KSMOD_PT_SHEG, "Colour", 0xFFFF0080)
    elements.property(elements.KSMOD_PT_SHEG, "MenuSection", 10)
    elements.property(elements.KSMOD_PT_SHEG, "Gravity", 0.5)
    elements.property(elements.KSMOD_PT_SHEG, "Flammable", 10000)
    elements.property(elements.KSMOD_PT_SHEG, "Explosive", 1)
    elements.property(elements.KSMOD_PT_SHEG, "Weight", 0)
    elements.property(elements.KSMOD_PT_SHEG, "Diffusion", 0)
    elements.property(elements.KSMOD_PT_SHEG, "Hardness", 0)
     
    local function SHEG(i,x,y,s,n)
    local c=math.random(0,300)
     if c==60 then
      tpt.set_property("dcolour",0xFFFF0080,i)
     end
     if c==120 then
      tpt.set_property("dcolour",0xFFFF2080,i)
     end
     if c==180 then
      tpt.set_property("dcolour",0xFFFF4080,i)
     end
     if c==240 then
      tpt.set_property("dcolour",0xFFFF60080,i)
     end
     if c==300 then
      tpt.set_property("dcolour",0xFFFF8080,i)
     end
    --Creating SEG function begin
     local s=math.random(0,20000)
     if s==60 then
      tpt.create(x + math.sin(math.random(0, 4)), y + math.cos(math.random(0, 4)), "SEG")
          end
    --Creating SEG function end
    end
    tpt.element_func(SHEG,elements.KSMOD_PT_SHEG)
     
    local element2 = elements.allocate("KSMOD", "SEG")
    elements.element(elements.KSMOD_PT_SEG, elements.element(elements.DEFAULT_PT_CAUS))
    elements.property(elements.KSMOD_PT_SEG, "Name", "SEG")
    elements.property(elements.KSMOD_PT_SEG, "Description", "Produced by SHEG.")
    elements.property(elements.KSMOD_PT_SEG, "Colour", 0xFFFF8080)
    elements.property(elements.KSMOD_PT_SEG, "MenuSection", 10)
    elements.property(elements.KSMOD_PT_SEG, "MenuVisible", 0)
    elements.property(elements.KSMOD_PT_SEG, "Gravity", -0.2)
     
    function SEG(i, x, y, s, n)
     tpt.set_property("life", "100", x, y)
     tick1 = math.random(1, 10)
     if tick1 == 1 then
      xxx = {1,-1,1,-1,1,0,-1,0}
      yyy = {1,-1,-1,1,0,1,0,-1}
      for l = 1, 8 do
       tpt.set_property("type", "NONE", x+xxx[l], y+yyy[l])
      end
     end
     tick2 = math.random(0, 300)
     if tick2 == 50 then
      tpt.delete(x, y)
     end
    end
    tpt.element_func(SEG,elements.KSMOD_PT_SEG)
     
    In this script i used parts of other scripts:
    MrSalit0s's mod - GOLD color script
    FeynmanLogomaker's BPDR mod - some element properties
    powderisfalling's PowderIsFallingMod 2.0.0 - part of WFLM code
    Luezma's mod - part of SMKS code (as an example of using tpt.create function)
    Thanx to these guys. Sorry for using your code. I dont know LUA =)
     
    And sorry for not using code tags, it not working for me for some reason.
    Edited 4 times by KOTOM. Last: 30th Sep 2013