Compiling L4D2 First-Person Weapon Models

Hi

This tutorial is marked advanced because a lot of things will seem complex and/or alien to people who haven't compiled Source engine models before, and there are things unique to L4D2 viewmodels that other Source games don't do or do differently. Knowing how to compile to HL2 or CSS before this helps a lot (I made an unreleased CSS G3SG-1 re-anim before attempting L4D2 if you dig far back enough on my youtube channel).

Here's how I compile first-person models (viewmodels/v_model) to L4D2:

You need:

  • GCFScape (open L4D2's pak##_dir.vpk and extract weapon models)
  • Notepad++ (note the ++ plus plus)
  • Weapon models and animations as smd files, scaled correctly for L4D2 ingame, preferably using the L4D2 arms skeleton.
  • L4D2's studiomdl.exe (install L4D2 addon support and authoring tools)
  • MDLDecompiler (Fixed version by Hooch will work)

Animation exported as smd you need:

  • idle (animated/fidgeting, preferably with the first and last frames as the "true" idle pose)
  • running while aiming
  • idle pose nudged over a bit, happens when aiming 90 degrees up position (1 frame)
  • idle pose nudged over a bit in a different position, happens when aiming 90 degrees down position (1 frame)
  • fire single shot
  • reload
  • melee attack/swing rifle butt/pistol whip/whatever
  • draw/equip/ready weapon

the smds I used in the tutorial images below are:

bash.smd - melee anim
default.smd - unused, the t-pose/a-pose/rest-pose
down.smd - aiming down pose
draw.smd - draw
fire.smd - fire
idle.smd - idle animated
pose.smd - idle pose 1 frame (not necessary if your idle anim is set up like I explained above)
reload.smd - reload
run.smd - run
up.smd - aim up

For idle aiming-up/down, I usually just move the root bone (to move all bones), to avoid posing problems when interpolating/blending with other anims. Remember, the weapon follows your camera, and you don't actually have to rotate the model pointing 90 degrees up, or 90 degrees down for these two poses, just nudge the weapon into a different position. Imagine the relative positions of the shoulders to the eyes/camera when aiming up/down.

We need to get some files from L4D2. Most of the weapons are gotten by opening pak01_dir.vpk with GCFScape. If the model appeared in one of the DLC's, they'll be in that DLC's pak01_dir.vpk. Decompile the weapon you want to replace, and hopefully get some of the qc file from it:

You may need to open the mdl up in notepad++ first and edit "IDST1" to "IDST," (yes, change the the one1 to a comma,) in the first line of the MDL file.

decomp get files

Hopefully you get a qc file like this:

decomp qc

If you get no qc, you should try a v_rifle (Assault Rifle / M16) replacement first, as I will post my own entire M16 QC. Almost all other weapons can be derived from that, once you know what else is below.

Next you need to consolidate your model smd files:

collect your smds

Edit the qc file to incorporate your smds and give it attachments for muzzleflash, flashlight/laser, and shell ejection:

clean or create qc

How to use Model Viewer to set-up attachments:

align the attachments Put the attachments in the same order as the original ones, order is how they're used by the game in certain ways, not always by name.

With the non-animation parts of the qc out of the way, we start creating the animation qc. Here is my v_rifle animation qc cheat sheet. I had to make this from mostly scratch and fill in all the blanks from what I saw in Model Viewer, the few anim qc lines that did decompile, and the last line of the mdl file. The hunting rifle is the most painful because of all the unused sequences. You can fill those in with duplicates of similar animations, or a motionless delta anim.

M16 QC FILE (my G36C mod)

$modelname "v_models\v_rifle.mdl"

$include "sharedbones.qci"

$origin -0.3 4.0 64.0

$body "v_g36" "v_g36c_arby26.smd"
$body "v_m16_case" "v_M16_casing.smd"

$cdmaterials "models\v_models\Weapons\arby26_g36c\"
$cdmaterials ""
$hboxset "default"
$hbox 0 "ValveBiped.Bip01" 0.000  0.000  -0.018  20.239  17.853  4.890

$attachment "attach_shell_eject" "g36c_all" -0.70 0.47 2.50 rotate -25 145 -180
$attachment "attach_muzzle" "g36c_all" -0.00 0.56 17.50 rotate -90 0 0
$attachment "muzzle_flash" "g36c_all" -0.00 0.56 17.50 rotate -90 0 0
$attachment "flashlight" "g36c_all" 0.00 -2.40 13.70 rotate -90 0 0
$attachment "shell" "g36c_all" -0.70 0.47 2.50 rotate -25 145 -180
$attachment "attach_camera" "ValveBiped.attach_camera" 0.00 0.00 0.00 rotate 0 0 0
$attachment "fowardnode" "g36c_trig" 0.00 0.00 0.00 rotate 0 -0 0

$include bonemerges.qci

$surfaceprop "default"
$illumposition 7.307 0.000 -31.193

$animation idle_delta "anims\pose.smd" fps 30.00

$animation look_down "anims\down.smd" fps 30.000000 subtract idle_delta 0
$animation look_mid "anims\pose.smd" fps 30.000000 subtract idle_delta 0
$animation look_up "anims\up.smd" fps 30.000000 subtract idle_delta 0
$sequence look_poses look_up fps 30.00 {
  blendwidth 3
  blend ver_aims -1.000000 1.000000
  delta
 look_mid look_down
}

$sequence idle_raw "anims\idle.smd" loop fps 30.00
$animation ta_trans_run "anims\run.smd" loop fps 40.000000
$animation ta_trans_idle "anims\idle.smd" fps 30.000000
$sequence idle "anims\run.smd" loop ACT_VM_IDLE 1 fps 40.00 {
  blendwidth 3
  blend move_x -0.500000 0.500000
 ta_trans_idle ta_trans_run
  addlayer look_poses
}

$sequence deploy "anims\draw.smd" ACT_VM_DEPLOY 1 fps 30.00

$sequence deploy_layer "anims\draw.smd" ACT_VM_DEPLOY_LAYER 1 fps 30.00 subtract idle_delta 0 {
 delta
  { event 5004 1 "AK47.Deploy" }
  { event 5004 13 "Rifle.SlideBack" }
  { event 5004 18 "Rifle.SlideForward" }
}

$sequence fire "anims\fire.smd" ACT_VM_PRIMARYATTACK 1 snap fps 64.00 {
  { event AE_MUZZLEFLASH 0 "1" }
}
$sequence fire_layer "anims\fire.smd" ACT_VM_PRIMARYATTACK_LAYER 1 snap fps 64.00 subtract idle_delta 0 {
 delta
  { event AE_MUZZLEFLASH 0 "1" }
  //optional:  { event AE_CL_CREATE_PARTICLE_BRASS 1 "weapon_shell_casing_rifle shell" } // weapon_shell_casing_[9mm,rifle,shotgun]
  //procedural shell ejection, not a manually animated shell in fire anim.
}

$sequence reload "anims\reload.smd" ACT_VM_RELOAD 1 fps 30.00 {
}
$sequence reload_layer "anims\reload.smd" ACT_VM_RELOAD_LAYER 1 fps 30.00 subtract idle_delta 0 {
 delta
  { event 5004 11 "Rifle.ClipOut" }
  { event 5004 27 "Rifle.ClipIn" }
  { event 5004 35 "Rifle.ClipLocked" }
  { event 5004 52 "Rifle.FullAutoButton" }
}

$sequence melee "anims\bash.smd" ACT_VM_MELEE 1 snap fps 30.00 {
}
$sequence melee_layer "anims\bash.smd" ACT_VM_MELEE_LAYER 1 snap fps 30.00 subtract idle_delta 0 {
 delta
}

$sequence helping_hand_extend "anims\help_ext" ACT_VM_HELPINGHAND_EXTEND 1 fps 80.00 fadein 0.0 fadeout 0.0 {
}
$sequence helping_hand_extend _layer "anims\hr_help_ext" ACT_VM_HELPINGHAND_EXTEND_LAYER 1 fps 60.00 fadein 0.0 fadeout 0.0 {
  { event 5004 1 "Rifle.HelpingHandExtend" }
}

$sequence helping_hand_loop "anims\help_idle" loop ACT_VM_HELPINGHAND_LOOP 1 fadeout 0.0 fps 30.00

$sequence helping_hand_loop_layer "anims\help_idle" loop ACT_VM_HELPINGHAND_LOOP_LAYER 1 fadein 0.2 fadeout 0.2 fps 30.00 {
}

$sequence helping_hand_retract "anims\help_ret" ACT_VM_HELPINGHAND_RETRACT 1 fps 80.00 {
}
$sequence helping_hand_retract_layer "anims\help_ret" ACT_VM_HELPINGHAND_RETRACT_LAYER 1 fadein 0.0 fadeout 0.0 fps 45.00 {
  { event 5004 1 "Rifle.HelpingHandRetract" }
}

$sequence item_extend_extend "anims\help_ext" ACT_VM_ITEMPICKUP_EXTEND 1 fps 80.00 fadein 0.0 fadeout 0.0 {
}
$sequence item_extend_layer "anims\help_ext" ACT_VM_ITEMPICKUP_EXTEND_LAYER 1 fps 60.00 fadein 0.0 fadeout 0.0 {
  { event 5004 1 "Rifle.ItemPickupExtend" }
}

$sequence item_extend_loop "anims\help_idle" loop ACT_VM_ITEMPICKUP_LOOP 1 fadeout 0.0 fps 30.00 
$sequence item_extend_loop_layer "anims\help_idle" loop ACT_VM_ITEMPICKUP_LOOP_LAYER 1 fps 30.00 fadein 0.2 fadeout 0.2 {
}

$sequence item_extend_retract "anims\help_ret" ACT_VM_ITEMPICKUP_RETRACT 1 fps 80.00 {
}
$sequence item_extend_retract_layer "anims\help_ret" ACT_VM_ITEMPICKUP_RETRACT_LAYER 1 fps 45.00 fadein 0.0 fadeout 0.0 {
  { event 5004 1 "Rifle.ItemPickupRetract" }
}

It's very important that the $sequence lines appear in order in the qc. If these are out of order, weird things happen online, such as different animations playing in the place of others and cutting off early.

Here's how to get the sequence order on models:

seq order

There is an alternative method of getting the order of the sequences.

This is the HARD WAY:

sequence order the hard way

Order when writing the qc: sequence qc

Since some qcs don't decompile fully or at all, this is the only way to know how to make the sequences for other weapons (the hunting rifle is the hardest, pistols have more sequences than most weapons with their visible slide positions).

You should now be finished with the qc and you are ready to compile.

Sometimes you need to compile and re-install over and over again to tweak your model. Here's the fast way to compile+install using bat files:

http://www.mediafire.com/convkey/671b/9asgdeuca8syt6pfg.jpg

Here's what goes in the compile bat (fill in your folders/file locations)... You will need to create models\v_models\ before hand because studiomdl.exe never makes missing folders itself and will just error:

@"C:\Program Files (x86)\Steam\SteamApps\common\left 4 dead 2\bin\studiomdl.exe" -game "C:\[your compiled models folder, that contains a copy of the L4D2 gameinfo.txt]\" [name of your qc file].qc %1 %2 %3 %4 %5 %6 %7 %8 %9

pause

Here's what goes in the install bat (fill in your folders/file locations)... you need an addoninfo.txt (info on Valve Developer Wiki) in the root folder of the mod folder that you'll be turning into a vpk file.

@copy "C:\[your compiled models folder]\models\v_models\v_rifle.mdl" "C:\[your mod folder]\models\v_models\"
@copy "C:\[your compiled models folder]\models\v_models\v_rifle.dx90.vtx" "C:\[your mod folder]\models\v_models\"
@copy "C:\[your compiled models folder]\models\v_models\v_rifle.vtx" "C:\[your mod folder]\models\v_models\"
@copy "C:\[your compiled models folder]\models\v_models\v_rifle.vvd" "C:\[your mod folder]\models\v_models\"

@"C:\Program Files (x86)\Steam\SteamApps\common\left 4 dead 2\bin\vpk.exe" "C:\[your mod folder]"
@copy "C:\[your mod folder].vpk" "C:\Program Files (x86)\Steam\SteamApps\common\left 4 dead 2\left4dead2\addons\"
@del "C:\[your mod folder].vpk"
pause

It copies your compiled model files from where they compiled to the folder you will create a vpk from.

After doing that, remember to look inside the new addon vpk in L4D2 and make sure your model files are there.

BELOW ARE THE OTHER QCI FILES EXPLAINED:

The arms change in L4D/L4D2 depending on what character you are playing as. They are an attachment to the current weapon model, an attachment that spans multiple animated bones. The arms bones exist in the weapon model and are animated there (or point to where the animations are in another mdl or mdl+ani... I never do this and only compile anims into the weapon mdl). Studiomdl.exe will delete bones it thinks are useless. To prevent this, we need to specify that the bones will be used for attachments ($bonemerge). We also need to put the bones in order ($definebone).

sharedbones.qci is used to put the L4D2 arms bones in order... you can get the same stuff from following the Valve Developer's wiki on $definebone, and I found the order in Model Viewer / last line of mdl file. I include this before the bonemerging.

Complete sharedbones.qci:

$definebone "ValveBiped.ValveBiped" "" 0.000000 -0.000000 0.000000 -0.000000 0.000000 89.999983 0.000000 0.000000 0.000000 -0.000000 0.000000 0.000000
$definebone "ValveBiped.Bip01" "ValveBiped.ValveBiped" 0.000000 38.317692 -0.516773 0.253992 89.999983 89.999983 0.000000 0.000000 0.000000 -0.000000 -0.000000 0.000000
$definebone "ValveBiped.Camera" "ValveBiped.ValveBiped" 0.000000 56.084805 0.000000 -0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000 0.000000
$definebone "ValveBiped.weapon_bone" "ValveBiped.Bip01" 8.329033 7.655514 0.000000 -89.999983 -89.745989 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
$definebone "ValveBiped.attach_muzzle" "ValveBiped.weapon_bone" 0.000000 0.099716 8.360893 -89.999983 -0.000000 0.000000 0.000000 0.000000 0.000000 -0.000000 -0.000000 0.000000
$definebone "ValveBiped.attach_shell_eject" "ValveBiped.weapon_bone" 0.000000 3.003864 1.610714 -0.000000 89.999983 -89.999983 0.000000 0.000000 0.000000 0.000000 0.000000 -0.000000
$definebone "ValveBiped.attach_camera" "ValveBiped.Camera" 0.000000 0.000000 0.000000 -89.999983 -0.000000 0.000000 0.000000 0.000000 -0.000000 -0.000000 0.000000 0.000000
$definebone "ValveBiped.Bip01_Spine" "ValveBiped.Bip01" 4.044003 0.000000 0.000000 -0.000000 -4.512557 0.000000 0.000004 0.000000 0.000000 -0.000000 -0.000000 0.000000
$definebone "ValveBiped.Bip01_Spine1" "ValveBiped.Bip01_Spine" 3.995838 0.000000 -0.000000 -0.000000 -9.852983 0.000000 0.000000 0.000000 -0.000000 -0.000000 -0.000000 0.000000
$definebone "ValveBiped.Bip01_Spine2" "ValveBiped.Bip01_Spine1" 3.698242 0.000002 -0.000000 -0.000000 -0.906992 0.000000 0.000000 0.000000 0.000000 -0.000000 -0.000000 0.000000
$definebone "ValveBiped.Bip01_Spine4" "ValveBiped.Bip01_Spine2" 5.700890 0.000000 0.000000 -0.000000 28.371669 0.000000 0.000000 0.000001 -0.000000 -0.000000 -0.000000 0.000000
$definebone "ValveBiped.Bip01_L_Clavicle" "ValveBiped.Bip01_Spine4" 4.065392 1.458947 1.500000 -63.875281 -147.035752 50.277508 -0.000002 0.000000 0.000000 0.000002 0.000000 -0.000001
$definebone "ValveBiped.Bip01_L_UpperArm" "ValveBiped.Bip01_L_Clavicle" 5.507359 0.000004 -0.000001 -19.730434 -44.165479 -79.348296 0.000000 0.000000 0.000000 0.000002 -0.000001 0.000001
$definebone "ValveBiped.Bip01_L_Forearm" "ValveBiped.Bip01_L_UpperArm" 10.907398 -0.000000 0.000000 -0.000000 -7.202482 0.000000 0.000004 -0.000000 0.000000 -0.000000 -0.000002 0.000000
$definebone "ValveBiped.Bip01_L_Hand" "ValveBiped.Bip01_L_Forearm" 10.424324 -0.000008 -0.000031 6.507313 7.122666 78.669799 0.000002 0.000000 0.000000 -0.000003 0.000000 -0.000003
$definebone "ValveBiped.Bip01_L_Finger4" "ValveBiped.Bip01_L_Hand" 2.997269 0.005409 -1.477471 8.213346 -12.990158 11.742424 0.000000 0.000000 0.000000 -0.000003 -0.000002 0.000001
$definebone "ValveBiped.Bip01_L_Finger41" "ValveBiped.Bip01_L_Finger4" 1.510380 0.000002 0.000000 0.955233 -34.374601 0.653404 0.000000 -0.000000 0.000000 -0.000002 0.000002 0.000003
$definebone "ValveBiped.Bip01_L_Finger42" "ValveBiped.Bip01_L_Finger41" 0.808655 -0.000000 0.000000 -10.048536 -17.354258 -3.121069 0.000000 0.000001 0.000000 -0.000003 0.000005 0.000002
$definebone "ValveBiped.Bip01_L_Finger3" "ValveBiped.Bip01_L_Hand" 3.305799 0.203110 -0.546730 5.954118 -16.778210 11.337860 0.000000 0.000000 0.000000 -0.000003 -0.000001 0.000000
$definebone "ValveBiped.Bip01_L_Finger31" "ValveBiped.Bip01_L_Finger3" 1.807182 0.000000 0.000000 -5.063459 -30.512979 -2.977603 0.000000 -0.000000 0.000000 -0.000002 0.000003 0.000001
$definebone "ValveBiped.Bip01_L_Finger32" "ValveBiped.Bip01_L_Finger31" 0.966141 0.000002 0.000000 0.559033 -13.904478 0.138371 0.000000 -0.000000 0.000000 -0.000001 0.000007 0.000001
$definebone "ValveBiped.Bip01_L_Finger2" "ValveBiped.Bip01_L_Hand" 3.571508 0.109303 0.409580 3.893590 -14.791080 10.730296 0.000000 0.000000 -0.000000 -0.000003 -0.000001 -0.000001
$definebone "ValveBiped.Bip01_L_Finger21" "ValveBiped.Bip01_L_Finger2" 2.150654 0.000004 0.000000 -3.092658 -37.967168 -2.410834 0.000000 0.000000 0.000000 -0.000003 -0.000003 0.000001
$definebone "ValveBiped.Bip01_L_Finger22" "ValveBiped.Bip01_L_Finger21" 1.152744 -0.000002 0.000000 0.688635 -8.970347 0.108691 -0.000004 -0.000000 0.000000 -0.000004 -0.000002 0.000001
$definebone "ValveBiped.Bip01_L_Finger1" "ValveBiped.Bip01_L_Hand" 3.684095 -0.158701 1.419182 1.961117 -11.693728 10.352717 -0.000002 -0.000002 0.000000 -0.000003 -0.000001 -0.000001
$definebone "ValveBiped.Bip01_L_Finger11" "ValveBiped.Bip01_L_Finger1" 1.701012 0.000000 0.000000 3.669047 -38.756246 2.940822 0.000000 0.000000 0.000000 -0.000003 -0.000002 0.000001
$definebone "ValveBiped.Bip01_L_Finger12" "ValveBiped.Bip01_L_Finger11" 0.994709 -0.000001 0.000000 2.209323 -1.896548 0.073168 0.000000 0.000000 0.000000 -0.000003 0.000000 0.000001
$definebone "ValveBiped.Bip01_L_Finger0" "ValveBiped.Bip01_L_Hand" 1.068068 -1.287201 0.981905 -19.741837 -7.111211 97.051429 0.000000 0.000000 0.000000 -0.000003 0.000004 0.000000
$definebone "ValveBiped.Bip01_L_Finger01" "ValveBiped.Bip01_L_Finger0" 1.836304 0.000002 0.000000 -10.778427 -10.615990 0.000001 0.000002 0.000000 0.000002 -0.000003 0.000001 0.000001
$definebone "ValveBiped.Bip01_L_Finger02" "ValveBiped.Bip01_L_Finger01" 1.223946 0.000000 0.000000 -2.328848 11.249054 0.000000 -0.000002 0.000000 0.000000 -0.000003 0.000002 0.000000
$definebone "ValveBiped.Bip01_R_Clavicle" "ValveBiped.Bip01_Spine4" 4.065392 1.458947 -1.500000 63.875281 -147.035752 -54.583283 0.000002 0.000000 0.000000 -0.000002 0.000003 -0.000001
$definebone "ValveBiped.Bip01_R_UpperArm" "ValveBiped.Bip01_R_Clavicle" 5.507360 0.000004 0.000000 22.698469 -42.953728 82.695000 0.000000 0.000000 0.000000 0.000003 -0.000001 -0.000000
$definebone "ValveBiped.Bip01_R_Forearm" "ValveBiped.Bip01_R_UpperArm" 10.907391 -0.000001 0.000000 0.000003 -7.202482 -0.000000 -0.000004 0.000000 0.000000 0.000003 -0.000001 -0.000000
$definebone "ValveBiped.Bip01_R_Hand" "ValveBiped.Bip01_R_Forearm" 10.424303 -0.000004 0.000019 -6.507538 7.122609 -78.876979 0.000000 0.000000 0.000000 0.000002 0.000000 -0.000003
$definebone "ValveBiped.Bip01_R_Finger4" "ValveBiped.Bip01_R_Hand" 2.997292 0.000063 1.477481 -8.213406 -12.989928 -11.535190 0.000000 0.000002 0.000000 0.000001 -0.000002 0.000000
$definebone "ValveBiped.Bip01_R_Finger41" "ValveBiped.Bip01_R_Finger4" 1.510384 0.000000 -0.000000 -0.955234 -34.374611 -0.653401 0.000000 0.000000 0.000000 0.000002 -0.000009 0.000000
$definebone "ValveBiped.Bip01_R_Finger42" "ValveBiped.Bip01_R_Finger41" 0.808651 0.000001 0.000000 10.048533 -17.354271 3.121072 0.000000 0.000000 0.000000 -0.000001 -0.000007 -0.000002
$definebone "ValveBiped.Bip01_R_Finger3" "ValveBiped.Bip01_R_Hand" 3.305809 0.201132 0.547460 -5.954234 -16.777983 -11.130624 0.000000 0.000000 0.000000 0.000001 -0.000002 0.000000
$definebone "ValveBiped.Bip01_R_Finger31" "ValveBiped.Bip01_R_Finger3" 1.807178 -0.000002 -0.000000 5.063457 -30.512989 2.977604 0.000000 -0.000001 0.000000 0.000001 -0.000003 -0.000001
$definebone "ValveBiped.Bip01_R_Finger32" "ValveBiped.Bip01_R_Finger31" 0.966141 0.000000 -0.000000 -0.559035 -13.904483 -0.138371 0.000000 0.000000 -0.000000 -0.000000 0.000000 -0.000001
$definebone "ValveBiped.Bip01_R_Finger2" "ValveBiped.Bip01_R_Hand" 3.571527 0.110786 -0.409183 -3.893706 -14.790906 -10.523117 -0.000004 0.000000 0.000000 0.000001 -0.000001 -0.000000
$definebone "ValveBiped.Bip01_R_Finger21" "ValveBiped.Bip01_R_Finger2" 2.150656 0.000000 0.000000 3.092655 -37.967171 2.410834 0.000000 0.000001 0.000000 0.000000 -0.000009 -0.000002
$definebone "ValveBiped.Bip01_R_Finger22" "ValveBiped.Bip01_R_Finger21" 1.152748 0.000001 0.000000 -0.688639 -8.970353 -0.108692 0.000000 -0.000001 0.000000 -0.000001 -0.000012 -0.000001
$definebone "ValveBiped.Bip01_R_Finger1" "ValveBiped.Bip01_R_Hand" 3.684114 -0.153570 -1.419747 -1.961176 -11.693500 -10.145480 0.000000 0.000000 0.000000 0.000001 -0.000003 -0.000000
$definebone "ValveBiped.Bip01_R_Finger11" "ValveBiped.Bip01_R_Finger1" 1.701021 -0.000002 0.000000 -3.669049 -38.756249 -2.940822 0.000000 -0.000001 -0.000000 0.000001 -0.000002 -0.000001
$definebone "ValveBiped.Bip01_R_Finger12" "ValveBiped.Bip01_R_Finger11" 0.994709 0.000002 0.000000 -2.209324 -1.896551 -0.073168 0.000000 -0.000000 -0.000000 0.000001 -0.000002 -0.000001
$definebone "ValveBiped.Bip01_R_Finger0" "ValveBiped.Bip01_R_Hand" 1.068096 -1.283653 -0.986552 19.767271 -7.037127 -96.832904 0.000000 0.000000 0.000000 -0.000000 0.000001 0.000001
$definebone "ValveBiped.Bip01_R_Finger01" "ValveBiped.Bip01_R_Finger0" 1.836304 0.000000 0.000000 10.778425 -10.615991 0.000001 0.000000 0.000001 -0.000002 0.000000 0.000001 0.000001
$definebone "ValveBiped.Bip01_R_Finger02" "ValveBiped.Bip01_R_Finger01" 1.223946 0.000000 0.000000 2.328844 11.249053 0.000002 0.000000 0.000000 0.000002 0.000000 -0.000000 0.000002

$definebone "ValveBiped.weapon_charger_slide" "ValveBiped.weapon_bone" 0.000000 1.945634 -1.740833 0.000000 0.000000 0.000000 0.000000 0.000000 -0.000004 0.000000 0.000000 0.000000
$definebone "ValveBiped.weapon_stock_hammer" "ValveBiped.weapon_bone" 0.000000 0.000000 5.000000 0.000000 0.000000 0.000000 0.000000 -0.000001 0.000000 0.000000 0.000000 0.000000
$definebone "ValveBiped.weapon_bolt" "ValveBiped.weapon_bone" 0.000000 0.000000 5.000000 0.000000 0.000000 0.000000 0.000000 -0.000001 0.000000 0.000000 0.000000 0.000000
$definebone "ValveBiped.weapon_safety" "ValveBiped.weapon_bone" 0.000000 0.000000 5.000000 0.000000 0.000000 0.000000 0.000000 -0.000001 0.000000 0.000000 0.000000 0.000000
$definebone "ValveBiped.weapon_trigger" "ValveBiped.weapon_bone" 0.000000 0.375470 1.570164 0.000000 0.000000 0.000000 0.000000 -0.000001 0.000000 0.000000 0.000000 0.000000
$definebone "ValveBiped.weapon_clip_realease" "ValveBiped.weapon_bone" 0.000000 0.000000 5.000000 0.000000 0.000000 0.000000 0.000000 -0.000001 0.000000 0.000000 0.000000 0.000000
$definebone "ValveBiped.weapon_clip" "ValveBiped.weapon_bone" -0.000001 -0.000003 3.857136 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
$definebone "ValveBiped.weapon_clip_bullets_l" "" 0.000000 0.726000 3.497000 0.000000 -0.000000 0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000 0.000000

$definebone "ValveBiped.Bip01_R_Forearm_driven" "ValveBiped.Bip01_R_Forearm" 3.201683 0.000000 0.000000 -6.000010 6.999995 -78.603505 0.000004 0.000000 -0.000000 0.000003 0.000002 0.000000
$definebone "ValveBiped.Bip01_R_Driven_ulna" "ValveBiped.Bip01_R_Forearm" 6.694328 -0.000000 -0.000004 -6.014681 7.006070 -79.112067 0.000000 0.000000 -0.000000 0.000001 0.000000 -0.000002
$definebone "ValveBiped.Bip01_R_thumbroot" "ValveBiped.Bip01_R_Hand" 0.109861 -0.821461 -0.906649 20.672263 -17.532109 -104.524524 0.000000 -0.000001 0.000000 -0.000000 0.000004 0.000001
$definebone "ValveBiped.Bip01_L_Forearm_driven" "ValveBiped.Bip01_L_Forearm" 3.358418 -0.030838 0.000027 6.000015 6.999996 78.518367 0.000000 0.000000 0.000000 0.000001 -0.000002 0.000001
$definebone "ValveBiped.Bip01_L_Driven_ulna" "ValveBiped.Bip01_L_Forearm" 6.868288 0.000000 0.000000 6.000015 6.999996 78.895830 0.000004 0.000000 0.000000 -0.000000 0.000000 0.000001
$definebone "ValveBiped.Bip01_L_thumbroot" "ValveBiped.Bip01_L_Hand" 0.084970 -0.692268 1.011117 26.000000 112.000000 -76.500000 0.000000 0.000002 0.000000 0.000003 0.000003 -0.000000

bonemerges.qci tells which bones receive attachments:

$bonemerge "ValveBiped.ValveBiped" 
$bonemerge "ValveBiped.Bip01" 
$bonemerge "ValveBiped.Camera" 
$bonemerge "ValveBiped.weapon_bone" 
$bonemerge "ValveBiped.attach_muzzle" 
$bonemerge "ValveBiped.attach_shell_eject" 
$bonemerge "ValveBiped.attach_camera" 
$bonemerge "ValveBiped.Bip01_Spine" 
$bonemerge "ValveBiped.Bip01_Spine1" 
$bonemerge "ValveBiped.Bip01_Spine2" 
$bonemerge "ValveBiped.Bip01_Spine4" 
$bonemerge "ValveBiped.Bip01_L_Clavicle" 
$bonemerge "ValveBiped.Bip01_L_UpperArm" 
$bonemerge "ValveBiped.Bip01_L_Forearm" 
$bonemerge "ValveBiped.Bip01_L_Hand" 
$bonemerge "ValveBiped.Bip01_L_Finger4" 
$bonemerge "ValveBiped.Bip01_L_Finger41" 
$bonemerge "ValveBiped.Bip01_L_Finger42" 
$bonemerge "ValveBiped.Bip01_L_Finger3" 
$bonemerge "ValveBiped.Bip01_L_Finger31" 
$bonemerge "ValveBiped.Bip01_L_Finger32" 
$bonemerge "ValveBiped.Bip01_L_Finger2" 
$bonemerge "ValveBiped.Bip01_L_Finger21" 
$bonemerge "ValveBiped.Bip01_L_Finger22" 
$bonemerge "ValveBiped.Bip01_L_Finger1" 
$bonemerge "ValveBiped.Bip01_L_Finger11" 
$bonemerge "ValveBiped.Bip01_L_Finger12" 
$bonemerge "ValveBiped.Bip01_L_Finger0" 
$bonemerge "ValveBiped.Bip01_L_Finger01" 
$bonemerge "ValveBiped.Bip01_L_Finger02" 
$bonemerge "ValveBiped.Bip01_R_Clavicle" 
$bonemerge "ValveBiped.Bip01_R_UpperArm" 
$bonemerge "ValveBiped.Bip01_R_Forearm" 
$bonemerge "ValveBiped.Bip01_R_Hand" 
$bonemerge "ValveBiped.Bip01_R_Finger4" 
$bonemerge "ValveBiped.Bip01_R_Finger41" 
$bonemerge "ValveBiped.Bip01_R_Finger42" 
$bonemerge "ValveBiped.Bip01_R_Finger3" 
$bonemerge "ValveBiped.Bip01_R_Finger31" 
$bonemerge "ValveBiped.Bip01_R_Finger32" 
$bonemerge "ValveBiped.Bip01_R_Finger2" 
$bonemerge "ValveBiped.Bip01_R_Finger21" 
$bonemerge "ValveBiped.Bip01_R_Finger22" 
$bonemerge "ValveBiped.Bip01_R_Finger1" 
$bonemerge "ValveBiped.Bip01_R_Finger11" 
$bonemerge "ValveBiped.Bip01_R_Finger12" 
$bonemerge "ValveBiped.Bip01_R_Finger0" 
$bonemerge "ValveBiped.Bip01_R_Finger01" 
$bonemerge "ValveBiped.Bip01_R_Finger02" 
$bonemerge "ValveBiped.Bip01_R_Forearm_driven" 
$bonemerge "ValveBiped.Bip01_R_Driven_ulna" 
$bonemerge "ValveBiped.Bip01_R_thumbroot" 
$bonemerge "ValveBiped.Bip01_L_Forearm_driven" 
$bonemerge "ValveBiped.Bip01_L_Driven_ulna" 
$bonemerge "ValveBiped.Bip01_L_thumbroot" 

Sequences explained: There is some use of animation blending in the L4D viewmodels, mostly for the run animation and the aim-up/down posing.

The sequences for L4D(2) weapons are extremely cluttered. Some weapons (L4D1) have unused sequences, and all weapons have a non-layer and a layer sequences. The layer sequence is usually the real sequence that actually happens in game, while the other sequence is just there. Layer sequences are usually delta animations, but you also don't have to make a layer sequence a delta anim (adds ontop of current pose, rather than replaces the current pose) if you don't want to.

EXTRA:

You can still compile weapons that don't use the L4D2 arms, and include arms as part of the weapon model, that will be the same no matter what character you play as, CSS-style. Just remember to avoid the 128 bone limit. It's obviously recommended to decompile and animation-rig-up the L4D2 arms skeleton (it's the same for all characters. Decompile Ellis/Coach/Rochelle/Nick, because Valve included unused Bill/Louis/Francis/Zoey arms models, and rigging those on accident will waste a ton of time. You know you got the right skeleton if the forearm twist bones are called "...Forearm_driven" and "...Driven_ulna", and NOT "hlx_..." or "hlp_..."). Don't export the arms mesh with the weapon, just the bones and weapon mesh!

Oh noes! You're not a Member!

Want access to cool stuff? As a member you can:

  • Post. Give the submitter your thoughts on this Tutorial.
  • Say Thanks. Show your appreciation by sending the submitter points.
  • Stamp Posts. Let other posters know what you think of their posts.
  • Rate. Give this Tutorial a rating out of 10.
  • Flag. Alert moderators and warn members of a problem with this Tutorial.
  • Vote. Vote the submitter for the Monthly Awards.
  • Subscribe. Get notified when this submitter submits again.

Interested? Register or Login

Comments

  • Krycek's Levels
    • P2: Drudge
      Points: 2,955
    • A5: Veteran
      Account Age: 5 years
    Posted 7 months ago

    Thanks for nice tutorial! But I got some problems with making M16 mod using your QC. Especially "look_poses" sequence. It is functioning normally until fire or reloading. Looks like gun slips from the hands. It happens near the end of the animation when reloading) and immediately when gun is firing. Why it happens? Using idle pose as delta. Software is 3DS Max 2012 with Wunderboy SMD exporter. QC is the same as in tutorial. Preview 1 Preview 2

    User Title
    By all means.
  • Super Duper Badass Vittuneer's Levels
    • P2: Drudge
      Points: 1,290
    • A4: Graduate
      Account Age: 3 years
    Posted 7 months ago

    Posted by arby26

    Posted by crowbait Nice tutorial arby. But with one point neglected. This presupposes that the decompiler works. The decompiler (doesn't matter what version you use) doesn't create animation files that function. The model smd files are functional... but not the animation files (the exception being character animations largely supplied by the game engine). They contain too many flaws to be of any use but as a list of to-do's. Unless one has access to the original (that is... not decompiled) animation smd files... well you get the point.

    Don't get the wrong impression. I applaud Cannonfodder's efforts. He has done something Valve should have done in the first place. But it must be understood that the decompiler is a best effort version that needs a proper update.

    I've always known this. It assumes you have new smd animations made by someone or you. I could have swore I mentioned to use $includemodel to re-use the default anims, but it seems I forgot because explaining the smd process is already overly complex. Yay source engine.

    can you fix or help fixing the sg552 animations, it has several issues such as broken walk animations after reloading etc. could you reanimate it or something? because i'm too noob to do it :l

    Level 9001 Vittuneer
  • dssdassw's Levels
    • P1: Beggar
      Points: 10
    • A2: Tenderfoot
      Account Age: 9 months
    Posted 9 months ago

    Improvements:

    • It may be my fault for being dumb actually, but in the last paragraph, where exactly do you FIND the L4d2 arms skeleton?
    Bananite
  • Steeldragon's Levels
    • P1: Beggar
      Points: 26
    • A2: Tenderfoot
      Account Age: 10 months
    Posted 10 months ago

    Hey Arby, for the animation smd's do we make it ourselves with the arm models and gun itself or do we use the v_weapon smd file to make animations and export?

    Bananite
  • arby26's Levels
    • P3: Peasant
      Points: 12,923
    • E1: Helper
      EF: 1
    • A4: Graduate
      Account Age: 3 years
    Posted 10 months ago

    Posted by crowbait Nice tutorial arby. But with one point neglected. This presupposes that the decompiler works. The decompiler (doesn't matter what version you use) doesn't create animation files that function. The model smd files are functional... but not the animation files (the exception being character animations largely supplied by the game engine). They contain too many flaws to be of any use but as a list of to-do's. Unless one has access to the original (that is... not decompiled) animation smd files... well you get the point.

    Don't get the wrong impression. I applaud Cannonfodder's efforts. He has done something Valve should have done in the first place. But it must be understood that the decompiler is a best effort version that needs a proper update.

    I've always known this. It assumes you have new smd animations made by someone or you. I could have swore I mentioned to use $includemodel to re-use the default anims, but it seems I forgot because explaining the smd process is already overly complex. Yay source engine.

  • crowbait's Levels
    • P1: Beggar
      Points: 241
    • A3: Apprentice
      Account Age: 2 years
    Posted 12 months ago

    Nice tutorial arby. But with one point neglected. This presupposes that the decompiler works. The decompiler (doesn't matter what version you use) doesn't create animation files that function. The model smd files are functional... but not the animation files (the exception being character animations largely supplied by the game engine). They contain too many flaws to be of any use but as a list of to-do's. Unless one has access to the original (that is... not decompiled) animation smd files... well you get the point.

    Don't get the wrong impression. I applaud Cannonfodder's efforts. He has done something Valve should have done in the first place. But it must be understood that the decompiler is a best effort version that needs a proper update.

    Bananite
  • Loyen's Levels
    • P2: Drudge
      Points: 1,715
    • E1: Helper
      EF: 3
    • A6: Elder
      Account Age: 8 years
    Posted 1 year ago

    Posted by KylerAdams Oh FFS. I'm using the same version of Hooch's decompiler as you have in the image and for some reason all the models I try to decompile cause the decompiler to lock up and crash.

    I'm trying to decompile your http://gamebanana.com/l4d2/skins/121597 and replace the model with the 1911 from L4D. Unfortunately, MdlDecom simply locks up and crashes when I try to decompile either your Silverballer or, weirdly enough, the 1911 extracted straight from L4D2's l4d2_dlc3\pak01_dir.vpk.

    I'm not even getting to the compile or QC editing steps, which I -should- be capable of doing on my own considering all the models I've done (and never released) for CSS.

    Try using studiomdl, it works for me when hooch doesn't.

    Question however: anything special to think about when compiling dual pistols? Doesn't seem to animate the second pistol for me (it just floats in the air), sure I am doing something wrong (though I rig it up correctly).

    [law-yen, loi-en]
  • KylerAdams's Levels
    • P1: Beggar
      Points: 665
    • A6: Elder
      Account Age: 6 years
    Posted 1 year ago

    Oh FFS. I'm using the same version of Hooch's decompiler as you have in the image and for some reason all the models I try to decompile cause the decompiler to lock up and crash.

    I'm trying to decompile your http://gamebanana.com/l4d2/skins/121597 and replace the model with the 1911 from L4D. Unfortunately, MdlDecom simply locks up and crashes when I try to decompile either your Silverballer or, weirdly enough, the 1911 extracted straight from L4D2's l4d2_dlc3\pak01_dir.vpk.

    I'm not even getting to the compile or QC editing steps, which I -should- be capable of doing on my own considering all the models I've done (and never released) for CSS.

    Bananite
  • dgrayman12345's Levels
    • P1: Beggar
      Points: 14
    • A4: Graduate
      Account Age: 3 years
    Posted 2 years ago

    Do i decompile the weapon that i want to make which is the p90 from css or the smg in l4d2??

    Bananite
  • arby26's Levels
    • P3: Peasant
      Points: 12,923
    • E1: Helper
      EF: 1
    • A4: Graduate
      Account Age: 3 years
    Posted 2 years ago

    Just copy my m16 qc (and the two qci's) and replace my smd names with your smd names for now.

    Most of the tutorial is how to find the important qc things for L4D2 models by viewing them, since the qc's don't decompile correctly automatically.

Credits

Submitter
arby26's Levels
  • P3: Peasant
    Points: 12,923
  • E1: Helper
    EF: 1
  • A4: Graduate
    Account Age: 3 years
arby26 (Creator/Co-creator)
Key Authors
arby26's Levels
  • P3: Peasant
    Points: 12,923
  • E1: Helper
    EF: 1
  • A4: Graduate
    Account Age: 3 years
arby26
Tutorial
Contributors
pappaskurts
Tested and found working $sequence params for helping-hand and item-grab sequences (for no flickering while transitioning)
A1
Showed me procedural shell ejection qc (CSS-style, instead of always animating a shell in the fire anim)

Rating

Expert
10.0/10
Based off 7 rating(s)

Additional Info

Genre
Compiling
Difficulty Level
Advanced

Stats

Post Count
11
ViewCount
9,462
Date Added
2 years ago
Date Modified
9 months ago

Share

Embed Code
Code to use:

More embeddable images

Bookmark and Share