Welcome, Guest. Please login or register. Did you miss your activation email?

* TUTORIAL SECTION RULES

This section is for SMOD TUTORIALS & GUIDES ONLY.
You may create a new topic in the appropriate area to share your tutorial. If you post anything off-topic here you will be temp-banned. This is so we don't hassle the moderators too much, they are volunteers.

If you need help with a tutorial, post a reply in its thread . Do not start a new topic for help here!

Author Topic: [SMOD] Converting CS:S World Models (Fix Crotchguns)  (Read 10519 times)

0 Members and 1 Guest are viewing this topic.

Offline BIZ

  • 32-Bit Hobo
  • *
  • *
  • +0% chance to make useful post
  • BIZ hides in shadows.
    • BSNOOCH.COM
[SMOD] Converting CS:S World Models (Fix Crotchguns)
« on: October 12, 2009, 04:50:48 AM »
This is a tutorial that many people were asking for. This is how I convert weapon w_models from Counterstrike so that HL2 npc's can fire them like normal people. I'm calling this the crotch gun fix.

This tutorial uses the extremely expensive modeling program 3D Studio Max, however the same theory applies to the less expensive MilkShape 3D.

Created - Saturday, November 01, 2008, 2:01:47 AM
Updated - 03.29.09




Converting CS:S world models (Fix crotch guns)

Well, I don't think anybody has a world model tutorial because there may be a few different ways to do it. Also its sort of hard to explain. I can tell you how I do them, which is probably the wrong way. But hopefully this will make others post an easier way of doing them and make me look like a fool.

First thing to know is that the way I fix world models involves some sort of modeling program. I use 3ds Max 9. So if you are using a different program some of the terms might be different, but the concept is *probably* the same. So lets get to fixing some crotch guns.

1.) Pick the model you want to rig.
I will do this gun - http://www.fpsbanana.com/skins/9309

2.) Decompile the Zapper world model. All you are really going to need from the Zapper is the reference SMD and the QC file.

**Link to decompiling models tutorial**



3.) Next thing I do is extract the gun from HL2 that I think best matches the custom weapon I am rigging. In this case, the Pistol.

For more on extracting core game files read:
http://developer.valvesoftware.com/wiki/GCFScape

3a.) Decompile the HL2 pistol.

4.) Open 3ds Max and import the Zapper reference SMD. Its named "w_pist_zapper.smd".

**NOTE: Jed released an SMD Import plugin for 3DS Max 9 that is bueno!

grab it here - http://www.wunderboy.org/apps/smdimport.php

5.) All you need to do once you have the Zapper reference SMD imported is delete all the bones. The bones are the little silver arrow looking things. Look at the screenshot below.



5a.) After you delete the bones save the zapper as a .max file. File-->Save As..
I'm going to call mine "zappa.max".

6.) Open a new scene and then import the HL2 pistol reference SMD. Its should be called "Pistol_reference.smd"

This is where it's going to get hard to explain.

7.) Go to File-->Merge and merge in your zappa.max file. A box should pop up, make sure you click "All"



8.) The idea here is to make the Zapper gun as close to the HL2 pistol as possible in size, position, rotation and direction. I will provide a few screenies here so you get a rough idea. It will be hard to get it exactly right, but what you want to strive for is to get the grip and the trigger of the Zapper in the exact same spot as the HL2 pistol, since that is where the NPC model will interact most with the gun.





9.) Once you have the Zapper in the exact same position as the HL2 pistol (like in the screenie above) delete the HL2 pistol mesh ONLY! You need to keep the Zapper and the bones.




10.) Next thing in Max, you need to parent the Zapper mesh to the bones. Its as easy as clicking on the Assign parent button (looks like a chain between 2 squares), then clicking on the Zapper mesh, and dragging to one of the bones. When you let go of the mouse button over the bone it will flash, indicating it has been parented. Do that for both bones.



You will notice now that if you move a bone, the zapper will move with it.

11.) Finally you need to export your newly rigged Zapper. You will need to download an SMDExporter for Max.

I would recommend using this one for Max 9
http://www.wunderboy.org/download.php?file=3dsmax_smd_exporter_v1.3.zip&s=2

11a.) Go to File-->Export and make sure you are exporting as a Source SMD file. Name it whatever you want, I'm going to name it "zap.smd". Make sure you have "Export Reference SMD" ticked.




I would RECOMMEND that you export it to the same folder where you have the decompiled HL2 pistol model!

Alright, done with Max now.

12.) To make the QC editing easier, we are going to rename our new "zap.smd" right now. The whole idea here is that we will be replacing the HL2 pistol's reference.

So the folder where you are keeping your decompiled HL2 pistol should look like this now



DELETE "Pistol_reference.smd"
now
RENAME "zap.smd" to "Pistol_reference.smd"

ok? See how we just replaced the old HL2 reference with our new Zapper one? Great, moving on.

13.) Time to do some QC editing. This may get confusing since you have two .qc files named "mdldecompiler.qc".

I am going to rename mine right now. I renamed the .QC from the decompiled Zapper to
"counterstrike.qc" and I named the decompiled HL2 pistol QC to "halflife.qc".

Just remember now

CS:S Zapper --> counterstrike.qc
HL2 Pistol --> halflife.qc

What we are going to do here is copy certain parts of the counterstrike.qc to the halflife.qc and then we will be compiling the halflife.qc

14.) The first line in your halflife.qc will start with this

Code: [Select]
    $cd "some directory"
This points to the folder where all your SMD files are located. That is why you need to keep them all in one folder. Change this now so that it points to the folder where your decompiled HL2 pistol model is located.

15.) The next line of your halflife.qc should read:
Code: [Select]
    $modelname "weapons/W_pistol.mdl"
This sets the name the compiled model will have and the directory it will be located in. I would advise you always keep the weapons/ part.

Lets change the name of our model now. Change the $modelname line to look like this:

Code: [Select]
    $modelname "weapons/w_zapper.mdl"
16.) The next line in our halflife.qc is:

Code: [Select]
    $model "studio" "Pistol_reference.smd"
This defines the reference.smd. If you renamed "zap.smd" in step 12, you DO NOT need to change this line, at all.

17.) The next part of our halflife.qc reads:

   
Code: [Select]
$lod 16
    {
    replacemodel "Pistol_reference" "lod1_Pistol_reference"
    }

This defines an LOD model(s). Since we didn't make an LOD model, just delete this section.

For more on LOD models, read this
http://developer.valvesoftware.com/wiki/LOD_Models

18.) Next line of the halflife.qc we need to edit:

Code: [Select]
    $cdmaterials "models\weapons\w_pistol\"
This line defines the folder where the materials that make up the model's skin are located. We need to change this to what is listed in the counterstrike.qc

Code: [Select]
    $cdmaterials "models\weapons\v_models\pist_zapper\"
19.) Next skip all the way down in your halflife.qc to this line:

Code: [Select]
    $collisionmodel "phymodel.smd" {
For information on collision models read this:
http://developer.valvesoftware.com/wiki/Collision_model

If you use the decompiled collision model, its probably not going to be right, you'll have guns sticking out of the ground and stuff.

A quick cheat around this is to replace "phymodel.smd" with your reference SMD and let the Source engine do the rest.

so the line in your halflife.qc should look like this:

Code: [Select]
    $collisionmodel "Pistol_reference.smd" {
20.) Skip...

21.) Ok your .qc file is now done and you are ready to compile, here is my finished .qc:

   
Code: [Select]
$cd "C:\my_smd_directory"
    $modelname "weapons/w_zapper.mdl"
    $model "studio" "Pistol_reference.smd"
    $cdmaterials "models\weapons\v_models\pist_zapper\"
    $hboxset "default"
    $hbox 0 "ValveBiped.Bip01_R_Hand" 0.000 -1.500 -5.000 5.000 0.000 0.000
    $hbox 0 "ValveBiped.Weapon_bone" -4.334 -1.435 -0.164 6.194 0.696 7.060
    // Model uses material "pistol.vmt"
    $attachment "muzzle" "ValveBiped.Weapon_bone" 6.31 -0.68 0.42 rotate 4.49 -1.17 -98.82
    $attachment "1" "ValveBiped.Weapon_bone" 1.06 0.18 0.72 rotate 8.79 89.53 -85.45
    $surfaceprop "weapon"
    $illumposition -0.013 0.491 -1.996
    $sequence idle "idle" loop ACT_VM_IDLE 1 fps 30.00
    $sequence attack1 "attack1" ACT_RANGE_ATTACK_PISTOL 1 fps 30.00 {
    { event 3014 1 }
    { event AE_NPC_MUZZLEFLASH 0 "PISTOL MUZZLE" }
    { event 6001 0 "0" }
    }

    $collisionmodel "Pistol_reference.smd" {

    $mass 2.0
    $inertia 1.00
    $damping 0.00
    $rotdamping 0.00
    }

22.) Alright now compile your world model and test it in game. If you did everything I did yours should look pretty damn close to this

« Last Edit: August 12, 2012, 03:58:41 PM by BIZ »

Offline BIZ

  • 32-Bit Hobo
  • *
  • *
  • +0% chance to make useful post
  • BIZ hides in shadows.
    • BSNOOCH.COM
Little bit for MS3D users here
« Reply #1 on: October 12, 2009, 04:54:06 AM »
Little bit for MS3D users here:

Yeah, same method works for milkshoope.

Except that you don't need to download any SMD Importer/Exporters.

And for step #10 You need to select the zapper mesh, then under the Joint tab select your bone, then click assign.



I don't use ms3d much but it seems to work.



Also links to free trials of

Maxspensive
http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=5659302

and

Milkshoope
http://chumbalum.swissquake.ch/ms3d/download.html

Offline Fidchell

  • *
  • *
  • +4% chance to make useful post
  • Fidchell has no influence.
Re: [SMOD] Converting CS:S World Models (Fix Crotchguns)
« Reply #2 on: August 27, 2011, 02:59:20 AM »
Is Blender able to do this?

Offline BIZ

  • 32-Bit Hobo
  • *
  • *
  • +0% chance to make useful post
  • BIZ hides in shadows.
    • BSNOOCH.COM
Re: [SMOD] Converting CS:S World Models (Fix Crotchguns)
« Reply #3 on: August 31, 2011, 09:45:17 PM »
Is Blender able to do this?

I haven't used blender so I cannot comment.
I will venture to guess that the method is very similar?

Offline IronCore

  • *
  • +3% chance to make useful post
  • IronCore has no influence.
Re: [SMOD] Converting CS:S World Models (Fix Crotchguns)
« Reply #4 on: March 18, 2013, 12:14:49 AM »
nice! I need to learn this. Such waste to see my world models embedded to combine's stomach lol!
I'm so in-love to SMOD...PERIOD!