Left 4 Dead 2

Left 4 Dead 2

Not enough ratings
How to Make a Custom Flashlight Addon
By noahthenova
a straight to the point tutorial on how to replace the base flashlight with your own flashlight in Left 4 Dead 2.

I didn't include images because they would make the guide page WAY longer than it needs to be. I may include a few later on if enough people ask for them though.
   
Award
Favorite
Favorited
Unfavorite
Setting Up
-----------------------------------------------------------------------------------------------------
BEFORE STARTING ANY OF THE STEPS OF THE ADDON CREATION PROCESS, MAKE SURE YOU HAVE DOWNLOADED THE LEFT 4 DEAD 2 AUTHORING TOOLS FROM STEAM.

To do this, follow these 4 steps:
  • Click on "Library" on the top left corner of the Steam application window, and then select "Home" from the dropdown menu
  • Click on the Box above the search bar on the upper left hand side of the Steam window, and click on the row which has the title "Tools" to make sure it has a blue check mark on its left side
  • Use the search bar above the list of applications or scroll down until you see "Left 4 Dead 2 Authoring Tools"
  • Right or left-click on "Left 4 Dead 2 Authoring Tools" and then click "Install" and go through the process to install the tools

Downloading the Left 4 Dead 2 Authoring Tools will allow you to package your addon folder for use in-game and upload your addon to the Steam workshop, so they are essential for this tutorial.
-----------------------------------------------------------------------------------------------------

You will first want to download 3 programs before you start creating the addon:

You may also need to download these tools if VTFEdit has problems:

Now create a folder path with this format: ([your addon name] → materials → effects)

Afterwards, find the image that you want to replace the default flashlight, and have it ready for the next part of the addon-making process.
Creating the Addon
1. In Image-Editing Program (Photoshop, GIMP, etc.)
  • Open your image-editing program and load your custom flashlight image into the application

  • Change the appearance of your image if you feel like it (not its size though). Make sure to fill any transparent areas of your image (where there is no background) with the color black. Also make sure to rotate your image 1 time/90 degrees counter-clockwise (left) or 3 times/270 degrees clockwise (right)

  • Make the image 512 x 512 pixels (5.12 x 5.12 inches)

  • Save your image as a .png file to have it ready for the last step in the addon creation process

2. In VTFEdit
  • Bring your newly exported custom flashlight image into VTFEdit by dragging your image into the program's .exe file or by opening VTFEdit up and going to File → Import

  • Under the "Flags" section within VTFEdit, make sure these boxes have check marks in them:

    - Trilinear
    - Clamp S
    - Clamp T
    - No Mipmap
    - Clamp All

  • Save your custom image in VTFEdit as a .vtf file by going to File → Save As. Make sure to name your flashlight file as "flashlight001" and to save it in the "effects" folder located at ([addon name] → materials → effects)

3. On Computer
  • Drag your addon folder into vpk.exe, which is located at steam → steamapps → common → Left 4 Dead 2 → bin → vpk.exe (I recommend making a shortcut of vpk.exe somewhere that's it's easy and convenient to access) A .vpk (Valve package) file of your addon folder will then be created in the same area that vpk.exe (or its shortcut) is located

  • Drag the .vpk file of your addon into the folder "addons", located at steam → steamapps → common → Left 4 Dead 2 → left4dead2 → addons

  • Test your custom flashlight in-game

Alternate Tutorial: Editing the Base Flashlight Directly
  • Go to steam → steamapps → common → Left 4 Dead 2 → left4dead2 → and open "pak01_dir". Now navigate to materials → effects → flashlight001.vtf

  • Open flashlight001 in VTFEdit by going to File → Open or by dragging it into the program

  • Go to File → Export and save the flashlight texture as a Targa (.tga) file to wherever

  • Bring flashlight001.tga into your image editor

  • Change the appearance of the flashlight image however you want (not its size though). Make sure to fill any transparent areas of the image (where there is no background) with the color black. Also make sure to rotate the image 1 time/90 degrees counter-clockwise (left) or 3 times/270 degrees clockwise (right)

  • Make the image 512 x 512 pixels (7.11 x 7.11 inches)

  • Save your image as a .png file and then follow the tutorial as I describe above from Step 2 "In VTFEdit" downwards

OPTIONAL: Adding Details and Image of Addon to In-Game List

Addon Details
  • Create a text file called "addoninfo" and set it up like this (copy&paste text block below):

    "AddonInfo"
    {
    addonSteamAppID 550 ------ (don't change; ID is specific to Left 4 Dead 2)
    addontitle "title goes here"
    addonversion version number goes here (1,2, etc.)
    addonauthor "author goes here"
    addonDescription "description goes here"
    }

  • Place the addoninfo file into the main folder of your addon ([addon name] → addoninfo)
Addon Image
  • Find an image of your choosing (.jpg and .png for example) and name it "addonimage"

  • Place this image within the main folder for your addon
Uploading to the Workshop
Open the Left 4 Dead 2 Authoring Tools Steam app

Click the "+" symbol or go to File → Publish New Add-on

Select the .vpk file of the addon that you want to upload to the workshop, title the addon, and add an image for it. Add a description and tags as well if you feel like it

Accept the terms of the Steam License Agreement and click on the "Upload" button on the in the bottom right area of the window

42 Comments
noahthenova  [author] Jul 29, 2024 @ 12:55pm 
@Pwnage Peanut you're welcome
Pwnage Peanut Jul 22, 2024 @ 8:12pm 
Thanks
noahthenova  [author] Sep 11, 2022 @ 3:06pm 
@soppythesopmodfan You're welcome.

I sort of explained (but not in detail) in an earlier comment to you that once you switch from guns to some other guns (like the MP5), melee weapons (like the baseball bat), equipment (like medkits), and objects (like propane tanks) your flashlight will turn sideways, and there isn't really anything you can do about it as far as I know. I remember that I had looked at someone else's popular flashlight addon in the workshop a while ago, and they said that they didn't know of a way to stop flashlights from turning sideways once you switch to certain items. If this really is a big problem for you, and you don't want your image to turn on its side every time you switch to the items I mentioned, I would recommend that you use images that are the same size, shape, and color-wise on all 4 sides; this will make it pretty much impossible for you to notice a difference with the image once it turns, after you switch to another item.
Soppy Sep 11, 2022 @ 1:51pm 
thank you
Soppy Sep 11, 2022 @ 1:42pm 
oh wait its for some guns
Soppy Sep 11, 2022 @ 1:41pm 
it works but the light is turned instead of it being straight up. is there a way i can fix it???
noahthenova  [author] Sep 11, 2022 @ 10:45am 
@soppythesopmodfan If you packaged the addon folder into a vpk file and put that new vpk file into your addons folder, it should should normally work.

I set up your addon folder correctly and packaged your flashlight addon into a .vpk file for you: https://mega.nz/file/VrIHUToA#8PQ9SXagmc7KBxfXNB4w9DX6KGP_BLMtRZvQMHdCF0Q

Put this into your "addons" folder after disabling any other workshop flashlight addons and move your other local flashlight addons out of the addons folder, and then test the flashlight in game.

If this doesn't work for you, I would say to do it again, but after you follow the steps that I said in my 2nd to last comment, in which I say to try clearing your game cache, uninstalling Left 4 Dead 2 and reinstalling it, and trying what I said above in this comment on another computer if you can.
Soppy Sep 11, 2022 @ 8:41am 
i used the vpk shortcut thing that you use
noahthenova  [author] Sep 11, 2022 @ 1:51am 
@soppythesopmodfan The problem you have with your addon not working is so rare that I don't think I've seen anyone with this issue before. Pretty much every time someone asks about an issue related to making a L4D2 addon, it's practically always that they messed up a step, but that their game is working perfectly fine, and loads up any correctly made addon without a problem. In your case, you seem to have made the addon correctly, but something isn't right with you Left 4 Dead 2, or something very similar and related to Left 4 Dead 2 on your computer specifically is the root of your problem. The only thing I can say for certain at this point is that the problem isn't with the way the .vtf file is set up (naming, checkboxes, size, etc.) but is with something else in the addon creation and testing process.
noahthenova  [author] Sep 11, 2022 @ 1:42am 
@soppythesopmodfan Assuming you tell me to send you back the packaged addon vpk file, and you put it in your "addons" folder, and it still doesn't work for you, then something has to be up with your Left 4 Dead 2. In this case, you could try un-installing and re-installing the game, temporarily move all of your local and workshop addons from your "addons" folder to somewhere else on your computer before trying to use your one custom addon .vpk again (locally or through the workshop), you could then try clearing the game cache for L4D2 again to see if this helps with anything.

Also, like I said earlier, you could try doing this addon making process on another computer, with another operating system or not (whatever you can get your hands on), and see if you get the same result.