Can Somebody help me make a function that make URAN produce a particle(ex.PROT) every 2 seconds? I can't figure out how(if its even possible)
Just make a variable and if variable%120==0 then make prot
(My lua is bad thats persuocode) (It's 120 since the fps is 60 I'm not sure get jacob1)
I made something,but it might not be what you mean. it releases a steady amount, but keeps the numbers emitted down so that it's not flooding the screen.
or did you mean every 2 seconds every particle would release one?
Even better, you could use the os.clock() function to get how many seconds have elapsed.
Actually, now that I think about it, that's maybe not as good an idea, then it would behave differently for different users. It would still be a good idea to add a little randomization, maybe:
local frame, lapse = 0, 120
function uran_update_function(i, x, y, s, n)
frame = frame + 1
if frame % lapse == 0 then
make_a_particle(stuff, x + math.random(-2,2), y + math.random(-2,2))
lapse = math.floor(math.random(60, 180))
end
end
FeynmanLogomaker:
Even better, you could use the os.clock() function to get how many seconds have elapsed.
Actually, now that I think about it, that's maybe not as good an idea, then it would behave differently for different users. It would still be a good idea to add a little randomization, maybe:
local frame, lapse = 0, 120
function uran_update_function(i, x, y, s, n)
frame = frame + 1
if frame % lapse == 0 then
make_a_particle(stuff, x + math.random(-2,2), y + math.random(-2,2))
lapse = math.floor(math.random(60, 180))
end
end
seems to be similar but cleaner- though depending on what particle you emit(prot,for example), there will be a LOT of that particle on screen
boxmein:
@FeynmanLogomaker (View Post)
I suppose it's better off to make this reaction frame-based as well, since the entirety of TPT operates on frames, however in other cases I'd use your time-based method to accomplish this.
how do you get frame btw?
local frame = 0
tpt.register_step(function()
if frame == 60
frame = 0
-- do stuff here, will happen every 60 frames
end
frame = frame + 1
end)