Still working on my floating SEnt, and I can make it float, but it just sits there 'cause I still haven’t found out how to make it bob up and down like I wanted.
I was thinking I could do it with timers, but I can’t work with timers to save my life.
This is what I have:
[lua]
function ENT:PhysicsUpdate(phys)
timer.Create(“floatytimer”, 1, 1, Floaty, phys, 50) //makes the SEnt float upwards as defined in Floaty()
//timer.Stop(“floatytimer”)
end
[/lua]
I have no idea how to get the timer to run, and then reset itself and run the function again after a short while.
With the timer.Stop(“floatytimer”) included, nothing happens.
With it removed, the SEnt begins to float up at a constant rate, but it overloads GMod and CTDs when I remove it.
So I know how to make the thing move and down using SetVelocity(), but not how to make the timer work so it can alternate directions (float up for a second, then float back down, and back up again, etc.)