How to make a working weapon model for use in SWEPs?

I want to port a weapon’s viewmodel, and animations for reloading and firing so I can use it for making a SWEP. I want to know how I can take all the animations and the model and make it into a working weapon model so I can make a SWEP. I have access to Blender and or Sketchup plus the tools to rip the models from the game as well as the animations.

Anyone? Please? I’m really itching to learn how to make this happen!

Depends on what game you’re porting from.If you can get the animations, then that’s great.

  1. Rip the models or get them by extracting the game’s files. You can only do the latter if the extracted files are in a usable format for blender.

  2. Import the model into Blender. I’m not exactly sure how Blender works because I use 3ds Max, but I assume the process is similar enough.

  3. If you plan to use the game’s viewmodel hands, you’ll have to import those as well. Otherwise, use c_model hands or v_model hands. C_model hands is what Garry’s Mod uses, while V_model hands is typically Counter-Strike: Source hands.

  4. When having the hands you want and the weapon in Blender at the same time, make sure everything that needs a bone has one. These things include the magazine/shell (if the weapon is a shotgun), each joint of each finger (3 per finger, meaning 2 for both hands), the wrist, the elbow, the weapon’s trigger, etc. Attach the bones to the correct parts, and the bones should be touching the object it’s controlling.

  5. Once you have all the bones done, export this as an smd file named something like “gun_ref” or something like that.

  6. Now save this as a project in Blender in place you can easily access.

  7. Import an animation with the project open. Make sure all the parts that are supposed to move do in fact move. Otherwise you’ll have to fix them.

  8. Export this as an smd with a name relating to the animation. For shooting, it should be “shoot1” or “fire1” (if you only have one shooting animation you don’t need numbers in the name). For reloading, it should be “relaoding1” or the like. Also make sure you have an idle animation as well.

  9. Repeat steps 7 & 8 until all the animations you want are exported as smd’s.

  10. You’ll need to make a “qc” file. You can do this by opening a text editor, saving a .txt file, then changing the “.txt” at the ned of the name to “.qc”

Here is an example qc file to explain what you need inside.


$modelname "modelnamehere.mdl"

$model "studio" "Nameofreferencefilehere.smd"

$cdmaterials "models\Folders\leadingto\weaponmaterials\"
$cdmaterials "models\Folders\leadingto\handmaterials\"


$sequence name-of-idle-animation "idle" ACT_VM_IDLE 1 snap fadein 100.00 fps 16.00

$sequence name-of-shooting-animation "shoot1" ACT_VM_PRIMARYATTACK 1 snap fadeout 100.00 fps 40.00 {
  { event 5001 0 "1" }
}

$sequence name-of-reload-animation "reload" ACT_VM_RELOAD 1 fadeout 100.00 fps 30.00 {
  { event 5004 7 "Event.One" }
  { event 5004 24 "Event.Two" }
  { event 5004 43 "Event.Three" }
  { event 5004 59 "Event.Four" }
}

$sequence draw "draw" ACT_VM_DRAW 1 fadeout 100.00 fps 30.00 {
  { event 5004 1 "Event.Draw" }
}



Where I put “name-of-something-animation”, put the name of the smd file relating to it without “.smd”
Instead of “event.One” and such, change these to reflect what happens. For example, when the clip comes out of the gun, make the event name something like “WeaponName.Clipout”. The number between the 5004 and “Event.One” is how many frames until that Event should be called. When you make the Swep, this is how you reference when to play a sound to reflect what the gun is doing.

If there’s anything else you need covered, ask, or look up guides on modeling/animating for the Source Engine with Blender.

Thank you for the help!

I’d just like to tell you what I’ve done so far.

I might as well tell what exactly I’m trying to port then ask a few things. I am currently trying to figure out how to port Black Ops weapons. So far I am able to export the models from the game as .smd format and load them into blender. The only things I don’t know how to do is how to put the viewmodel hands as they are in game and how to import the animations and textures into the game. I’m using the Tom Crowley tools.

What I need to know is:

How to apply the weapon’s textures to the weapon model (textures appear to be exported under .dds format)

and how to import the animations and set the viewmodel hands to what they are like in-game.

I am still new to this whole thing and I’m willing to learn!

Er… you may want to start with a little less complicated topic.

Textures in Source are done with VMTs/VTFs. I recommend you look up some tutorials, and start with something simple, like a prop.

Once you’ve got the basics down I can get you started with animations.

So if I’m correct, I would have to export the dds files as either vmt/vtf files to apply them to the model in Blender?

No, you can drag/drop the dds files onto the mesh in Blender, but to get them to appear in Source you need to convert the texture to a VTF, then create a VMT that points to the VTF location. Make sure both files are located in your $cdmaterials path.

Like I said, if it’s too much at once, look up some tutorials. There are some great beginner tutorials on GameBanana and the internet in general.

I personally don’t use Blender, so I can’t help you there. The best place I can lead you to is the Blender tutorials found on the Blender website, or try searching tutorials on Google or Youtube.

Good luck, mate.

Here’s what I have so far. I can’t get the textures to apply when I drag them into Blender. Do I have to change the model to anything? the model is a .smd file when I exported it from the game.

Right-click the object, hit Tab, press A to select all the vertices, then drag/drop the dds file onto the mesh.

Although since Black Ops models export funky, you’ll have to invert all the normals and flip the UVs . Like I said, start with something simpler, at least learn how to use the software first.

Alright, I’ll see what I can do for now, if not I’ll ask around some more. Thanks for everything so far.