the code from my first post is still working with normal tpt (83.0).. idk if it works with the current beta. could be that the free element slot BRAN have been taken out and/or that Lua is not fully implemented yet.
@mrsalit0s I am using 83.0 but for some odd reason it says I need End after every line of Lua code I just labeled down in my previous message. Or it says element doesn't exist and I know BRAN still exists because I go to the life elements every day on accident.
copy the code into your editor and save it as "neon.lua". then add the following to your autorun.lua or type it into the console:
dofile("neon.lua")
you should find NEON in the gas section then.
the BRAN i used is not the life element.. it is called BRAN too but it is a free, not used element slot.
look at this post for a better explanation @jacob1 (View Post).
follow the description above and try it again, it should work without any problems.
here is the code again (without graphics funktion):tpt.el.bran.menu=1
tpt.el.bran.enabled=1
tpt.el.bran.menusection=5
tpt.el.bran.name="NEON"
tpt.el.bran.description="Neon gas - glows in contact with electricity"
tpt.el.bran.color=0x00242424
tpt.el.bran.gravity=0
tpt.el.bran.diffusion=1
tpt.el.bran.advection=2
tpt.el.bran.properties=0x4828
tpt.el.bran.flammable=0
tpt.el.bran.heat=295
tpt.el.bran.weight=0
tpt.el.bran.airloss=1
local colour={0xFFAA0000,0xFFFF6600,0xFFFFFF00,0xFF00FF00,0xFF00FFFF,0xFF0000FF,0xFF9900CC}
local none=0x00242424
function neon(i,x,y,s,n)
if tpt.get_property("tmp",i)== 0 then
tpt.set_property("tmp",1,i)
end
if tpt.get_property("tmp2",i)== 1 then
tpt.set_property("life",150+math.random(0,20),i)
tpt.set_property("tmp2",0,i)
end
if tpt.parts[i].life<=0 then
tpt.set_property("dcolour",none,i)
end
end
function neonsprk(i,x,y,s,n)
local ntmp=tpt.get_property("tmp",tpt.el.bran.id)
type=tpt.get_property("ctype",x+math.random(-1,1),y+math.random(-1,1))
if tpt.get_property("ctype",i)==tpt.el.bran.id then
if tpt.get_property("tmp",i)==ntmp then
tpt.set_property("dcolour",colour[ntmp],i)
tpt.set_property("tmp2",1,i)
end
if tpt.get_property("tmp",i)==8 then
tpt.set_property("dcolour",colour[math.random(1,7)],i)
tpt.set_property("tmp2",1,i)
end
end
end
tpt.element_func(neon,tpt.el.bran.id)
tpt.element_func(neonsprk,tpt.el.sprk.id)
Didn't work dude i made a new folder named "neon.lua" then put it in my TPT folder that also has autorun.lua and it says cannot open file no such file or directory and i typed EXACTLy defoile("autorun.lua") and i tried dofile("neon.lua")
EDIT: oops i saw it in there..
not a new folder, a new .lua
copy the code into your editor, save it as neon.lua and put the neon.lua into your TPT directory. then open TPT and type dofile("neon.lua") into the console.
Nice, mrsalit0s
Great effects.
wow i never even knew that elements could be made with lua ._. i don't even know any lua._. could this kind of element scripting be used in my mod? make elements with lua? the syntax of cpp seems more confusing to me.