Garry's Mod

Garry's Mod

FiLzO's Tactical Weaponry [BASE]
 This topic has been pinned, so it's probably important
filz0  [developer] 24 Mar, 2016 @ 9:29am
>HOW TO SWEP<
Templates for all files:

(YourSwepFolder/lua/weapons/swep_ft_template/shared.lua)

if(SERVER)then AddCSLuaFile("shared.lua") SWEP.Weight = 5 end SWEP.Base = "swep_ft_base" SWEP.WorldModel = "models/weapons/w_pistol.mdl" -- World Model. SWEP.WeaponType = "SMG" -- // "Pistol" // "Assault" // "HMG" // "PShotgun" // "AShotgun" // "SSniper" // "ASniper" // "Rocket" -- A = Auto / S = Semi / P = Pump SWEP.BurstFire = false -- Enable/Disable burst fire mode. true = Only burst fire / false = Normal full auto. SWEP.BurstDelay = 1 -- Delay between burst shoots SWEP.BurstCount = 1 -- Amount of bursted shoots. SWEP.CustomMuzzle = true -- Allow custom muzzleflash. SWEP.CustomShell = true -- Allow custom shell eject. SWEP.ShellEffect = "ft_shelleject_rifle" -- // "ft_shelleject" // "ft_shelleject_shotgun" SWEP.MuzzleEffect = "ft_muzzle_rifle" -- // "ft_muzzle_highcal" // "ft_muzzle_hmg" // "ft_muzzle_pistol" // "ft_muzzle_silenced" SWEP.AllowFlashLight = false -- Enable flashlight. SWEP.FlashLightSound = Sound("FFflash.On") SWEP.F = 0 -- Forward ---\ SWEP.U = 0 -- Up ---------> Flashlight position. SWEP.R = 2 -- Right -----/ SWEP.CR = 90 -- Flashlight Color RED. SWEP.CG = 190 -- Flashlight Color GREEN. SWEP.CB = 255 -- Flashlight Color BLUE. SWEP.AllowTacticalLaser = false -- Enable tactical laser. SWEP.TacticalLaserSound = Sound("FFlaser.On") SWEP.F2 = 0 -- Forward ---\ SWEP.U2 = 0 -- Up ---------> Tactical laser position. SWEP.R2 = 2 -- Right -----/ SWEP.CR2 = 255 -- Laser Color RED. SWEP.CG2 = 0 -- Laser Color GREEN. SWEP.CB2 = 0 -- Laser Color BLUE. SWEP.Tracer = "ft_tracer_two" -- "ft_tracer_two_ia" (FlameAmmo) // ft_tracer_one (Heavy Cal/Snipers) // ft_tracer_two_plsm (PlasmaAmmo) SWEP.PenTracer = "ft_tracer_pen" -- Tracer of penetration. SWEP.Primary.Sound = Sound("FTm4a1.Fire") -- Fire sound. SWEP.ReloadSound = Sound("FTm4a1.Reload") -- Reload sound. SWEP.IdleReloading = true -- Auto reload if NPC has no enemy or didn't saw his enemy for a short time. SWEP.ManualReload = false -- Manual reload. Instead of reloading whole mag, NPC will load all rounds manually. SWEP.DropMagOnReload = false -- Drop empty magazine when reloading. SWEP.MagPosR = 0 -- Magazine position Right. SWEP.MagPosF = 0 -- Magazine position Forward. SWEP.MagPosU = 0 -- Magazine position Up. SWEP.MagAngX = 0 -- Magazine position Right. SWEP.MagAngY = 0 -- Magazine position Forward. SWEP.MagAngZ = 0 -- Magazine position Up. SWEP.MagModel = "models/props_junk/PopCan01a.mdl" -- Magazine model. SWEP.♥♥♥♥♥ound = Sound("FTm3_s.♥♥♥♥") -- Shotgun pump / Sniper bolt sound. (If Semi) SWEP.RocketSound = Sound("FTmatador.Rocket") -- Rocket sound. SWEP.Primary.DistantSound = Sound("weapons/ft_base/ft_gunshot_far_dist.wav") -- Long distance gunshot sound. SWEP.AllowGrenadeLauncher = true -- Enable grenade launcher SWEP.NadeType = "ft_nade_explo" -- // "ft_nade_flame" incendiary grenade // "ft_nade_cryo" cryogenic grenade SWEP.GrenadeLauncherSound = Sound("FFgl.Fire") -- grenade launcher sound. SWEP.Spread = Vector(0.04,0.04,0) -- Fire spread. SWEP.MaxSpread = 5 -- Maximal spread multiplier. SWEP.AddSpread = 0.5 -- Value added to spread multiplier after every shot. SWEP.AddSpreadBonus = 0.5 -- Additional value added to spread multiplier while running. SWEP.CSpreadRecoil = true -- NPCs are able to control thier spread/recoil on most weapon types (Pistol, Assault, AShotgun, SMG, HMG) SWEP.Damage = 10 -- Weapon damage. SWEP.Force = 9 -- Bullets force. SWEP.MaxPenetration = 18 -- Maximal penetration force. SWEP.PenDMGMul1 = 0.1 -- Stuff made of METAL. SWEP.PenReduceMul1 = math.random(4.0, 4.5) -- Stuff made of METAL. SWEP.PenDMGMul2 = 0.4 -- Things like walls. (Concrete) SWEP.PenReduceMul2 = math.random(3.0, 3.5) -- Things like walls. (Concrete) SWEP.PenDMGMul3 = 0.8 -- Stuff made of Wood, Plastic. SWEP.PenReduceMul3 = math.random(2.0, 2.5) -- Stuff made of Wood, Plastic. SWEP.PenDMGMul4 = 0.9 -- Stuff made of flesh. (NPCs, Players, etc) SWEP.PenReduceMul4 = math.random(1.0, 1.5) -- Stuff made of flesh. (NPCs, Players, etc) SWEP.PenDMGMul5 = 0.95 -- Glass. SWEP.PenReduceMul5 = math.random(0.1, 0.5) -- Glass. SWEP.Primary.NumShots = 1 -- Number of fired bullets. SWEP.ClipNPC = 35 -- Clip size. SWEP.ClipNPCDef = 35 -- Default clip size. SWEP.Primary.Delay = 0.3 -- Delay between shots. SWEP.Primary.Ammo = "smg1" -- Ammo type. SWEP.RocketType = "ft_rocket" -- Rocket Launcher ammo type. "ft_rocket" // "ft_rocket_flame" // "ft_rocket_cryo" SWEP.RocketModel = "models/weapons/w_missile_closed.mdl" -- Missile model. SWEP.RocketMaxSpeed = 2000 -- Maximal speed of the missile. SWEP.RocketAddSpeed = 50 -- Value that will be added to the missile speed over time. SWEP.GrenadeType = "ft_grenade_explo" -- Grenade Launcher ammo type. "ft_grenade_explo" // "ft_grenade_flame" // "ft_grenade_cryo" SWEP.GrenadeModel = "models/Items/AR2_Grenade.mdl" -- Grenade model. SWEP.IAmmo = false -- Incendiary ammunition. SWEP.EAmmo = false -- Explosive ammunition. SWEP.CAmmo = false -- Cryo ammunition. function SWEP:Precache() -- Precache whole stuff. util.PrecacheModel("models/weapons/w_ft_template.mdl") util.PrecacheSound("weapons/ft_template/ft_template_fire.wav") util.PrecacheSound("weapons/ft_template/ft_template_reload.wav") end -------------------------------------------------------- If you're more creative person... function SWEP:CustomInitialize() return true end function SWEP:CustomPrimaryAttack() --self.OriginalPrimaryAttack == false -- Use it if you want to disable original "PrimaryAttack" function. return true end function SWEP:CustomShootEffects() return true end function SWEP:CustomBulletsEffect(att, tr, dmginfo, isplayer) return true end -------------------------------------------------------- Keep in mind that those 4 functions from above are both Server and Client sided. If you want specified side, force it by ex: "if (SERVER) then" (Server side only). -------------------------------------------------------- Sounds sound.Add( { name = "FTtemplate.Fire", channel = CHAN_WEAPON, volume = 1.0, level = SNDLVL_GUNFIRE, pitch = PITCH_NORM, sound = "weapons/ft_template/ft_template_fire.wav" } ) sound.Add( { name = "FTtemplate.Reload", channel = CHAN_ITEM, volume = 0.7, level = 70, pitch = PITCH_NORM, sound = "weapons/ft_template/ft_template_reload.wav" } ) sound.Add( { name = "FTtemplate.Rocket", channel = CHAN_ITEM, volume = 0.7, level = 70, pitch = PITCH_NORM, sound = "weapons/ft_template/ft_template_rocket.wav" } ) ---------------------------------------------------------- Sounds
(YourSwepFolder/lua/autorun/ft_listadd_template.lua)

list.Add( "NPCUsableWeapons", { class = "swep_ft_template", title = "FT Template" } ) --class = entity name // title = name on the weapons list if (SERVER) then hook.Add("Initialize", "NAME_IT_SOMEHOW", function() timer.Simple(1, function() if !table.HasValue(FTallweapons, "swep_ft_template") then -- For "Force Weapons" white list. IMPORTANT!!! table.insert(FTallweapons, "swep_ft_template") end if !table.HasValue(FTmostweapons, "swep_ft_template") then -- Add your weapon to "FT Random All Weapons" bundle. IMPORTANT!!! table.insert(FTmostweapons, "swep_ft_template") end if !table.HasValue(FTpistols, "swep_ft_template") then -- Add your weapon to random bundle of any weapon type. FTpistols = "FT Random Pistols" // FTassaults = "FT Random Assault" // FThmgs = "FT Random HMG" // FTshotguns = "FT Random Shotgun" // FTsmgs = "FT Random SMG" // FTsnipers = "FT Random Sniper" table.insert(FTpistols, "swep_ft_template") end end) end) end

Also remember about sound files:
(YourSwepFolder/sound/weapons/ft_template/ft_template_fire.wav)
(YourSwepFolder/sound/weapons/ft_template/ft_template_reload.wav)
(YourSwepFolder/sound/weapons/ft_template/ft_template_♥♥♥♥.wav)

♥♥♥♥ = c...o...c...k (Without ".")

Pistols fire rate is multiplied by "0.5".

SMGs, Assaults, AShotguns fire rate is multiplied by "0.25".

HMGs fire rate is multiplied by "0.1".
-- No more.
Last edited by filz0; 13 Aug, 2016 @ 7:08am
< >
Showing 1-6 of 6 comments
(bees) 2 Apr, 2016 @ 6:11am 
What happened to SWEP.Primary.DistantSound?
filz0  [developer] 2 Apr, 2016 @ 6:31am 
@Hyperflux 4 Jew Cube kin
It was... bad.
(bees) 6 Apr, 2016 @ 8:19pm 
I think it did the job pretty well, the distance sounds you used weren't that good but once I had a weapon I made that used a proper set of distance sounds (from insurgency) It sounded quite good. :P you should add it back as an option for people making weapons on your base ;)
(bees) 6 Apr, 2016 @ 8:20pm 
I feel the ability to add distance firing sounds is important for immersion :p
filz0  [developer] 7 Apr, 2016 @ 5:12am 
@Hyperflux 4 Jew Cube kin
Any chances for that you could tell me where could i get those sounds then?
filz0  [developer] 12 Jul, 2017 @ 11:46am 
Originally posted by Gordon Freeman:
Can I download the templates?
Just copy/paste it in to .lua file.
< >
Showing 1-6 of 6 comments
Per page: 1530 50