Re: Making 2 Timers - HELP!
Petethegoat wrote:
At a glance, i would suggest that you have missed a couple of semi colons, in function Create(self) especially.
The function Destroy(self)/end can be removed entirely.
Yo dawg lua doesn't need semicolons syntactically unless you're doing many things on the same line.
Code:
function Update(self)
if self.Timer:IsPastSimMS(20) then
SceneMan:CastObstacleRay(self.Pos,(self.Vel/self.Vel.Magnitude)*750,self.rayhit,self.raymiss,-1,0,2);
if ((self.rayhit - self.Pos).Magnitude) < 7 and self.hasburst == false and not self.rayhit:IsZero() then
self.LifeTimer:Reset()
end
end
if self.LifeTimer:IsPastSimMS(500) then
self:GibThis();
self.hasburst = true
end
if self.hasburst then
self.burst.RotAngle = self.Vel.AbsRadAngle;
self.burst.Vel = self.Vel*20;
self.burst.Pos = self.Pos;
MovableMan:AddParticle(self.burst);
self:GibThis();
end
end
StartTimeMS() doesn't do anything to the value what are you smoking. Use Reset(), fixed for you, didn't touch anything else don't know if they're broken either learn to print values to debug.