How to fix CSS world models for HL2, Gmod and Smod.

– List of Contents --------
– A_1 Requirments
– A_2 Find a model
– A_3 Setting up XSI
– B_1 Fixxing bones
– B_2 Positioning
– B_3 Enveloping
– C_1 QC editing
– C_2 Compiling
– C_3 Finished Product
– 0_1 Other Information
– 0_2 V model Information
– 0_3 Physmodel info (Extra info)

Fixing the dreaded “Crotch gun” as some call it is far simpler than you would think. Unfortunately, not many people know how to do just that. And, if you were like me, you probably spent hours looking online for a “How to” or a “Fix CSS weapons” heading on Google. But, for the blessed few who read this, you don’t have to keep searching anymore. Let’s begin…

– A_1 Requirments –


You will need to download a few things.

XSI Mod Tool 6.01
Now, this is the version I use and it is completely free. I’m sorry if you have Maya but I think that you could transfer the methods over. I would have given the Autodesk link, but I don’t think that they carry Mod Tool anymore. Once you’ve downloaded it, install it.

XSI Mod Tool Valve Source Add-on.
What you want is the “Valve Source Add-on”. This will necessary for importing and exporting SMD’s. Once you’ve downloaded it, extract it right away (Or after you’ve scanned it if you prefer) .

We’ll need this so we can extract a hl2 model with the correct bones to replace css bones.

MDLDecompiler Version 0.5
You’ll need to be able to decompile your models in order to edit them in XSI. As far as I can tell, it works again.
This belongs in your “ep1\bin” folder.

Source SDK
You can get this from the tools tab when you are on Steam. Locate it and install it.

Now, if your computer can’t extract files from a rar compressed file then you will need…

7 Zip
If you have this already, then you can skip this part. Most weapons from FPS are in a rar or 7z compression. So, if you want a weapon from Fpsbanana then you are going to need something to extract them with.

I have download everything I have listed here and they have all checked out clean. So don’t worry.

– A_2 Find a model –

Now that we have all the things we need, let’s get our model. I for one am going to fix this Halo pistol.

Once you’ve finished downloading it, extract it to wherever you want. Personally, I try to keep things organized so try putting your downloads in something like C:\Users\myusername\Downloads\CSS downloads.

What we are going to need once we have or Halo pistol extracted is an hl2 pistol. Go to C:\Program Files\Steam\steamapps and scroll down until you reach “Source Models”. Open source models using GFCscape and when the window opens up go to Root\hl2\models\weapons\ and find the “w_pistol.mdl”. There should be six files with “w_pistol” in its name (not including the jpg). Highlight the six we need and right click them and click “extract”. Choose a place to extract them too. Again, stay organized, find a place to this that you will remember where it is. When I’m doing this sort of thing I have a “SDK weapons” folder in my documents. It looks like “C:\Users\myusername\Documents\ SDK weapons\MDLs\weapon models”.

Once we have both the Halo pistol and the HL2 pistol extracted to a place where we can get to them, we need to convert them SMD’s using Mdldecompiler. Double click Mdldecompiler and there should be 2 lines where direction are put. The first is where get our mdls. On the top line (Where it says “Choose model file”) find your Halo pistol. Next, on the line below (Where it says “Choose output directory”) find a spot where you want to send the decompiled model. Like I said earlier, organize, make a folder for your decompiled models, one for our Halo pistol and on for our HalfeLife2 Pistol. Do not extract them to the same place. Complete the whole process again with the HL2 pistol like how we did with the Halo pistol. Find it, decompile it, and organize it.

– A_3 Setting up XSI –

Once we’ve done that, startup XSI (I am assuming that you have already installed it. If not, do it). As soon as it’s ready go up to the file tab and then addons then install. Locate our Valvesource.xsiaddon file that we downloaded earlier and click install.

Once it’s finished, restart Mod Tool and start it back up again.

– B_1 Fixxing bones –

We are now ready to fix bones!

Once Mod Tool as booted back up, go to tab that says “ValveSource” and click “Import”.

Locate our decompiled models (If you organized them they shouldn’t be hard to find) and import both the Halo pistol and our hl2 pistol (one at a time of course). They should be called “w_pist_p228.smd” for the Halo pistol and “Pistol_reference” for the HL2 pistol. Once both models have loaded, press 8 on your keyboard to bring up your Modexplorer menu.

There should be a few things listed like “lights, camera_root, ValveBiped etc…” click on “ValveBiped”. There should be a few other trees. “ValveBiped and Bip01_R_Hand” ValveBiped is the CSS tree, and this is where we are going to start. Click on ValveBiped and there should be another tree called “weapon_bone”, click on this too. Inside that, there is “flash” and “weapon_bone_clip”.

Delete both of these and move up and delete “weapon_bone” and finally delete “ValveBiped” (The CSS ValveBiped, not the one at the top!). What we are left with is a mesh that we can work with (And by the way, to save time, you can middle click the css ValveBiped to branch select it and hit delete to get rid of them all at once).

– B_2 Positioning –

Click on our mesh and begin to line it up with our hl2 mesh. Now, if you are new to XSI Mod Tool, S is the default dolly key. Press S on your keyboard and use the Right Mouse button to move the camera, the Left Mouse button to orbit (Or rotate) and click and hold the Middle Mouse button (The one that you use to scroll) and move the mouse in and out to zoom. We must also use C to rotate

and V key to translate our mesh.

By holding down the SHIFT key we can snap of mesh at an angle. What you are going to do is make sure that the triggers line up because that’s where our trigger finger is going to be.

Once we have them lined up how we want them, press 8 to bring our Modexplorer back and delete the hl2 mesh. Next, go up to the “Transform menu” and select “Freeze all transforms”. We do this because when we rotate, scale or translate the model it affects the envelope in a negitive way (i.e Gun may show up on the side of the wrist or it will not as big as you scaled it in XSI).

– B_3 Enveloping –

Now we can set our envelopes.

By default when you first install XSI Mod Tool it is in the “Mod Tool” mode. What we need to do is switch it to “XSI Tools (Pro Mode)”. Go up to the modes tab that the top of the screen and click “XSI Tools (Pro Mode)”.

Once you’re there, press 2 on your keyboard for animate settings. Press 8 to bring back our Modexplorer and click on our remaining mesh.

Then, go to the side panel and click “Envelope” and “set envelope”.

A screen should pop up if you have the mesh highlighted asking if you want to continue (Or something like that). Click yes. Once you click yes, you will be asked to set an envelope. Left click on “Bip01_R_Hand” to highlight it and right click to finish. Your mesh is now enveloped over the hl2 bones.

As for the window that pops up, I don’t know what it does so I don’t mess with anything on there. Just press ENTER then close the window. Next, we export this using the “Valve Source” tab at the top of the screen. What we want to do is replace the “Pistol_refference.smd” with our new model. So we find where we decompiled our HL2 Pistol and click on the “Pistol_refference.smd”(Notice the path I took to find the Ref model).

Click ok and replace the old ref model. But wait, we’re not done yet, we need to make a Phys model as well. By default, when you export an SMD it’s file type is always set to “Model (.SMD)”, what we want to do is change it to “Physbox (.SMD)” and replace the “phymodel.smd” NOT the “Pistol_refference.smd” (Take a good look at the picture, it is set to replace the “phymodel.smd” with Physbox (.SMD) settings).

Click okay.

0_3 Physmodel info (Extra info)

I would like to add that when you do this, export a physbox, that it replaces the old pistol phymodel with our newly generated one, so it eliminates the need to rewrite the qc file. Now, you could use a different name for your physmodel. What you would need to do is fix the path in the qc…

**$collisionmodel "NEW_PHYSMODEL_HERE.smd" - Add the newly named phys model here**

– C_1 QC editing –

Now, in order get the materials in the right place, we have to do a bit of copying and pasting. When you decompile your MDLs they should have a “QC” files. You can open them up with “Notepad”, once inside, look for the “$cdmaterials”.

Copy the path from our Halo pistol QC into our HL2 Pistol QC.

Go ahead and close the Halo pistol QC (But keep the HL2 pistol QC open!)Since we are overwriting the HL2 pistol QC we can rename it as well. Rename it where it says “$modelname” and make sure that the name is inside the quotaions. You don’t have to name what I did, but personally I HATE IT when people give the weapons these short names that give you no idea what it is you are looking at! So, be precise. Also, don’t make the name too long. There is a problem that occurs when you have to many characters in the name that shows up in the hex code (But I’m not going to get into that right now). Once that’s done, we double check our “$cd” path.

Notice mine don’t match up with the path to my documents. So, all we have to do is copy the path that is on our documents window to the QC file.

– C_2 Compiling –

We are now ready to compile our model!

Begin by starting Steam. Then, launch Source SDK. Next Go to “C:\Program Files\Steam\steamapps\YourUserName\sourcesdk\bin\ep1\bin” and locate the ”studiomdl” application (if you don’t have The Orange Box then the app would probably be under sourcesdk\bin). What we are going to do is open our QC file using Studiomdl.

Once you do this, your SMD’s will compile and ready to be used in Half Life 2. When they finish, they will be located in “C:\Program Files\Steam\steamapps\YourUserName\half-life 2\hl2\models\weapons\pistols\Halo_M6D\w_mdl” (Of course where your weapon will be in the models folder all depends on what you named it).Before we take a peek at it we need to copy and paste our materials from our download (The FPS download) in to “C:\Program Files\Steam\steamapps\YourUserName\half-life 2\hl2” We do this because otherwise our model would show up purple and black. Now, let’s have a look. Go to Source SDK’s “Model Viewer” and find your model. Under the “File” tab and click “Load Model”, load a HL2 character to hold the gun, and then go back and click on “Load Weapon”. And as you can see, my model came out looking just right.

– C_3 Finished Product –

– 0_1 Other Information –

Now, as a little bonus, this process works with more than just world models. Here’s an example.

I took a Cyrsis weapon PROP and made it into a world model by going through the same process I listed above. The only difference is that you don’t have to delete any bones because this thing doesn’t have bones.

But, you might ask “I need to fix an SMG, how do I do that?” Well, depending on what SMG you are fixing all you have to do is either use the HL2 SMG or AR2 and decompile those and use thier refference model. Pretty much all you have to do is find the model with the right bones and use that. Example: for a sword, use either the stunstick or crowbar. for a shotgun (You guessed it) use the HL2 shotgun.

Now, I don’t want to see a whole tone of “5 second SWEPS” flooding Kay? Don’t go taking any model and putting it someones hands and making a SWEP out of it if you don’t have a v_model of the same gun.

– 0_2 V model Information –
If you would like to learn how to make a v_model, I suggested looking here.

And for extra information about v_models

I hope this has finally answered your question about how to fix CSS weapons. And if you didn’t understand something, tell me. This tutorial was made to edify.

If you found this to be useful, drop a comment. Part of what I do is try to make things easy enough to understand without having to use pictures. I hope I’ve done just that.

Thanks SOO Much !! finally someone who actually talks sense :smiley:
this has helped me out a ton :slight_smile: My new swep pack is due to be released soon.

I dont suppose you know how to make a heavy machine gun in garrysmod, that deploys a bipod on secondary fire and is fix to a certain position.

Thank YOu soo much, I’ll post the link to my new pack to you 1st.

Great tutorial with lots of pictures and links to programs. Have a tool.

By The way are you using the free version, because I can slightly “Demo Version” in the backgroud of the one I downloaded ?

Hi again :smiley:

I was just 75% through my weapon pack when I realised I was stuck, I am stuck on making a pistol with a togglable silencer. Do you think you could help me out on this :smiley: please.

the models are as listed ;

  • v_pist_colt1911
  • w_pist_colt1911a - with silencer
  • w_pist_colt1911 - without the silencer.

I have tried to learn from other base files but I just cant get the hang of it. any help would be much appreciated I’ll give credit too :smiley: on release of my wep pack.

I am looking for a lua code “template” as such. a sort-of fill in the blanks thing :smiley:

its sad that most people here are too stupid to figure it out by themselves.
i did.

Wow. This tutorial is fantastic!

Great tutorial, even I understood just from skimming the text. It wouldn’t be difficult to follow for people using max like myself.

As good-old Duke Nukem said “Eat Shit and Die”

Why did you bump this with a useless cheesy quote?

Damnit, it’s a good tutorial, but I can’t get the fucking model decompiler to work. What did you do?
(I tried StudioCompiler and it crashed as soon as I clicked on the load model button in the decompile tab, and mdldecompiler crashes everytime I try to load a model).

My guess is that the problem is with one of the 3 options available with the program.

  1. Dump old unweighted SMD’s

  2. Do not fix rotations on animations.

  3. Use Steam File Access.

The 3rd box is by default left checked. All you need to do is uncheck it and everything should work fine.


I already tried all of that and nothing worked.

My guess it’s because I’m trying to run it on Win7?

want a cookie ?

That couldn’t be it. I use Windows 7 as well. Tell me, what is the error message you get?

Generic “MDLDecompiler has stopped working” kind of error.

Is your error “mdldecompiler.exe - System Error ‘The program can’t start because vstdlib.dll is missing from your computer. Try reinstalling the program to fix this problem’”?

That’s an easy fix.
What you need to do is put your mdldecompiler in your Source SDK directory. C:\Program Files (x86)\Steam\steamapps\YOURUSERNAME\sourcesdk\bin\ep1\bin

MDLdecompiler requires sdk .dll’s to run.

If that doesn’t work, make sure that you have an output directory. Something like “C:\Users\Username\Documents\Source SDK\SMDs\PLAYERS\yourmodel”

If you don’t have an output, you’ll get a erroe message stating "ERROR, missing options ( Result Directory).

If you are getting an error that states “mdldecompiler - Unable to load model” Then it is because the model was compiled using the Orange Box format. To fix that you need to use a hex editor to change the fifth character from “0” to “,”; Change “IDST0” to “IDST,”.

Does any of this help?

Thanks, but sadly none of that helps. The decompiler just crashes after loading a model. It even gives me the “Loaded Model” message before crashing.

Here’s a screencap. It’s in spanish, but I think you get the idea what kind of error is.

Again, “MDLDecompiler has stopped working” kind of error.

You have to load it with steam on.