Left 4 Dead 2

Left 4 Dead 2

301 ratings
Custom Melee Mod (Maya)
By Splinks
In this tutorial you will be taught the ways of Valve style of modding L4D2.

Within this guide you will be using the source files used by Valve itself, which will be giving you the ability to make custom models, textures, and even animations. Before we begin, if you're rather new to Source engine modding please visit the following tutorial to pick up on the lingo that will be used in this tutorial.

Model Creation Overview

These were taken straight from the Valve archives and not converted in anyway. So please keep in mind these were used for the intention if you were a Valve employee and had all their tools at hand.
Materials Needed
Before we start we need to have a few things setup before we start on this badboy.

Ingredients include:
What's all this Machete Mod Pack Stuff
After downloading the Machete Mod Pack, here's what you eyes should be seeing.

If you were successfully able to see the above image then good news your eyesight still remains intact also you have the proper files needed to proceed.

Now if you're somewhat lost on what's what please direct your established working eye sight to the charts below.

The World Model Rig for the Machete.
The 1st person rig for the Machete.
(This file will be needed if you plan on making custom animations)
This holds all the marvelous Maya scenes for every animation the Machete uses.
Arm Rig
This folder holds v_arms_rig.ma, which arm the survivors' arm rigs with their mesh included. This file will be used and needed as a reference for all the 1st person Maya scenes.

This is just the folder that will be holding the pre-made directory path for the machete's default texture location. Also within this folder you should find the original PSD files used to make the textures of the machete.
In this folder will be where all the files needed for compiling the Machete as well with the completed MDLs you make by the end of this tutorial shall be stored.
The addoninfo.txt file is required by L4D2. It contains description information shown to the user via L4D2's Extras > Add-ons menu item.

What Would You Like To Do?
    Buckle up and proceed to the next step.

    Jump to Step "Setting up the Animation Scene"

    First Youtube some nifty Photoshop Texture Tutorials like this VVV
    Then come back here and jump onto Step "Making Textures".

    Keep Scrolling
Getting a Custom Model
At this point you could add or remove elements from the mesh if you wanted. To do that you would probably need to familiarize yourself both with basic concepts of 3d modeling and Maya usage as well. For the sake of this tutorial we’re not going to cross that bridge just yet. What we’re going to so is port a model from another game because it’s a little easier and quicker to deal with for now. Where you get the model doesn’t really matter ultimately…basically any format Maya can read is OK. There are LOTS of free model sites out there that will let you download models already in a format Maya can read.

Here's a few selected sites.
  • http://thefree3dmodels.com/stuff
      This is a decent one just because it has a lot of models already in 3dsmax friendly formats and it tells you the format it’s in on the thumbnail so it’s easy to see what will work for you.

  • http://www.models-resource.com/
      Full of old school game models and a few slightly newer ones. Also organizes models from what game and platform they came from for easy navigation.

  • XNALara Community[xnalara.home-forum.com]
    This Community is full of models and has a great set of folks that has made more rips then a fat man in skinny jeans. Also they have alot of custom content made by dedicated fans as well.

    To find models just google "Xnalara models" or visit two of the following sites

    These models must be extracted with a specific program/s tho.
      XNALARA: Link[www.tombraiderforums.com]
      XNALARA XPS: Link[xnalara.home-forum.com]

But for this tutorial we shall be using the Dota 2 Pudge's Cleaver.

If you would like to follow along CLICK HERE for the cleaver.
Setting up for The Switch
Alright everything is in place and we can now get this ball rolling....now let's hold hands and try to keep this ball from rolling downhill.

First lets open Maya with your new RunMaya.Bat shortcut you made in the "Materials Needed" Step.

From here you can open either "w_machette.ma" or "machete_rig.ma" from the "Machete Maya Files" Folder. For now I will be using the "w_machette.ma" first then moving on the more difficult 1st person rig.

You should be seeing something a lot like this VVVV

Now if you're following along lets IMPORT the Pudge's Cleaver, the file should be "cleaver.smd".
(This is how the scene should look currently)

From here will need to position the cleaver to the best of your abilities to match up with the machete. You may need to scale and adjust the your custom model to fix the size of the machete's handle so no odd model clipping occurs.
The Model Switch
Now it's time to play doctor ladies and gents. This operation will consist of a simple Mesh Swap. Now since this weapon is weighted to one bone no skinning will be needed so this will go pretty easy.

From here you will want to open your Outliner Window, which can be found in two of the locations shown on the below screenshot.

Now that your Outliner is open you will need to move the custom mesh into the "Weapon_bone" tab and delete the machete's mesh, for me my custom mesh will be the cleaver:cleaver.

From here you can save the Maya scene as a NEW file, for me I'm going with the name of "Cleaver of Awesomeness". This new scene will act as a custom "w_machette.ma".
Applying the Textures
Now before we complete this export we must get rid of the purple and black texture off this model.

  • First HOLD Right Click on the Cleaver's mesh
  • A window like the one to the right should popup.
  • Choose Lambert.
      • If done correctly you will see a tab to your right inside the Attribute Editor named Lambert#
        (for me it's lambert3)
      • After admiring the site of this new Lambert press the checkered Icon next to the COLOR adjuster
      • After clicking the checkered icon our good friend "The Render Node Creator" will be greeting you and also tempting you will all of it's texture goodness.
      • But for now we will have to hold our date with the Render Node Creator and CLICK FILE
      • After your farewell to the Render Node Creator the right of your screen should have a File Attributes Drop down window.
      • From here just click on the Folder Icon to the right of where it says IMAGE NAME.
      Now we navigate to where this Cleaver's base texture is and open that hunch of sexy looking group of pixels we call a texture.

        You will need to remember this file's name for when you create a VMT (which will have to have the same name as this texture you're selecting)[/b][/th]
        After all of that navigating and clicking you should be gazing upon what you see to the right of this sentence.
        From here it's would be wise to save the Project and then continue.
Exporting the Model
At last, we can now export the results of your hard work into a file ready to be converted over into L4D2.

First you will want to go to the FILE > EXPORT ALL tab.
Now we shall navigate to your "MACHETE PACKAGE Folder"'s compiling Files
Machete Package>models>weapons>Melee>Compiling Files>DMX

Now before we export, set the (Files of type:) to Valve SMD Model.
You will now have a set of options to the right side of the Export All window like below.

On these options you will want to have:
Import Skeleton
Up Axis
$upaxis Y
Add Node Prefix
Node Prefix
Bind Current

Simon says you may now choose your File Name and click EXPORT ALL.

Congrats you now have a new World (3rd person) Model ready to be compiled.
    Now take the this new knowledge and repeat the same steps going from
    "Setting up for The Switch" to "Exporting the Model"
    are taken to create the custom 1st person model as well.

From here if you don't wish to make a custom Animations then please jump to step "Making Textures". But if not then strap in because this ride isn't over just yet.
Setting up the Animation Scene
Now before jumping to this step note that I'm assuming you already have some understanding of how a Rig System works. With that being said Prepare yourselves.

So first lets start off by starting up Maya.
Now we will open your desired animation you wish to replace.
(All animation scenes can be found in the Machete Maya Files folder under the Animations folder)

For me I'm going to replace the Deploy animation, so lets begin:
  • First Open the Scene (*/Machete Maya Files/Animations/Deploy.ma)

  • After selecting an animation Maya scene you will be prompted with this message V

    This file will be located in the "Machete Maya Files" Folder titled machete_rig.ma, however if you've been following along and made a custom 1st person model then you will need to select the Maya scene that has your custom 1st person model.

  • After you have that scene selected you will then be greeted with another window.

    This file will be in the "Machete Maya Files > Arm Rig" folder.

  • Finally after the popup windows are gone your work space should be like the image one the left.
    At this time I suggest checking one of the arm layers located in the Channel Box/Layer Box Tab.
Editing the Animation
To keep this short I will be only working with the Weapon Bone Control (The BLUE Box).

So from here we will be wanting to verify how long this animation is by first selecting the Weapon Bone Blue Box and seeing where the red Key Selections end.
(This will tell us how many frames we can work with)
As you can see we have 30. :)

We now know our limits, so lets go crazy and make our own set of Red Key sections.

Personally I prefer to turn on the "Auto Keyframe"
at this point sense it saves any adjustments I make
to the position of the skeleton automatically.

If you have done everything correctly you will now be able to switch through each keyframe and see your custom skeleton positions. If you would like to see how your animation would behave ingame you could always Press the Play Button in the bottom right.
Here's my example of what my frame 1 will look like.

At this point it would be wise to save your project with a custom name like "My_Cool_New_Animation.ma" ....or something like that.
Exporting the Animation
After you feel satisfied with your new animation we can now EXPORT.

So go to "File > Export All" and in the Export Window choose (Valve SMD Animation) in the File Type.

This animation will need to be exported into the
(Machete Package\models\weapons\melee\Compiling Files\dmx\animation) Folder

You should also have a list of options to the right of the export window.

On these options you will want to have:
Import Skeleton
Up Axis
$upaxis Z
Add Node Prefix
Node Prefix
Bind Current

Now be sure you name this animation something so you know what animation it replaces. To keep things simple it shall be DEPLOY.SMD.

Congrats you now have a custom animation ready to compile into a mod....If you're only here to make an animation then please jump to step "Setting up for Compiling"

Making Textures
In order to make textures work within Source engine you will need to be using VTF and VMT files.

To make these files I suggest using the following program.
    VTFedit: Link[nemesis.thewavelength.net]

After downloading or installing VTFedit, start it up like so.

Now open each texture that the cleaver uses and save them into
Machete Package\materials\models\weapons\Melee
under the same name in .VTF format. If you're just here for retexuring the original Machete then you will just need to replace the existing Machete.VTF. If not just delete everything in the folder.

You should have something like this at this point VVV

Now open the Pudge_Clever.vtf into VTFedit.
Navigate to Tools > Create VMT File.
Now go to Options and change the Shader Option to VertexlitGeneric
Press Create and save the VMT as the same name as the base texture VTF.

If you're new to VMTs and VTFs I highly suggest visiting the following link to know all your possibilities of how you can make a texture behave in the game.

Valve Texture Format

You can now exit Vtfedit and open the new VMT you made in VTF edit and mess around with the settings. For me I added the normal map and a few settings to give the cleaver the ability to draw up blood when it's in-game.
Setting up for Compiling
Now that we have our new Models, Animation, and/or Textures we are ready to compile.

1st lets edit the file you will be using to compile everything..Which is the COMBILE.bat file located in:
Machete Package\models\weapons\melee\Compiling Files

Inside this bat file you will need to change the paths to where your L4D2 directory points to. For me it's directly on my D:\ Drive.
(Most of you will have it in your C:\Program Files or C:\Program Files (x86) directories.)

After that deed has been done, save and exit.

For educational purposes I will be showing visual changes to Machete.qc and let you use what you learn to tackle the W_Machete.qc.

Now open Machete.qc in Notepad ++. Depending on what you have made during this tutorial will determine what line of code you will need change. Follow the graph below to see where you fit in.

Materials Path
This path will be telling the compiler where to find the VMTs to use for the model. If this is not done correctly you will see purple and black checkered patterns all on your weapon.
Model Reference Path
This path will be looking for your model that was made in Maya. It's important to have the proper Extension File name or the compiler will kick the bucket and spit out everything in tongues.
Animation Path
$sequence or $animation
This is a bit trickier. Animations can be introduced through a series of ways, but since this tutorial is just learning simple basics I only focused on the Deploy animation. An easy way to make sure you don't miss your animation if it's being used multiple times is to press CTRL+F and search for your animation file. Then replace it with you custom file.

Also to keep issues from happening it's wise to keep your custom files named exactly or close to the original files they are to replace. Here's an example of how the QC should look if you have been following along all the way through my tutorial.

You now may save this and move to the next Step.
Now the moment of truth is here to see if you have set everything up properly.

Now if your not already go to your "Compiling Files" Folder
Machete Package > models > weapons > melee > Compiling Files

Now all together now!
Grab your machete.qc or w_machete.qc and drag it onto the COMPILE.bat file. Some cool Matrix like code will appear in a box and process your skills and convert you amazingness into compiled Model Files.

If done right you will see this Heavenly message
Completed "machete.qc"

You may be asking yourself, "Dammit Splinks where did my creation scurry off to"?
Easy children I will tell you where your files have gone to.

  • First locate your L4D2 Game Directory
    *\Steam\SteamApps\common\left 4 dead 2
  • Now open the "left4dead2" folder
  • Now the "models" folder
  • Continue on to the "weapons" folder
  • Take a deep breath and open the "melee" folder


Now move all those files to your Melee folder inside of the Machete Package folder.
Presto!!! We're practically done, but not entirely.
Making the VPK
We’re finally ready to build and test out the mod. Hard to believe but here we are. So, let‘s browse to this folder:

*\Steam\steamapps\common\left 4 dead 2\bin and locate the file vpk.exe.

Right click on vpk.exe and send to desktop as a shortcut. Now drag your entire Machete Package folder onto vpk.exe shortcut and let it work its magic. A few seconds later you should be greeted with Machete Package.vpk. Hell Yes! Let’s test it out. Browse to your l4d2 addons folder located here:

*\Steam\steamapps\common\left 4 dead 2\left4dead2\addons

Copy your vpk into this folder and voila! You just installed it. Make sure there are no other mods in there that might conflict with it (like another Machete mod or something) and if all looks well start up your game. Load any random map you like. If all the stars aligned you should see this:

Tiding up
Now it's time to clean up a few things and add a few bits of tuning to this package.

First lets remove the unneeded things. These would be the following 2 folders.

Machete Package\models\weapons\melee\Compiling Files
Machete Package\materials\models\weapons\Melee\PSD

Now we will be adjusting the AddonInfo.txt file.
Just open this in either notepad or notepad ++ and replace the fields with the proper data that credit the author/s and point out the mod in detail of what it does.

After both of these tasks are complete remake the VPK and place it into your addon folder.

Hosting to Workshop
Open up the authoring tools on Steam and select the "Workshop Manager".
Now click on the publish (+) icon. Another window should pop up at this point.
Now browse for your VPK and fill in all the details for your addon. Keep in mind that if your add-on exceeds 200MBs it can't be uploaded.
Once all of that is done, click the upload button on the bottom right corner. A browser window will pop up some seconds after, leading you to your add-on's page

< >
Fuin Shinchoku / C.Tiến Jul 16 @ 12:42am 
the guide was amazing, thanks a lot for the guide, but where can i find the rest of the .ma file for all melee weapon (sorry for the bad english)
Bobinsox Mar 19 @ 8:49am 
Ur da best!
Splinks  [author] May 17, 2017 @ 2:13am 
Try now. I ended up switching over to GoogleDrive due to Dropbox locking my public sharing due to too much traffic
Ding Dong Ur Opinion Is Wrong Dec 6, 2016 @ 3:07am 
Would be nice if there was a tutorial for making this for guns and also making the .MA files.
bepis Feb 27, 2016 @ 9:48pm 
how do dwe do this with weapons ? exampla the ak47
Mr Grande Dec 24, 2015 @ 11:58pm 
when I put QC file into the compile file it said" the system can not find the path specified"
Everything is done right and i am stuck at the Compilling part!
Krampus Jul 19, 2015 @ 5:14am 
I've replaced the machete with a random sword to test it, but when I have to save on Valve SMD format, there is an error. I can't access the menu on the right, and the error says :
// Error: line 0: Cannot find procedure "vstSmdModelTranslatorOptions".
PS : I don't have the vsSkinner.mll on my plug-ins menu, is it normal ?
Ouroboros Mar 11, 2015 @ 5:33pm 
dis stuff looks 2 hard
HekuT Mar 1, 2015 @ 2:23pm 
Please, help me. I do not understand how to make a model 1st person.

W_ model i got it how to make, but V_ model I have a problem.