Hello,
I've used the weapon placer to place a bunch of weapons from tfa base around a gmod map and when I start up the server and join it I see the weapons there and they work great, but I can't pick up any weapon ammo with any of the tfa weapons. Other weapons work fine but none of the tfa ones. The code for one of the weapons is below. I think I added the SWEP.Primary.AmmoEnt correctly. I can't pickup shotgun shells with it though.
SWEP.Gun = ("tfa_kzsf_vc30") -- must be the name of your gun
SWEP.Base = "tfa_bash_base"
SWEP.Category = "TFA KZ:SF" --The category. Please, just choose something generic or something I've already done if you plan on only doing like one swep..
SWEP.Manufacturer = "Visari" --Gun Manufactrer (e.g. Hoeckler and Koch )
SWEP.Author = "" --Author Tooltip
SWEP.Contact = "" --Contact Info Tooltip
SWEP.Purpose = "" --Purpose Tooltip
SWEP.Instructions = "" --Instructions Tooltip
SWEP.AutoSpawnable = true --will this weapon autospawn on TTT maps?
SWEP.Spawnable = TFA_BASE_VERSION and TFA_BASE_VERSION >= 4 --Can you, as a normal user, spawn this?
SWEP.AdminSpawnable = true --Can an adminstrator spawn this? Does not tie into your admin mod necessarily, unless its coded to allow for GMod's default ranks somewhere in its code. Evolve and ULX should work, but try to use weapon restriction rather than these.
SWEP.DrawCrosshair = true -- Draw the crosshair?
SWEP.DrawCrosshairIS = false --Draw the crosshair in ironsights?
SWEP.PrintName = "VC30 Sickle" -- Weapon name (Shown on HUD)
SWEP.Slot = 3 -- Slot in the weapon selection menu. Subtract 1, as this starts at 0.
SWEP.SlotPos = 73 -- Position in the slot
SWEP.AutoSwitchTo = true -- Auto switch to if we pick it up
SWEP.AutoSwitchFrom = true -- Auto switch from if you pick up a better weapon
SWEP.Weight = 30 -- This controls how "good" the weapon is for autopickup.
SWEP.Type = "Shotgun"
--[[WEAPON HANDLING]]--
SWEP.Primary.Sound = Sound("tfa_kzsf_vc30.1") -- This is the sound of the weapon, when you shoot.
SWEP.Primary.SilencedSound = nil -- This is the sound of the weapon, when silenced.
SWEP.Primary.Damage = 12 -- Damage, in standard damage points.
SWEP.Primary.NumShots = 14 --The number of shots the weapon fires. SWEP.Shotgun is NOT required for this to be >1.
SWEP.Primary.Automatic = false -- Automatic/Semi Auto
SWEP.Primary.RPM = 600 -- This is in Rounds Per Minute / RPM
SWEP.Primary.RPM_Displayed = 120 -- This is in Rounds Per Minute / RPM
-- nZombies Stuff
SWEP.NZWonderWeapon = false -- Is this a Wonder-Weapon? If true, only one player can have it at a time. Cheats aren't stopped, though.
--SWEP.NZRePaPText = "your text here" -- When RePaPing, what should be shown? Example: Press E to your text here for 2000 points.
SWEP.NZPaPName = "Death's Scythe"
--SWEP.NZPaPReplacement = "tfa_cso2_tribarrel" -- If Pack-a-Punched, replace this gun with the entity class shown here.
SWEP.NZPreventBox = false -- If true, this gun won't be placed in random boxes GENERATED. Users can still place it in manually.
SWEP.NZTotalBlackList = false -- if true, this gun can't be placed in the box, even manually, and can't be bought off a wall, even if placed manually. Only code can give this gun.
--Miscelaneous Sounds
SWEP.IronInSound = nil --Sound to play when ironsighting in? nil for default
SWEP.IronOutSound = nil --Sound to play when ironsighting out? nil for default
--Silencing
SWEP.CanBeSilenced = false --Can we silence? Requires animations.
SWEP.Silenced = false --Silenced by default?
-- Selective Fire Stuff
SWEP.SelectiveFire = true --Allow selecting your firemode?
SWEP.DisableBurstFire = false --Only auto/single?
SWEP.OnlyBurstFire = true --No auto, only burst/single?
SWEP.DefaultFireMode = "Single" --Default to auto or whatev
SWEP.FireModeName = nil --Change to a text value to override it
--Ammo Related
SWEP.Primary.ClipSize = 10 -- This is the size of a clip
SWEP.Primary.DefaultClip = 100 -- This is the number of bullets the gun gives you, counting a clip as defined directly above.
SWEP.Primary.Ammo = "Buckshot" -- What kind of ammo. Options, besides custom, include pistol, 357, smg1, ar2, buckshot, slam, SniperPenetratedRound, and AirboatGun.
SWEP.AmmoEnt = "item_box_buckshot_ttt"
SWEP.Primary.AmmoConsumption = 1 --Ammo consumed per shot
--Pistol, buckshot, and slam like to ricochet. Use AirboatGun for a light metal peircing shotgun pellets
SWEP.DisableChambering = false --Disable round-in-the-chamber
--Recoil Related
SWEP.Primary.KickUp = 1.5 -- This is the maximum upwards recoil (rise)
SWEP.Primary.KickDown = 1.25 -- This is the maximum downwards recoil (skeet)
SWEP.Primary.KickHorizontal = 0.6 -- This is the maximum sideways recoil (no real term)
SWEP.Primary.StaticRecoilFactor = 0.5 --Amount of recoil to directly apply to EyeAngles. Enter what fraction or percentage (in decimal form) you want. This is also affected by a convar that defaults to 0.5.
--Firing Cone Related
SWEP.Primary.Spread = .045 --This is hip-fire acuracy. Less is more (1 is horribly awful, .0001 is close to perfect)
SWEP.Primary.IronAccuracy = .04 -- Ironsight accuracy, should be the same for shotguns
--Unless you can do this manually, autodetect it. If you decide to manually do these, uncomment this block and remove this line.
SWEP.Primary.SpreadMultiplierMax = 3--How far the spread can expand when you shoot. Example val: 2.5
SWEP.Primary.SpreadIncrement = 1.5 --What percentage of the modifier is added on, per shot. Example val: 1/3.5
SWEP.Primary.SpreadRecovery = 4--How much the spread recovers, per second. Example val: 3
--Range Related
SWEP.Primary.Range = 100 * 39.3701 * 8 / 3 -- The distance the bullet can travel in source units. Set to -1 to autodetect based on damage/rpm.
SWEP.Primary.RangeFalloff = 0.4 -- The percentage of the range the bullet damage starts to fall off at. Set to 0.8, for example, to start falling off after 80% of the range.
--Penetration Related
SWEP.MaxPenetrationCounter = 4 --The maximum number of ricochets. To prevent stack overflows.
--Misc
SWEP.IronRecoilMultiplier = 0.5 --Multiply recoil by this factor when we're in ironsights. This is proportional, not inversely.
SWEP.CrouchAccuracyMultiplier = 0.5 --Less is more. Accuracy * 0.5 = Twice as accurate, Accuracy * 0.1 = Ten times as accurate
--Movespeed
SWEP.MoveSpeed = 0.9 --Multiply the player's movespeed by this.
SWEP.IronSightsMoveSpeed = SWEP.MoveSpeed * 0.8 --Multiply the player's movespeed by this when sighting.
--[[VIEWMODEL]]--
SWEP.ViewModel = "models/weapons/c_tfa_vc30.mdl" --Viewmodel path
SWEP.ViewModelFOV = 56 -- This controls how big the viewmodel looks. Less is more.
SWEP.ViewModelFlip = false -- Set this to true for CSS models, or false for everything else (with a righthanded viewmodel.)
SWEP.UseHands = true --Use gmod c_arms system.
SWEP.VMPos = Vector(0, 0, 0) --The viewmodel positional offset, constantly. Subtract this from any other modifications to viewmodel position.
SWEP.VMAng = Vector(0, 0, 0) --The viewmodel angular offset, constantly. Subtract this from any other modifications to viewmodel angle.
SWEP.VMPos_Additive = false --Set to false for an easier time using VMPos. If true, VMPos will act as a constant delta ON TOP OF ironsights, run, whateverelse
--[[WORLDMODEL]]--
SWEP.WorldModel = "models/weapons/w_tfa_vc30.mdl" -- Weapon world model path
SWEP.HoldType = "shotgun" -- This is how others view you carrying the weapon. Options include:
-- normal melee melee2 fist knife smg ar2 pistol rpg physgun grenade shotgun crossbow slam passive
-- You're mostly going to use ar2, smg, shotgun or pistol. rpg and crossbow make for good sniper rifles
SWEP.Offset = {
Pos = {
Up = -4.5,
Right = 0.75,
Forward = 4.5
},
Ang = {
Up = -1,
Right = -5,
Forward = 178
},
Scale = 1.1
} --Procedural world model animation, defaulted for CS:S purposes.
SWEP.ThirdPersonReloadDisable = false --Disable third person reload? True disables.
--[[SCOPES]]--
SWEP.IronSightsSensitivity = 1 --Useful for a RT scope. Change this to 0.25 for 25% sensitivity. This is if normal FOV compenstaion isn't your thing for whatever reason, so don't change it for normal scopes.
SWEP.BoltAction = false --Unscope/sight after you shoot?
SWEP.Scoped = false --Draw a scope overlay?
SWEP.ScopeOverlayThreshold = 0.875 --Percentage you have to be sighted in to see the scope.
SWEP.BoltTimerOffset = 0.25 --How long you stay sighted in after shooting, with a bolt action.
SWEP.ScopeScale = 0.5 --Scale of the scope overlay
SWEP.ReticleScale = 0.7 --Scale of the reticle overlay
--GDCW Overlay Options. Only choose one.
SWEP.Secondary.UseACOG = false --Overlay option
SWEP.Secondary.UseMilDot = false --Overlay option
SWEP.Secondary.UseSVD = false --Overlay option
SWEP.Secondary.UseParabolic = false --Overlay option
SWEP.Secondary.UseElcan = false --Overlay option
SWEP.Secondary.UseGreenDuplex = false --Overlay option
--[[SHOTGUN CODE]]--
SWEP.Shotgun = true --Enable shotgun style reloading.
SWEP.ShotgunEmptyAnim = true --Enable emtpy reloads on shotguns?
SWEP.ShotgunEmptyAnim_Shell = true --Enable insertion of a shell directly into the chamber on empty reload?
SWEP.ShellTime = .6 -- For shotguns, how long it takes to insert a shell.
--[[SPRINTING]]--
-- SWEP.RunSightsPos = Vector(0, -2, -0.5)
-- SWEP.RunSightsAng = Vector(-10.869, 30.129, -25.056)
--SWEP.RunSightsAng = Vector(-11.869, -17.129, 16.056)
SWEP.RunSightsPos = Vector(6.35, -11.675, -0.4)
SWEP.RunSightsAng = Vector(-14, 44.5, -21.75)
--[[IRONSIGHTS]]--
SWEP.data = {}
SWEP.data.ironsights = 1 --Enable Ironsights
SWEP.Secondary.IronFOV = 70 -- How much you 'zoom' in. Less is more! Don't have this be <= 0. A good value for ironsights is like 70.
SWEP.IronSightsPos = Vector(-2.8405, -4, 1.252)
SWEP.IronSightsAng = Vector(0.188, -0.188, 0)
--[[INSPECTION]]--
SWEP.InspectPos = Vector(6.039, -3.509, -0.332)
SWEP.InspectAng = Vector(15, 30, 15)
--[[VIEWMODEL ANIMATION HANDLING]]--
SWEP.AllowViewAttachment = false --Allow the view to sway based on weapon attachment while reloading or drawing, IF THE CLIENT HAS IT ENABLED IN THEIR CONVARS.
--[[VIEWMODEL BLOWBACK]]--
SWEP.BlowbackEnabled = false --Enable Blowback?
SWEP.BlowbackVector = Vector(-0,-2,-0.05) --Vector to move bone <or root> relative to bone <or view> orientation.
SWEP.BlowbackCurrentRoot = 0 --Amount of blowback currently, for root
SWEP.BlowbackCurrent = 0 --Amount of blowback currently, for bones
SWEP.BlowbackBoneMods = nil --Viewmodel bone mods via SWEP Creation Kit
SWEP.Blowback_Only_Iron = true --Only do blowback on ironsights
SWEP.Blowback_PistolMode = false --Do we recover from blowback when empty?
SWEP.Blowback_Shell_Enabled = true --Shoot shells through blowback animations
SWEP.Blowback_Shell_Effect = "ShellEject"--Which shell effect to use
--[[VIEWMODEL PROCEDURAL ANIMATION]]--
SWEP.DoProceduralReload = false--Animate first person reload using lua?
SWEP.ProceduralReloadTime = 1 --Procedural reload time?
--[[HOLDTYPES]]--
SWEP.IronSightHoldTypeOverride = "" --This variable overrides the ironsights holdtype, choosing it instead of something from the above tables. Change it to "" to disable.
SWEP.SprintHoldTypeOverride = "" --This variable overrides the sprint holdtype, choosing it instead of something from the above tables. Change it to "" to disable.
--[[ANIMATION]]--
SWEP.StatusLengthOverride = {
[ACT_VM_RELOAD_EMPTY] = 38 / 60,
[ACT_VM_RELOAD] = 0.3,
[ACT_SHOTGUN_PUMP] = 15 / 45
} --Changes the status delay of a given animation; only used on reloads. Otherwise, use SequenceLengthOverride or one of the others
SWEP.SequenceLengthOverride = {} --Changes both the status delay and the nextprimaryfire of a given animation
SWEP.SequenceRateOverride = {} --Like above but changes animation length to a target
SWEP.SequenceRateOverrideScaled = {} --Like above but scales animation length rather than being absolute
SWEP.ProceduralHoslterEnabled = nil
SWEP.ProceduralHolsterTime = 0.3
SWEP.ProceduralHolsterPos = Vector(3, 0, -5)
SWEP.ProceduralHolsterAng = Vector(-40, -30, 10)
SWEP.Sights_Mode = TFA.Enum.LOCOMOTION_LUA -- ANI = mdl, HYBRID = lua but continue idle, Lua = stop mdl animation
SWEP.Sprint_Mode = TFA.Enum.LOCOMOTION_LUA -- ANI = mdl, HYBRID = ani + lua, Lua = lua only
SWEP.Idle_Mode = TFA.Enum.IDLE_BOTH --TFA.Enum.IDLE_DISABLED = no idle, TFA.Enum.IDLE_LUA = lua idle, TFA.Enum.IDLE_ANI = mdl idle, TFA.Enum.IDLE_BOTH = TFA.Enum.IDLE_ANI + TFA.Enum.IDLE_LUA
SWEP.Idle_Blend = 0.0 --Start an idle this far early into the end of a transition
SWEP.Idle_Smooth = 0.0 --Start an idle this far early into the end of another animation
--[[EFFECTS]]--
--Attachments
SWEP.MuzzleAttachment = "1" -- Should be "1" for CSS models or "muzzle" for hl2 models
SWEP.ShellAttachment = "shell" -- Should be "2" for CSS models or "shell" for hl2 models
SWEP.MuzzleFlashEnabled = true --Enable muzzle flash
SWEP.MuzzleAttachmentRaw = nil --This will override whatever string you gave. This is the raw attachment number. This is overridden or created when a gun makes a muzzle event.
SWEP.AutoDetectMuzzleAttachment = false --For multi-barrel weapons, detect the proper attachment?
SWEP.MuzzleFlashEffect = nil --Change to a string of your muzzle flash effect. Copy/paste one of the existing from the base.
SWEP.SmokeParticle = nil --Smoke particle (ID within the PCF), defaults to something else based on holdtype; "" to disable
SWEP.EjectionSmokeEnabled = true --Disable automatic ejection smoke
--Shell eject override
SWEP.LuaShellEject = false --Enable shell ejection through lua?
SWEP.LuaShellEjectDelay = 0.85 --The delay to actually eject things
SWEP.LuaShellEffect = "ShellEject" --The effect used for shell ejection; Defaults to that used for blowback
--Tracer Stuff
SWEP.TracerName = nil --Change to a string of your tracer name. Can be custom. There is a nice example at https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/base/entities/effects/tooltracer.lua
SWEP.TracerCount = 3 --0 disables, otherwise, 1 in X chance
--Impact Effects
SWEP.ImpactEffect = nil--Impact Effect
SWEP.ImpactDecal = nil--Impact Decal
--[[RENDER TARGET]]--
SWEP.RTMaterialOverride = nil -- Take the material you want out of print(LocalPlayer():GetViewModel():GetMaterials()), subtract 1 from its index, and set it to this.
SWEP.RTOpaque = false -- Do you want your render target to be opaque?
SWEP.RTCode = nil--function(self) return end --This is the function to draw onto your rendertarget
--[[AKIMBO]]--
SWEP.Akimbo = false --Akimbo gun? Alternates between primary and secondary attacks.
SWEP.AnimCycle = 0 -- Start on the right
--SWEP.ViewModelBoneMods = {
-- ["ValveBiped.Bip01_R_Hand"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-1.4, 1.0, -0.6) }
--}
SWEP.EventTable = {
[ACT_VM_DRAW] = {
{ ["time"] = 1 / 60, ["type"] = "sound", ["value"] = Sound("tfa_kzsf_vc30.Draw") },
{ ["time"] = 24 / 60, ["type"] = "sound", ["value"] = Sound("tfa_kzsf_vc30.PumpBack") },
{ ["time"] = 35 / 60, ["type"] = "sound", ["value"] = Sound("tfa_kzsf_vc30.PumpForward") },
},
[ACT_VM_RELOAD] = {
{ ["time"] = 15 / 60, ["type"] = "sound", ["value"] = Sound("tfa_kzsf_vc30.Insert") },
},
[ACT_VM_RELOAD_EMPTY] = {
{ ["time"] = 1 / 60, ["type"] = "sound", ["value"] = Sound("tfa_kzsf_vc30.Draw") },
{ ["time"] = 28 / 60, ["type"] = "sound", ["value"] = Sound("tfa_kzsf_vc30.Insert") },
{ ["time"] = 93 / 60, ["type"] = "sound", ["value"] = Sound("tfa_kzsf_vc30.PumpBack") },
{ ["time"] = 106 / 60, ["type"] = "sound", ["value"] = Sound("tfa_kzsf_vc30.PumpForward") },
{ ["time"] = 110 / 60, ["type"] = "lua", ["value"] = function(wep, vm) wep:SetShootPump(false) end },
},
[ACT_SHOTGUN_PUMP] = {
{ ["time"] = 0.01, ["type"] = "sound", ["value"] = Sound("tfa_kzsf_vc30.PumpBack") },
{ ["time"] = 9 / 45, ["type"] = "sound", ["value"] = Sound("tfa_kzsf_vc30.PumpForward") },
},
[ACT_SHOTGUN_RELOAD_START] = {
{ ["time"] = 1 / 60, ["type"] = "sound", ["value"] = Sound("tfa_kzsf_vc30.Draw") },
}
}
SWEP.Secondary.BashDelay = 0.05
SWEP.Attachments = {
[1] = {atts = {"kzsf_vc30_incendiary", "sg_frag", "sg_slug"}}
}
DEFINE_BASECLASS( SWEP.Base )
function SWEP:SetupDataTables(...)
BaseClass.SetupDataTables(self, ...)
self:NetworkVar("Bool", 8, "ShootPump")
end
function SWEP:PostPrimaryAttack(...)
if self:Clip1() > 0 then
self:SetShootPump(not self:GetShootPump())
end
if not self:GetShootPump() then
self:SetStatusEnd(CurTime() + 0.25)
self:SetNextPrimaryFire(self:GetStatusEnd() + 0.05)
end
return BaseClass.PostPrimaryAttack(self, ...)
end
function SWEP:Think2( ... )
if CurTime() > self:GetStatusEnd() and ( not self:GetShootPump() ) and self:GetStatus() == TFA.GetStatus("shooting") then
self:SendViewModelAnim( ACT_SHOTGUN_PUMP )
self:SetStatus( TFA.GetStatus("pump") )
self:SetStatusEnd( CurTime() + self:GetActivityLength( ACT_SHOTGUN_PUMP, true ) )
self:SetNextPrimaryFire( CurTime() + self:GetActivityLength( ACT_SHOTGUN_PUMP, true ) )
self:SetNextIdleAnim(math.max( self:GetNextIdleAnim(), CurTime() + self:GetActivityLength( ACT_SHOTGUN_PUMP, false ) ))
end
return BaseClass.Think2(self, ...)
end
SWEP.FlashlightAttachment = 4
if CLIENT then -- INS2 stencils code. If you use this in your weapon, you MUST credit me (YuRaNnNzZZ) for it.
local useStencils = render.SupportsPixelShaders_1_4() and render.SupportsPixelShaders_2_0() and render.SupportsVertexShaders_2_0()
local function defineCanvas(ref)
render.UpdateScreenEffectTexture()
render.ClearStencil()
render.SetStencilEnable(true)
render.SetStencilCompareFunction(STENCIL_ALWAYS)
render.SetStencilPassOperation(STENCIL_REPLACE)
render.SetStencilFailOperation(STENCIL_KEEP)
render.SetStencilZFailOperation(STENCIL_REPLACE)
render.SetStencilWriteMask(255)
render.SetStencilTestMask(255)
render.SetStencilReferenceValue(ref or 54)
end
local function drawOn()
render.SetStencilCompareFunction(STENCIL_EQUAL)
end
local function stopCanvas()
render.SetStencilEnable(false)
end
local CachedMaterials = {}
local function DrawHoloSight(wep, texture, parent, p, a, s)
CachedMaterials[texture] = CachedMaterials[texture] or Material(texture, "noclamp nocull smooth")
if wep.VMRedraw then return end
wep.VMRedraw = true
local model
if isstring(parent) and wep.VElements[parent] and wep.VElements[parent].curmodel then
model = wep.VElements[parent].curmodel
end
if useStencils and IsValid(model) then
defineCanvas()
render.SetBlend(0)
model:DrawModel() -- we "draw" only parent model (for models without any attachments just use rtcircle model with 0 alpha as parent)
render.SetBlend(1)
drawOn()
end
render.OverrideDepthEnable(true, true)
render.SetMaterial(CachedMaterials[texture])
a = Angle(a)
a:RotateAroundAxis(a:Right(), 90)
render.DrawQuadEasy(p, a:Forward(), s * 2, s * 2, color_white, a.r + 90)
render.OverrideDepthEnable(false, false)
if useStencils and IsValid(model) then
stopCanvas()
end
wep.VMRedraw = false
end
SWEP.VElements = SWEP.VElements or {}
SWEP.VElements["reticlemask"] = {type = "Model", model = "models/weapons/c_tfa_vc30_sightmask.mdl", bone = "", rel = "", pos = Vector(0, 0, 0), angle = Angle(0, 0, 0), size = Vector(1, 1, 1), color = Color(255, 255, 255, 0), surpresslightning = false, material = "", skin = 0, bodygroup = {}, bonemerge = true, active = true}
SWEP.VElements["reticle"] = {type = "Quad", rel = "reticlemask", bone = "reticle", pos = Vector(12, 0, 0), angle = Angle(90, 0, 0), size = 0.2, draw_func_outer = function(wep,p,a,s) DrawHoloSight(wep, "models/weapons/tfa_kzsf/vc30/reticle", "reticlemask", p,a,s) end, active = true}
if not useStencils then
SWEP.VElements["reticle"].pos = Vector(0, 0, 0)
SWEP.VElements["reticle"].size = 0.15
end
end
I found out that the tfa people said there's an issue with ammo on ttt. It's screwy so if you drop a weapon it'll be picked up with full ammo. And you can't pick up ammo from the ground. I bet it could be fixed, but they don't know how of the top of their heads.
I also found some tfa weapons that work fine in ttt so know I'm confuzzled
https://steamcommunity.com/sharedfiles/filedetails/?id=1551226871
In ttt I found you have to have the ammo ent
For example -
SWEP.AmmoEnt = "item_ammo_ar_ttt"
but then it also has to match
SWEP.Primary.Ammo = "ar2"
or you will pick up the ammo and not add it to the gun's clip
Sorry, you need to Log In to post a reply to this thread.