Skip to content

Left 4 Dead 2 Modifications

January 19, 2013

I read about the Steam workshop today and every day at lunch we play Left 4 Dead 2, so I figured why not figure out how it works and try modifying a survivors texturemap.  Well it isn’t as self explanatory as I would have liked but I eventually figured it out.  If there is an easier way of doing this, let me know.

  1. Unpack the .vpk files.  Download a piece of software called GCFScape.  Inside of the L4D folder in steam’s apps are a bunch of files with the name pak01_###.vpk and pak01_dir.vpk.  The pak01_dir.vpk file is the header for the remaining .vpk files.  In GCFScape press open and select pak01_dir.vpk.  Drag \Root\Materials\Models\Survivors\ into a folder on your hard drive.
  2. Inside of the folder are .vtf files.  Those are the textures.  Install a piece of software called VTFEdit.  Open \survivors\teenangst\zoey_color.vtf
  3. You should now see the texturemap in all it’s detail.  Select File->Export and save out the TGA.  Now you can start modifying the texture in photoshop.

Adding the new texture into the game takes a little while.

  • Create a folder for your new creation.
  • Create a new file called pack.bat
  • Inside put the following:
"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead 2\bin\vpk.exe" a "C:\Program Files (x86)\Steam\steamapps\common\left 4 dead 2\left4dead2\addons\myFinalPackNameHere.vpk" @C:\l4d2Edit\Working\mySkin\zoeyfiles.txt
pause

What this does is it points to vpk.exe which will generate a valve package.  “a” means add.  Next comes the final filename that you would like it to have.  And finally the @filename.txt inputs a file which contains a list inside.

  • Create a new file called zoeyfiles.txt

Inside of it, create a list of files with relative paths.  Whatever you put here will get stored in the .vpk.  You can use absolute paths but it probably won’t work as they get encoded into the .vpk file.

addoninfo.txt
addonimage.vtf
addonimage.jpg
materials\models\survivors\teenangst\zoey_color.vtf
materials\models\survivors\teenangst\zoey_color.vmt
materials\models\survivors\teenangst\zoey_normal.vtf

We’ll come back to this file later.

  • Create a new text file in the same folder called addoninfo.txt
"AddonInfo"
{
    addonSteamAppID        550
    addontitle             "Put the title of your addon here"
    addonversion           1.0
    addontagline           "zoey body_leather coat black"
    addonauthor            "Your name here"
    addonauthorSteamID     "Your steem id here"
    addonDescription       "The description of your addon."

    addonContent_Script 0          // Has Scripts 
    addonContent_Music 0           // Has Custom Music 
    addonContent_Sound 0           // Has Custom Sound 
    addonContent_prop 0            // This Add-on provides new props, 
    addonContent_Prefab 0          // Provides new prefabs 
    addonContent_BackgroundMovie 0 // Provides a replacement for the background movie.
    addonContent_Survivor 0        // Provides a new survivor model. 0=false, 1=true, String in quotes if replaces specific single character, i.e. "Coach"
                                   // eg addonContent_Survivor "rochelle" works fine, no number.  
    addonContent_BossInfected 0    // Provides a new boss infected model. Break these out?
    addonContent_CommonInfected 0  // Provides a new common infected model
    Content_WeaponModel 0          // Provides a new appearance to existing weapons, but does not change their function
    Content_weapon 0               // provides new weapons or new zombie killing functionality, i.e. guns, explosives, booby traps, hot tar,
    addonContent_Skin "zoey"       // 0 if no new skin textures for existing models. 1 if multiple skin pack. String in quotes if specific single skin
    addonContent_Spray 0           // Provides new sprays.
    addonContent_Map 0             // Add-on provides a standalone map
}

That file contains the description for the add-on that shows up in the add-ons menu and that it only contains a skin for zoey.

  • Create addonimage.jpg  It’s a 128 x 128 image but I’m not quite sure where it gets used yet.
  • Load the addonimage.jpg into VTFEdit and save as addonimage.vtf.
  • Inside of the folder with the addonimage files create a folder structure that matches what was in the .vpk file.  In this case \materials\models\survivors\teenangst\
  • Inside of the teenangst folder place the zoey_*.* files from the original .vpk folder.
  • Use VTFEdit and import your .tga.  Save as zoey_color.vtf and replace the one you just copied into the teenangst folder.  This sets it up for use in the game.
  • Now if all your paths are correct, when you double click pack.bat it will compile the art that you just created into a .vpk file and place it in the L4D2 addons folder.
  • Launch Left 4 Dead 2 and go into the add-ons section.  You should now see your choice and if you play a local multiplayer session on a level with zoey (Make sure to select one of the guys as your player) you’ll be able to see your new skin in all it’s glory.

zoeyThis was my first attempt. The texture corruption is due to the fact that I turned off mipmaps in VTFEdit. Don’t do that.

Inside of the .vmt files are instructions on how to render.  My next step is figuring out how to add stuff like environment map reflections.  I’ll probably post a result once I figure that out.

Good luck and happy modding!

Advertisements

From → 3d, Art, game, Misc. Tech

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: