• SWEP Shotgun Reload malfunctioning in MP
    2 replies, posted
Hey, for some reason my weapon doesn't reset viewmodel animations in multiplayer. If I call, for example, ACT_VM_RELOAD once after the other, it stays stuck on the last frame. Any ideas? I can explain any questions you have regarding how this works or what each part does.. Code here: [url]http://pastebin.com/cSWXU17S[/url] [code] function SWEP:ProcessTimers() if self.Callback.ProcessTimers then local val = self.Callback.ProcessTimers(self) if val then return val end end local isreloading,isshooting,isdrawing,isholstering, issighting, issprinting, htv, hudhangtime, isbolttimer, isinspecting isreloading=self:GetReloading() isshooting=self:GetShooting() isdrawing=self:GetDrawing() isholstering=self:GetHolstering() issighting=self:GetIronSights() issprinting=self:GetSprinting() isbursting = self:GetBursting() ischangingsilence = self:GetChangingSilence() isfiremodechanging = self:GetFireModeChanging() isinspecting = self:GetInspecting() htv = self:GetHUDThreshold() hudhangtime = 1 if self:OwnerIsValid() then if SERVER then hudhangtime = self.Owner:GetInfoNum("cl_tfa_hud_hangtime",1) else hudhangtime = GetConVarNumber("cl_tfa_hud_hangtime",1) end end isbolttimer = self:GetBoltTimer() if isdrawing and CurTime()>self:GetDrawingEnd() then local vm = self.Owner:GetViewModel() if IsValid(vm) then self.DefaultAtt = vm:GetAttachment(self:GetFPMuzzleAttachment()) end self:SetDrawing(false) isdrawing=false end if isbolttimer and CurTime()>self:GetBoltTimerEnd() then self:SetBoltTimer(false) self:SetBoltTimerStart(CurTime()-1) self:SetBoltTimerEnd(CurTime()-1) end if isreloading and CurTime()>self:GetReloadingEnd() then if !self.Shotgun then self:CompleteReload() isreloading = false else if (self:GetShotgunInsertingShell() == false) then if !self:GetShotgunPumping() then if self.StartAnimInsertShell then local maxclip=self.Primary.ClipSize local curclip = self:Clip1() local ammopool = self:GetAmmoReserve() local amounttoreplace=1 self:SetClip1(curclip+amounttoreplace) self.Owner:RemoveAmmo(amounttoreplace, self.Primary.Ammo) self.StartAnimInsertShell = false self:SetReloading(true) self:SetReloadingEnd(CurTime()+0) self:SetNextPrimaryFire( CurTime() + 0.01 ) else self:SetShotgunInsertingShell(true) self.Weapon:SendWeaponAnim(ACT_VM_RELOAD) self:ResetEvents() if IsValid(self.Owner) then local vm = self.Owner:GetViewModel() if !self.ShellTime and IsValid(vm) then self:SetReloadingEnd(CurTime()+vm:SequenceDuration( vm:SelectWeightedSequence(ACT_VM_RELOAD) ) ) self:SetNextPrimaryFire( CurTime()+ ( self.SequenceLengthOverride[ACT_VM_RELOAD] and self.SequenceLengthOverride[ACT_VM_RELOAD] or vm:SequenceDuration( vm:SelectWeightedSequence(ACT_VM_RELOAD) ) ) ) else self:SetReloadingEnd(CurTime()+self.ShellTime) self:SetNextPrimaryFire( CurTime()+ self.ShellTime ) end else self:SetReloadingEnd(CurTime()+self.ShellTime) self:SetNextPrimaryFire( CurTime()+ self.ShellTime ) end self:SetReloading(true) isreloading=true end else self:SetReloading(false) self:SetShotgunPumping(false) self:SetReloadingEnd(CurTime()-1) self:SetNextPrimaryFire( CurTime() + 0.01 ) isreloading=false self:SetHUDThreshold(true) self:SetHUDThresholdEnd(CurTime() + hudhangtime) end else local maxclip=self.Primary.ClipSize local curclip = self:Clip1() local ammopool = self:GetAmmoReserve() if curclip>=maxclip or ammopool<=0 or self:GetShotgunNeedsPump() then self:SetShotgunInsertingShell(false) self:SendWeaponAnim(ACT_SHOTGUN_RELOAD_FINISH) if IsValid(self.Owner) then local vm = self.Owner:GetViewModel() if IsValid(vm) then self:SetReloadingEnd(CurTime()+vm:SequenceDuration( vm:SelectWeightedSequence(ACT_SHOTGUN_RELOAD_FINISH) ) ) self:SetNextPrimaryFire( CurTime()+ ( self.SequenceLengthOverride[ACT_SHOTGUN_RELOAD_FINISH] and self.SequenceLengthOverride[ACT_SHOTGUN_RELOAD_FINISH] or vm:SequenceDuration( vm:SelectWeightedSequence(ACT_SHOTGUN_RELOAD_FINISH) ) ) ) else self:SetReloadingEnd(CurTime()+self.ShellTime) self:SetNextPrimaryFire( CurTime()+ self.ShellTime ) end else self:SetReloadingEnd(CurTime()+self.ShellTime) self:SetNextPrimaryFire( CurTime()+ self.ShellTime ) end self:SetReloading(true) self:SetShotgunPumping(true) self:SetShotgunNeedsPump(false) else local amounttoreplace=1 self:SetClip1(curclip+amounttoreplace) self.Owner:RemoveAmmo(amounttoreplace, self.Primary.Ammo) curclip = self:Clip1()
I have the same issue with ACT_VM_HOLSTER; it just makes the model disappear than never resets it.
Custom viewmodel entity away we go.... Edit: Having the same issue when using ResetSequence in a clientside model.
Sorry, you need to Log In to post a reply to this thread.