• Bugged animation?
    4 replies, posted
Okay, so the animation is kinda weird... Im using those: self.Owner:SetAnimation(PLAYER_ATTACK1) self.Weapon:SendWeaponAnim(ACT_VM_HITCENTER) under primary attack for my nightstick swep. Heres a video showing the weirdness: [video=youtube;wD67KdUoWfA]https://www.youtube.com/watch?v=wD67KdUoWfA[/video]
Are you resetting the animation to idle animation somewhere in the code? Do you have that view model on the server?
How would i not have the view model when it can be seen? I dont have under the models folder, but i do have a models folder inside my addon if thats what your asking, idk if im resetting animation :/ If you need code tell me.
Post every occurrence of SendWeaponAnim. If you are testing the SWEP in singleplayer or on by starting a listen server (through the game client) then your server has the view model. If you are testing on a dedicated server ( srcds.exe ) and your server DOESN'T have the model, then even if your CLIENT DOES have the model (Which you see on the screen), on the server you will have unpredictable behavior like SequenceDuration() returning 0.
This is the function that makes the animations, attacks the person/npc/bot. [LUA] function SWEP:PrimaryAttack() --self.Owner:SetAnimation(PLAYER_ATTACK1) --self.Weapon:SendWeaponAnim(ACT_VM_HITCENTER) self:SetWeaponHoldType("melee") if( CurTime() < self.NextStrike ) then return; end self.NextStrike = ( CurTime() + 1 ); local trace = self.Owner:GetEyeTrace(); if trace.HitPos:Distance(self.Owner:GetShootPos()) <= 75 then if( trace.Entity:IsPlayer() or trace.Entity:IsNPC() or trace.Entity:GetClass()=="prop_ragdoll" ) then self.Owner:EmitSound( self.FleshHit[math.random(1,#self.FleshHit)] ); else self.Owner:EmitSound( self.Hit[math.random(1,#self.Hit)] ); end self.Owner:SetAnimation(PLAYER_ATTACK1) self.Weapon:SendWeaponAnim(ACT_VM_HITCENTER) bullet = {} bullet.Num = 1 bullet.Src = self.Owner:GetShootPos() bullet.Dir = self.Owner:GetAimVector() bullet.Spread = Vector(0, 0, 0) bullet.Tracer = 0 bullet.Force = 1 bullet.Damage = 2 self.Owner:FireBullets(bullet) else self.Owner:SetAnimation(PLAYER_ATTACK1) self.Weapon:SendWeaponAnim(ACT_VM_HITCENTER) self.Weapon:EmitSound("weapons/iceaxe/iceaxe_swing1.wav") end end [/LUA]
Sorry, you need to Log In to post a reply to this thread.