• Timer Error
    3 replies, posted
Not going to bother posting the full code but this is the part giving me problems... [CODE] self.Owner:EmitSound("weapons/gauss/chargeloop.wav") timer.Simple(4.5,self.Owner:StopSound("weapons/gauss/chargeloop.wav")) timer.Simple(4.6,self.Owner:EmitSound("HL1/fvox/beep.wav")) [/CODE] My timers are failing and I'm apparently too stupid to undersand why - Timer Error: attempt to call a nil value
You are passing the return values to those functions to the timer as the callback, here is how you should do it: [lua]timer.Simple(4.5, self.Owner.StopSound, self.Owner, "weapons/gauss/chargeloop.wav") timer.Simple(4.6, self.Owner.EmitSound, self.Owner, "HL1/fvox/beep.wav")[/lua]
[QUOTE=MakeR;20883427]You are passing the return values to those functions to the timer as the callback, here is how you should do it: timer.Simple(4.5, self.Owner.StopSound, self.Owner, "weapons/gauss/chargeloop.wav") timer.Simple(4.6, self.Owner.EmitSound, self.Owner, "HL1/fvox/beep.wav") [/QUOTE] I'm not quite sure I understand what you're saying but I think I understand the layout, so thank you. So... if I am seeing this right and wanred it to reload after the timer I'd use something like... timer.Simple(4.5, self.Owner.SetAnimation, self.Owner, ACT_VM_RELOAD) ?
[QUOTE=NnyAskC;20884015]I'm not quite sure I understand what you're saying but I think I understand the layout, so thank you. So... if I am seeing this right and wanred it to reload after the timer I'd use something like... timer.Simple(4.5, self.Owner.SetAnimation, self.Owner, ACT_VM_RELOAD) ?[/QUOTE] Exactly.
Sorry, you need to Log In to post a reply to this thread.