• Secondary fire shoots shotgun blast - nothing in code which suggest it should - help!
    4 replies, posted
Title [code]SWEP.Contact = "Asmaedus on FP" SWEP.Purpose = "Space Marine Bolter" SWEP.Instructions = "" SWEP.Spawnable = true SWEP.AdminSpawnable = false SWEP.ViewModel = "models/weapons/v_rif_bolter.mdl" SWEP.WorldModel = "models/weapons/w_rif_bolter.mdl" SWEP.Primary.Sound = Sound( "Weapon_AR2.Single" ) SWEP.Primary.Automatic = true SWEP.Primary.ClipSize = 30 SWEP.Primary.DefaultClip = 6000 SWEP.Primary.Ammo = "pistol" SWEP.Primary.Delay = 0.10 SWEP.Primary.Damage = 27 SWEP.Primary.ReloadSound = Sound( "sound\weapons\boltgun\Boltgun_clipout.wav" ) SWEP.Primary.ReloadTime = 3.1 if ( SERVER ) then AddCSLuaFile( "shared.lua" ) SWEP.HoldType = "ar2" SWEP.Weight = 15 SWEP.AutoSwitchTo = true SWEP.AutoSwitchFrom = false end if ( CLIENT ) then SWEP.PrintName = "Boltgun" SWEP.Author = "Asmaedus" SWEP.Slot = 3 SWEP.SlotPos = 3 SWEP.IconLetter = "r" SWEP.DrawCrosshair = true SWEP.DrawAmmo = true SWEP.ViewModelFlip = false SWEP.CSMuzzleFlashes = true surface.CreateFont( "csd", ScreenScale( 30 ), 500, true, true, "CSKillIcons" ) surface.CreateFont( "csd", ScreenScale( 60 ), 500, true, true, "CSSelectIcons" ) killicon.AddFont( "weapon_antitank", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) ) end function SWEP:Precache() util.PrecacheSound(self.Primary.Sound) end function SWEP:Initialize() if ( SERVER ) then self:SetWeaponHoldType( self.HoldType ) end self.Weapon:SetNetworkedBool( "Scoped", false ) self:Precache() end function SWEP:Think() if (CLIENT) then return end if self.Owner:GetFOV() == 90 then self.Weapon:SetNetworkedBool( "Scoped", false ) self.Owner:DrawViewModel(true) self.DrawCrosshair = true else self.Weapon:SetNetworkedBool( "Scoped", false ) self.Owner:DrawViewModel(true) self.DrawCrosshair = true end end function SWEP:Reload() self.Weapon:SetNetworkedBool( "Scoped", false ) if (SERVER) then self.Owner:SetFOV(90,.3) end self.Weapon:DefaultReload(ACT_VM_RELOAD) self.Weapon:EmitSound(self.Primary.ReloadSound) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.ReloadTime ) end function SWEP:TakePrimaryAmmo( num ) if ( self.Weapon:Clip1() <= 0 ) then if ( self:Ammo1() <= 0 ) then return end self:Reload() self.Owner:RemoveAmmo( num, self.Weapon:GetPrimaryAmmoType() ) return end self.Weapon:SetClip1( self.Weapon:Clip1() - num ) end function SWEP:PrimaryAttack() if ( !self:CanPrimaryAttack() ) then return end self:TakePrimaryAmmo( 1 ) self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) self.Owner:SetAnimation( PLAYER_ATTACK1 ) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self.Weapon:EmitSound( self.Primary.Sound, 200, 200 ) local trace={} trace.start=self.Owner:GetShootPos() trace.endpos=self.Owner:GetShootPos()+self.Owner:GetForward()*2000000000 trace.filter=self.Owner local tracer = util.TraceLine( trace ) if tracer.Hit then local effect = EffectData() effect:SetEntity( self.Owner ) effect:SetStart( self.Owner:GetShootPos() + self.Owner:GetRight()) effect:SetAttachment( 1 ) effect:SetOrigin( tracer.HitPos ) effect:SetScale( 0.1 ) effect:SetMagnitude( 0.2 ) local fx = EffectData() fx:SetOrigin(tracer.HitPos) fx:SetScale(0.5) util.Effect( "HelicopterMegaBomb", fx ) local fx2 = EffectData() fx2:SetOrigin(tracer.HitPos) fx2:SetScale(0.1) util.Effect( "Explosion", fx2 ) util.BlastDamage(self.Owner,self.Owner,tracer.HitPos,128,self.Primary.Damage) local trace2={} trace2.start=tracer.HitPos + self.Owner:GetAimVector()*32 trace2.endpos=tracer.HitPos + self.Owner:GetAimVector()*2000000000 trace2.filter=trace.Entity local tracer2 = util.TraceLine( trace2 ) util.BlastDamage(self.Owner,self.Owner,tracer2.HitPos,64,self.Primary.Damage) if tracer2.Hit then local fx3 = EffectData() fx3:SetOrigin(tracer2.HitPos) fx3:SetScale(0.5) util.Effect( "HelicopterMegaBomb", fx3 ) local fx4 = EffectData() fx4:SetOrigin(tracer2.HitPos) fx4:SetScale(0.1) util.Effect( "Explosion", fx4 ) local trace3={} trace3.start=tracer2.HitPos + self.Owner:GetAimVector()*32 trace3.endpos=tracer2.HitPos + self.Owner:GetAimVector()*2000000000 trace3.filter=tracer2.Entity local tracer3 = util.TraceLine( trace3 ) util.BlastDamage(self.Owner,self.Owner,tracer3.HitPos,64,self.Primary.Damage) if tracer3.Hit then local fx6 = EffectData() fx6:SetOrigin(tracer3.HitPos) fx6:SetScale(0.5) util.Effect( "HelicopterMegaBomb", fx6 ) local fx7 = EffectData() fx7:SetOrigin(tracer3.HitPos) fx7:SetScale(0.1) util.Effect( "Explosion", fx7 ) local trace4={} trace4.start=tracer3.HitPos + self.Owner:GetAimVector()*32 trace4.endpos=tracer3.HitPos + self.Owner:GetAimVector()*2000000000 trace4.filter=tracer3.Entity local tracer4 = util.TraceLine( trace4 ) if tracer4.Hit then util.BlastDamage(self.Owner,self.Owner,tracer4.HitPos,64,self.Primary.Damage) local fx8 = EffectData() fx8:SetOrigin(tracer4.HitPos) fx8:SetScale(0.5) util.Effect( "HelicopterMegaBomb", fx8 ) local fx9 = EffectData() fx9:SetOrigin(tracer4.HitPos) fx9:SetScale(0.1) util.Effect( "Explosion", fx9 ) local trace5={} trace5.start=tracer4.HitPos + self.Owner:GetAimVector()*32 trace5.endpos=tracer4.HitPos + self.Owner:GetAimVector()*2000000000 trace5.filter=tracer4.Entity local tracer5 = util.TraceLine( trace5 ) if tracer5.Hit then util.BlastDamage(self.Owner,self.Owner,tracer5.HitPos,64,self.Primary.Damage) local fx10 = EffectData() fx10:SetOrigin(tracer5.HitPos) fx10:SetScale(0.5) util.Effect( "HelicopterMegaBomb", fx10 ) local fx11 = EffectData() fx11:SetOrigin(tracer5.HitPos) fx11:SetScale(0.1) util.Effect( "Explosion", fx11 ) end end end end end end function SWEP:DrawHUD() if self.Weapon:GetNetworkedBool( "Scoped" ) == true then local Col = Color( 0, 0, 20, 255 ); draw.RoundedBox( 0, 0, 0, ScrW(), ScrH(), Color( 0, 0, 255, math.Rand(40,65) )) // main borders draw.RoundedBox( 0, 0, 0, ScrW(), 100, Col) draw.RoundedBox( 0, 0, ScrH() - 100, ScrW(), 100, Col) draw.RoundedBox( 0, 0, 100, 100, ScrH() - 200, Col) draw.RoundedBox( 0, ScrW() - 100, 100, 100, ScrH() - 200, Col) // Center cross surface.SetDrawColor( 0, 0, 0, 255 ) surface.DrawLine( 0, ScrH() / 2, ScrW() / 2 , ScrH() / 2) surface.DrawLine( ScrW() / 2, ScrH() / 2, ScrW(), ScrH() / 2) surface.DrawLine( ScrW() / 2, 0, ScrW() / 2, ScrH() / 2) surface.DrawLine( ScrW() / 2, ScrH() / 2, ScrW() / 2, ScrH()) end end [/code] I cannot find anything suggesting a shotgun blast, nor a secondary fire itself. I am stumped.
It's because for some reason Garry made the secondary fire of the base SWep act like a shotgun. Just override the secondary fire with a blank one.
And in case you dunno how: [lua] function SWEP:SecondaryAttack() end[/lua]
Thank you all!
No problem.
Sorry, you need to Log In to post a reply to this thread.