Left 4 Dead 2

Left 4 Dead 2

View Stats:
This topic has been locked
Weapon Scripts
how do you make custom weapon scripts? i'd like to make my own but i don't know how, is there a guide somewhere that can help me?

Thanks in advance!
< >
Showing 1-3 of 3 comments
Kamen Kreuz May 25, 2022 @ 2:16am 
First download GCFScape, this page has a link at the top: https://developer.valvesoftware.com/wiki/GCFScape
Then install the L4D2 Authoring Tools: https://developer.valvesoftware.com/wiki/Authoring_Tools/SDK_%28Left_4_Dead_2%29

Now, navigate to steamapps>common>Left 4 Dead 2>update and open pak01_dir.vpk with GFCScape. In GCFScape, open the scripts folder and find the script of the weapon you want, i.e. weapon_hunting_rifle.txt. You can either extract it (right click) or just open the file (double click) and copy the entire contents into a new text file. If you make a new file, make sure the name is exactly the same as the old one. Edit the stats of the weapon however you want. Most of the code is fairly self explanatory, just look for things like damage, spread (accuracy), clip size, bullets (number of projectiles), cycle time (fire rate), ect. Probably best to avoid touching stuff like viewmodels, texture data, sounds, ect.

Now to put your mod into the game. Create a folder and give it whatever name you want, something like "hunting rifle mod". Inside that folder, create a text file called addoninfo.txt and another folder called scripts. Place your modified weapon script inside the scripts folder. Note that you can place as many scripts as you want in the same mod by putting them all in the script folder, as long as you do not modify the same weapon twice. Now to fill out that addoninfo file you made. Format it like so, including quotation marks:
"AddonInfo" { "addonSteamAppID" "550" "addonTitle" "Modified Hunting Rifle Stats" "addonVersion" "1.0" "addonAuthor" "You" "addonDescription" "Whatever you want to say about it" }
Change the info as desired, just don't touch the AppID. If you want to tag your addon (helps organize the addon list), add new lines like so:
"addonContent_Script" "1"
You can find more tags here: https://developer.valvesoftware.com/wiki/L4D_AddonInfo_Authoring#Content_Tagging

Finally, you need to pack your mod into a vpk. The authoring tools you downloaded earlier came with a file called vpk.exe, it is located inside Left 4 Dead 2>bin. You want to open your mod folder (in this example, "hunting rifle mod") with vpk.exe. The easiest way is to simply drag the folder onto vpk. After a moment, a vpk file with the same name as your mod should appear next to your mod folder. Place this new vpk inside Left 4 Dead 2>left4dead2>addons, and you're done.

If you want to modify your mod, the easiest way is to just delete the old one and make a new vpk with the changes. Also if you want your mod to actually affect the weapons, the mod must be enabled on the server's side. If you're playing offline, no problem. If you're playing with friends, whoever is hosting must have the mod.
Last edited by Kamen Kreuz; May 25, 2022 @ 2:26am
Jean Lwl Mar 9, 2024 @ 6:30pm 
nice
Wren Mar 9, 2024 @ 10:04pm 
This thread was quite old before the recent post, so we're locking it to prevent confusion.
< >
Showing 1-3 of 3 comments
Per page: 1530 50

Date Posted: May 19, 2022 @ 9:19pm
Posts: 3