Im trying to code an element (which name you'll never guess :P) that goes throught other elements like protons and I understand enough of sim.can_move to use it but when I use it to go throught many kinds of elements 1000 pixels are enough to kill the fps. thats the code chunk i used:
for all = 1,255 do
sim.can_move(tpt.element('ntno'), all, 2)
end
How can i make this not laggy? I've seen another script that has this function set for 255 and doesn't lag. (TPTMod script)
Try this? (Swap the all and tpt.element('ntno'))
for i=1,255 do
sim.can_move(i,tpt.element('ntno'),2)
end
It's still laggy :(
Can I see your whole script?
local Ntno = elements.allocate("Ntno", "NTNO")
elements.element(Ntno, elements.element(elements.DEFAULT_PT_ELEC))
elements.property(Ntno, "Name", "NTNO")
elements.property(Ntno, "Colour", 0xFFDFEFFF)
elements.property(Ntno, "Description", "Neutrino, neutral electron, created by beta- decay and matter-antimatter reactions.")
elements.property(Ntno, "Weight", -1)
elements.property(Ntno, "HeatConduct", 0)
elements.property(Ntno, "Temperature", 295.15)
elements.property(Ntno, "Properties" , 0x14010)
elements.property(Ntno, "AirLoss", 1)
elements.property(Ntno, "Loss", 1)
elements.property(Ntno, "Collision", -0.99)
function Ntno(i, x, y, surround, nt)
if tpt.get_property("tmp2", i) == 0 then
local a = (math.random(360)-1) * 0.01745329;
tpt.set_property("life",680,i)
tpt.set_property("vx",10*math.cos(a),i)
tpt.set_property("vy",10*math.sin(a),i)
tpt.set_property("tmp2",1,i)
end
for i = 1,255 do
sim.can_move(i, tpt.element('ntno'), 2)
end
end
tpt.element_func(Ntno, tpt.element('ntno'))
I won't show the whole script because its a ton of code but this is all i got from neutrinos, they're the only particle with sim.can_move (apart from anti-neutrinos) and they're the only that lag.
So how should the sim.cam_move line be? Can you write it please? :3 And thanks for the help.