• Making a SWEP and need some help
    8 replies, posted
Now I have the fileing system down I was just wondering if there is anyway, beside what the templates are doing: [code] function SWEP:PrimaryAttack() if ( !self:CanPrimaryAttack() ) then return end local bullet = {} bullet.Num = 1 bullet.Src = self.Owner:GetShootPos() bullet.Dir = self.Owner:GetAimVector() bullet.Spread = Vector( 10* 0.1 , 10* 0.1, 0) bullet.Tracer = 0 bullet.Force = 100 bullet.Damage = 1000 bullet.AmmoType = "AR2" local rnda = self.Primary.Recoil * -1 local rndb = self.Primary.Recoil * math.random(-1, 1) self:ShootEffects() self.Owner:FireBullets( bullet ) self.Weapon:EmitSound(Sound(self.Primary.Sound)) self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) ) self:TakePrimaryAmmo(self.Primary.TakeAmmo) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay ) end [/code] Is there any other way of having a gun shoot? Because for some reason no matter what I set the damage to it seems to have the same effect, so I was wondering if there is any other way to make it do more damage. Thanks in advance =]
I think that is the only way. Try changing "SWEP.Damage = 50" BTW I know hardly anything about Lua so take precaution when following any advice that I give :D
change this: [lua] SWEP.Primary.Damage = 25 [/lua] to whatever damage you want.
[QUOTE=Chad Mobile;19531437]change this: [lua] SWEP.Primary.Damage = 25 [/lua] to whatever damage you want.[/QUOTE] I have tried to change the damage to a larger amount, but has no effect Any suggestions? And I was also wondering if there is any other way of defining a "bullet", I have saw some people using [code] bullet:SetKeyValue () [/code] does anyone know how to use these?
[QUOTE=joro550;19531703]I have tried to change the damage to a larger amount, but has no effect[/QUOTE] That's crap then. The bullet damage should change unless you aren't restarting Gmod or using lua_reloadents Or you're just trolling (i doubt that ;])
[QUOTE=Chad Mobile;19531778]That's crap then. The bullet damage should change unless you aren't restarting Gmod or using lua_reloadents Or you're just trolling (i doubt that ;])[/QUOTE] Yeah, he's right the damage should have changed. Make sure to restart Garrys Mod. If it doesn't work I haven't got a clue.
[QUOTE=sintwins;19532359]Yeah, he's right the damage should have changed. Make sure to restart Garrys Mod. If it doesn't work I haven't got a clue.[/QUOTE] Haha what do you know, this WAS the problem! I actually forgot to restrt Gmod, oh well! [editline]01:00PM[/editline] [QUOTE=sintwins;19532359]Yeah, he's right the damage should have changed. Make sure to restart Garrys Mod. If it doesn't work I haven't got a clue.[/QUOTE] Haha what do you know, this WAS the problem! I actually forgot to restart Gmod, oh well!
Lol. At least you know :D
Ha, good luck then :buddy:
Sorry, you need to Log In to post a reply to this thread.