• SWEP help
    0 replies, posted
I've been making a super shotgun. I've tried my best to make it behave like a shotgun, but it just isn't working! I have a few problems: I can't seem to find the right rate of fire, so that the rate is the same as the normal shotgun. The reload does not behave like a shotgun; it is instant, has the wrong sound, (despite my best efforts to change it) and does not have the correct animation. It is in the pistol menu, and I can't seem to change it. I've looked through the documentation everywhere and I've gotten nothing. I'd like it to be in the shotgun menu. I'm sure there are a lot of other problems I haven't found yet. I was able to fix most of them, but these three have stumped me. Sorry if the answer is totally obvious or something; although I'm skilled at Java, Lua is completely new to me. Here is my current code: <pre> SWEP.Base = "weapon_base" -- Visual/sound settings SWEP.PrintName = "Super Shotgun" SWEP.Slot = 1 SWEP.SlotPos = 4 SWEP.DrawAmmo = true SWEP.DrawCrosshair = true SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 64 SWEP.ViewModel = "models/weapons/v_shotgun.mdl" SWEP.WorldModel = "models/weapons/w_shotgun.mdl" SWEP.ReloadSound = "weapons/shotgun/shotgun_reload2.wav" SWEP.HoldType = "shotgun" -- Other settings SWEP.Weight = 4 SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false SWEP.Spawnable = false SWEP.AdminSpawnable = true -- SWEP info SWEP.Author = "Awesomeness" SWEP.Contact = "" SWEP.Purpose = "" SWEP.Instructions = "Aim away from face." -- Primary fire settings SWEP.Primary.Sound = "weapons/shotgun/shotgun_fire7.wav" SWEP.Primary.Damage = 9999 SWEP.Primary.NumShots = 99 SWEP.Primary.Recoil = 1 SWEP.Primary.Cone = 30 SWEP.Primary.Delay = 0.75 SWEP.Primary.ClipSize = 6 SWEP.Primary.DefaultClip = 99999999 SWEP.Primary.Tracer = 1 SWEP.Primary.Force = 100 SWEP.Primary.TakeAmmoPerBullet = false SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "Buckshot" -- Secondary fire settings SWEP.Secondary.Sound = "" SWEP.Secondary.Damage = 0 SWEP.Secondary.NumShots = 0 SWEP.Secondary.Recoil = 0 SWEP.Secondary.Cone = 0 SWEP.Secondary.Delay = 0 SWEP.Secondary.ClipSize = 0 SWEP.Secondary.DefaultClip = 0 SWEP.Secondary.Tracer = 0 SWEP.Secondary.Force = 0 SWEP.Secondary.TakeAmmoPerBullet = true SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" -- Hooks function SWEP:Initialize() if ( SERVER ) then self:SetWeaponHoldType( self.HoldType ) end end function SWEP:PrimaryAttack() if ( !self:CanPrimaryAttack() ) then return end local bullet = {} -- Set up the shot bullet.Num = self.Primary.NumShots bullet.Src = self.Owner:GetShootPos() bullet.Dir = self.Owner:GetAimVector() bullet.Spread = Vector( self.Primary.Cone / 90, self.Primary.Cone / 90, 0 ) bullet.Tracer = self.Primary.Tracer bullet.Force = self.Primary.Force bullet.Damage = self.Primary.Damage bullet.AmmoType = self.Primary.Ammo self.Owner:FireBullets( bullet ) self.Owner:MuzzleFlash() self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) self.Owner:SetAnimation( PLAYER_ATTACK1 ) self.Weapon:EmitSound(Sound(self.Primary.Sound)) self.Owner:ViewPunch(Angle( -self.Primary.Recoil, 0, 0 )) if (self.Primary.TakeAmmoPerBullet) then self:TakePrimaryAmmo(self.Primary.NumShots) else self:TakePrimaryAmmo(1) end self:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) end function SWEP:SecondaryAttack() end function SWEP:Think() end function SWEP:Reload() self.Weapon:DefaultReload(ACT_VM_RELOAD) return true end function SWEP:Deploy() return true end function SWEP:Holster() return true end function SWEP:OnRemove() end function SWEP:OnRestore() end function SWEP:Precache() end function SWEP:OwnerChanged() end </pre> Ugh, why isn't pre working? Sorry I'm asking so many questions. [editline]12:15AM[/editline] Oh, I found another problem: It only shows three shots when I shoot, when in reality it is shooting 99 bullets. Ugh, I feel so helpless! [editline]12:16AM[/editline] Oh crap, this goes in Lua scripting. How do I move it?
Sorry, you need to Log In to post a reply to this thread.