• Set a Model Animation
    10 replies, posted
Hi, im coding my own Jumper using the V3 model. I have the animation names but how do i run them? This is what i've got. [code] function ENT:Draw() self.Entity:DrawModel() if LocalPlayer():KeyDown(IN_SPEED) then local sequence = self.Entity:LookupSequence("open") self.Entity:SetSequence("open_seq.SMD") end if LocalPlayer():KeyDown(IN_WALK) then local sequence = self.Entity:LookupSequence("close") self.Entity:SetSequence("close_seq.SMD") end end [/code] Thanks
[QUOTE=Ronon Dex;16602278]Hi, im coding my own Jumper using the V3 model. I have the animation names but how do i run them? This is what i've got. [code] function ENT:Draw() self.Entity:DrawModel() if LocalPlayer():KeyDown(IN_SPEED) then local sequence = self.Entity:LookupSequence("open") self.Entity:SetSequence("open_seq.SMD") end if LocalPlayer():KeyDown(IN_WALK) then local sequence = self.Entity:LookupSequence("close") self.Entity:SetSequence("close_seq.SMD") end end [/code] Thanks[/QUOTE] The animations are all ready run
Yes sorry, thats what i've got to make them run but the problem is, the model goes invisible and nothing happens
I've just acquired the error from the console, its not a lua error i think... Bad sequence (-1 out of 6 max) in GetSequenceLinearMotion() for model 'Votekick/jumper/Jumper_V3.mdl'!
Thats the problem its not working for some reason. I have now made a hook in init.lua that sets the animation and then in cl_init.lua if you press shift the hook runs. But the animation is not working. [editline]05:06PM[/editline] Just incase you need it. Init.lua: [lua] function ENT:OpenDriveAnim() local sequence = self.Entity:LookupSequence("open") -- open_seq.SMD self.Entity:SetSequence(sequence) end hook.Add( "Think", "drive_pods_open", OpenDriveAnim ) function ENT:CloseDriveAnim() local closePOD = self.Entity:LookupSequence("close_seq") self.Entity:SetSequence(closePOD) end hook.Add( "Think", "drive_pods_close", CloseDriveAnim ) [/lua] cl_init.lua: [lua] function ENT:Think() if( input.IsKeyDown(KEY_LSHIFT) ) then if( not pressed ) then pressed = true hook.Call( drive_pods_open, gmod.GetGamemode() ) end else if( pressed ) then pressed = false; return end end end [/lua] Also the Animation info: [code] $sequence open "open_seq.SMD" fps 15 $sequence close "close_seq.SMD" fps 15 [/code] Thanks
Ok so you're switching constatly?
Basically, the i want the drive pods to open when you press shift, but the animation isn't running no matter what i do. Any Help?
[lua] function ENT:OpenDriveAnim() local sequence = self.Entity:LookupSequence("open") -- open_seq.SMD self.Entity:SetSequence(sequence) end hook.Add( "Think", "drive_pods_open", OpenDriveAnim ) function ENT:CloseDriveAnim() local closePOD = self.Entity:LookupSequence("close_seq") self.Entity:SetSequence(closePOD) end hook.Add( "Think", "drive_pods_close", CloseDriveAnim ) [/lua] I meant them!! If you're running them on the same time you really fuck it up!
Why the fuck you want to constantly set the animation? Just do it once.
I've got it doing what i want now its not a problem
Sorry, you need to Log In to post a reply to this thread.