Left 4 Dead 2

Left 4 Dead 2

67 ratings
L4D / L4D2 Weapon Script Explanation and Summary of Effects
By THE LORD SPARTAN
It's a detailed list of functions and effect in the scripts of L4D / L4D2. It is helpful for whoever wants to make scripts for L4D. It covers values for firearms, melee and more.

I'm not the author of those informations. I found this on web at one point. I'm putting this resume here as a backup. I can't access the website no longer. If anyone knows where to find this, let me know so I can refer it in the description.
   
Award
Favorite
Favorited
Unfavorite
VerticalPunch
"VerticalPunch" // Recoil when shooting a gun. The higher the value, the more the barrel will jump up.
SpreadPerShot
"SpreadPerShot" // Accuracy per shot The smaller the value, the better the accuracy.
MaxSpread
"MaxSpread" // Shot grouping rate. The smaller the value, the better the shot grouping, and the larger the value, the worse.
SpreadDecay
"SpreadDecay" // Diffusion attenuation factor. The point is that the cross hair (reticle) spreads when you shoot. Is this easier to spread if it is smaller than the initial value unlike others?
MinDuckingSpread
"MinDuckingSpread" // Shot grouping rate in a crouched state. The smaller the value, the better, and the larger the value, the worse.
MinStandingSpread
"MinStandingSpread" // Shot grouping rate in an upright position. Same as above
MinInAirSpread
"MinInAirSpread" // Shot grouping rate during the jump. Same as above
MaxMovementSpread
"MaxMovementSpread" // Shot grouping rate on the move.
Tier
"Tier" // Weapon stage. 0 is the sidearm, 1 is the initial weapon, and 2 is the upper weapon. If you set the tier of the assault rifle or higher weapon to 1, it will appear from the beginning.
MaxPlayerSpeed
"MaxPlayerSpeed" // Maximum movement speed with a weapon. Not very relevant in L4D
PenetrationNumLayers
"PenetrationNumLayers" // Maximum number of penetrations. “2” by default
PenetrationPower
"PenetrationPower" // Penetration power. Decreasing the value makes it weaker, and increasing it makes it easier to penetrate.
Damage
"Damage" // Maximum power without attenuation. Melee weapons also have this item, but even if you play with it, it only works on the official map.
Range
"Range" // Maximum range. Not very relevant in L4D
RangeModifier
"RangeModifier" // Rate of damage attenuation with distance. No attenuation at 1.0
Bullets
"Bullets" // The number of bullets fired in a single shot. The higher the value, the more diffused
* Although it is an item for shotguns, it is also effective with other weapons *
CycleTime
"CycleTime" // Rate of fire. Decreasing the value makes it faster, and increasing it makes it slower. Also effective with semi-automatic weapons such as pistols
* If you increase the rate of fire of a fully automatic weapon too much, the shooting sound may not be heard and it may become strange. *
Clip_Size
"clip_size" // Number of bullets. No matter how many bullets you have, the UI will display up to 256th place at most.
Bucket
"bucket" // Weapon slot. 0 for primary, 1 for pistol, 2 for throwing weapon, 3 for first aid kit, 4 for painkiller. If applied, you can have a pistol while holding a melee weapon. By the way, the number of slots is up to 9, and if you feel like it, you can carry all the items at the same time.
Primary_Ammo
"primary_ammo" // Type of ammunition to use.
* The types of ammunition that can be used are as follows *
AMMO_TYPE
AMMO_TYPE_PISTOL // Ammunition for pistol (infinite number of bullets)

AMMO_TYPE_PISTOL_MAGNUM // Ammunition for Magnum (Infinite number of bullets & normal zombies can all be defeated with a single blow)

AMMO_TYPE_AUTOSHOTGUN // Ammunition for automatic shotguns

AMMO_TYPE_SHOTGUN // Ammunition for pump shotguns

AMMO_TYPE_SMG // Ammunition for submachine guns

AMMO_TYPE_ASSAULTRIFLE // Ammunition for assault rifles

AMMO_TYPE_HUNTINGRIFLE // Ammunition for hunting rifles

AMMO_TYPE_SNIPERRIFLE // Ammunition for sniper rifles

AMMO_TYPE_GRENADELAUNCHER // Ammunition for grenade launcher (ammunition supply not possible)

AMMO_TYPE_M60 // Ammo for M60 (normally all zombies can be defeated with a single blow & ammunition cannot be replenished)

AMMO_TYPE_CHAINSAW // Fuel for chainsaw (can only be replenished when the weapon slot is changed to primary)
Secondary_Ammo
"secondary_ammo" // The type of ammunition to use second. Not normally used
CharacterViewmodelAddon
"CharacterViewmodelAddon" // Model from first person perspective.
* If the arm of the L4D1 or L4D2 survivor is not displayed, add the following *

"Coach" "models/weapons/arms/v_arms_coach_new.mdl"

"Mechanic" "models/weapons/arms/v_arms_mechanic_new.mdl"

"Producer" "models/weapons/arms/v_arms_producer_new.mdl"

"Gambler" "models/weapons/arms/v_arms_gambler_new.mdl"

"Namvet" "models / weapons / arms / v_arms_bill.mdl"

"Biker" "models / weapons / arms / v_arms_francis.mdl"

"Manager" "models / weapons / arms / v_arms_louis.mdl"

"TeenGirl" "models / weapons / arms / v_arms_zoey.mdl"
Refire_Delay
"refire_delay" // Attack speed of melee weapons. Increasing the value will allow you to swing faster and move quickly to the next attack.
Damage_Flags
"damage_flags" // Attack attributes of melee weapons
* The attributes that can be used are as follows *

"4" // Slashing attribute (used for swords such as hatchets and swords)

"128" // Strike attribute (used with blunt instruments such as bats and frying pans)

“8” // Flame attribute (fires when attacked)
* Not used with normal melee weapons *

"196" // Strike attribute 2 (Zombies pop off when attacking zombies, tanks squeeze when attacking tanks)
* Not used with normal melee weapons. Only for official maps? *

"192" // Strike attribute 3 (almost the same effect as flag "196")
* Not used with normal melee weapons. Only for official maps? *

"12" // Flame attribute 2 (Unknown what is different from flag "8")
* Not used with normal melee weapons. Only for official maps? *

There may be other attack attributes for melee weapons
Rumble_Effect
"rumble_effect" // Vibration strength when using Xbox 360 controller
ReloadDuration / DualReloadDuration
"ReloadDuration" / "DualReloadDuration" // Reload speed (L4D1 only) The larger the value, the slower the speed, and the smaller the value, the faster the speed. Thank you for providing information to Mr. Yasushiki!

* In L4D2, the item "Reload Duration" remains in the shotgun, but there is no effect even if you play with it.
Postscript
Postscript: Add-ons that play with weapon scripts and add-ons that change the HUD icon of weapons conflict, so if you want to be compatible, you need to merge
16 Comments
NorthCaptain Mar 26 @ 10:14am 
@LordSpartan : I think AMMO TYPE only determine how weapons using it behave and which max ammo reverse value it use, it not affect its ammo resuply ability.
NorthCaptain Mar 26 @ 9:56am 
here is console command code list, ctrl + F and type "ammo" , you can find all default number ammo reverse on it (ammo max). https://developer.valvesoftware.com/wiki/List_of_Left_4_Dead_2_console_commands_and_variables
NorthCaptain Mar 26 @ 9:53am 
@spannerV2: recommend you find some max ammo scripts addons on workshop, and then change it with VKPEdit. That how i changing my ammo type's max ammo reverse. This is what im using. just edit it with VKPEdit, copy exist lines and replace "ammo_"type"_ max" with this

ammo_minigun_max

https://steamcommunity.com/sharedfiles/filedetails/?id=3313363046

P/s: using AMMO_TYPE_GRENADELAUNCHER will make Special stumble and instant gib Common. Also AMMO TYPE will not affect ammo resuply ability of the gun itself. Im put grenade launcher ammo type on my AX50 (AWP script) and Barret (Military sniper script) and both can still resuply ammo. Havent try with pistols tho.
THE LORD SPARTAN  [author] Mar 10 @ 12:05pm 
@SpannerV2

All the ammo type that I know of are listed in this guide. So I can't help you for this one. The only way I can see you alter this "effect that makes them explode", would be convars. There's a line concerning the minigun that could hint you. The "z_minigun_atomize" is supposed to make the zombies explode. But then again, I don't know how to properly VScript and I'm also off modding and gaming at the moment. I wish you the best with this project.
SpannerV2 Mar 9 @ 3:38am 
Why i asked is because i did some edits on weapons. I was trying to make the AWP and Magnum shoot the same ammo type as the HMG. So currently I'm doing a "work around" and edited both of them to AMMO_TYPE_MINIGUN while keeping the M60 as is. M60 ammo type gibs but less violent while the minigun ammo type essentially makes them explode. i then proceeded to change the max ammo to -2 because for some reason the convars have it as ammo_minigun_max 800.
THE LORD SPARTAN  [author] Mar 8 @ 9:06am 
@SpannerV2

Both mounted guns use convars. I've learned that the hard way. That's why they use VScripts to edits the stats. As for the convars... I don't know how to do a working VScript at the moment.
SpannerV2 Mar 7 @ 10:31pm 
Anyone know if the Heavy Machine Gun (M2 Browning) has an ammo type and/or config file?
Shat Feb 21 @ 1:36pm 
Thanks, these parameters are in the convars, that is, you will have to use VScript instead of weapon scripts :104:
THE LORD SPARTAN  [author] Feb 18 @ 8:50am 
@VorteX

For shoving power or what object you want to shove, I have no idea. But there's a plethora of scripts based mods that lets you shove specials, players, doors and other objects. ChimiChamo, Tomaz and Ilshat52 have pretty good mods who does what it says on the tin.
Shat Jun 15, 2024 @ 4:03am 
Based