function some(i,x,y,s,n)
type = tpt.get_property("ctype", x + math.random(-1,1), y + math.random(-1,1))
if type == tpt.el.exot.id then
tpt.set_property("tmp2", 99999, x + math.random(-3,3), y + math.random(-3,3))
end
end
tpt.element_func(some,tpt.el.exot.id)
Can somebody tell me why it says: "autorun.lua:2: Particle does not exist" after I place exot on screen?
Most of the time, the 2nd line will ask for the ctype of a particle that is adjacent to the exot in question.
When this happens, sometimes there will be no particle at that location and it will return an error.
Fix:
function some(i,x,y,s,n)
local xo=math.random(-1,1) local yo=math.random(-1,1)
if tpt.get_property("type", x + xo, y + yo) ~= 0
if tpt.get_property("ctype", x + xo, y + yo) == tpt.el.exot.id then
tpt.set_property("tmp2", 99999, x + math.random(-3,3), y + math.random(-3,3))
end
end
end
tpt.element_func(some,tpt.el.exot.id)
Hope this works.
Edit: Why can't I indent the code?
try replacting tpt.el.exot.id with DEFAULT_PT_EXOT
Hello people! Sorry for using another people thread to post an question but i need to know how do i make an element be surrounded by other element (like shield when sparked).
Thanks always!
NOTE: i've tried using sim.partCreate but it have not worked
Thanks again!
---Please don't ban me for this---