:( if you really want to help me , here the script:
local success , err = pcall(function()
local DST2 = elements.allocate("NUCULAR","DST2")
elements.element(elements.NUCULAR_PT_DST2, elements.element(elements.DEFAULT_PT_DEST))
elements.property(elements.NUCULAR_PT_DST2, "Name", "DST2")
elements.property(elements.NUCULAR_PT_DST2, "Description", "BOOOM")
function dst2_update(i,x,y,s,n)
local succes , error = pcall(function()
tpt.set_property("type","dest",x-13,y-26,26,26)
tpt.set_property("type","dmg",x-2.5,y-5,5,5)
tpt.set_property("type","fire",x,y+8,10,10)
tpt.set_property("type","sing",x,y-20,10,10)
tpt.set_property("type","thdr",x-10,y-20,10,10)
--tpt.set_property("temp",99999,x-20,y-20,40,40)
sim.partCreate(3, x+1, y, "caus" , 10 , 10)
tpt.set_property("temp",10000,x-50,y,100,100)
end)
if succes then
else
end
end
tpt.element_func(dst2_update, elements.NUCULAR_PT_DST2)
end)
if succes then
else
print(err)
end
i use lua to mod tpt quite a bit (i'm making a mod), but i still can't understand this code. however, something seems fishy about it. lua update functions can cause lag when there is too much of the element on the screen (i found that out with my chocolate element which uses sim.neighbors to detect a stkm).
what is local succes , error = pcall(function()
supposed to do? because i haven't seen local used that way before
thank you ! :D
the fact of usingif math.random(1,10) works, my games no longer lag (well yes, it lags because the explosion produced in very powerful but) its no longer lagging due to the number of particles
I used pcall (function () because there were errors which said that the coordinates were invalid when the dst2 was on the edge of the screen. I knew the pcall because on another games where I code we often have to use for actions which can have many ways to produce an error