Locking Npc Animations: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (cleaning up)
(cleanup)
Line 1: Line 1:
{{inuse}}
This is a quick guide to locking NPC animations for a custom model. As an example in this tutorial, we will use the Zombie Classic model. Only the decompiling process, locking the animations and recompiling will be covered.


{{cleanup}}
{{note|When in game, animations created using this tutorial might move awkwardly. This tutorial is not supposed to make them move perfectly, but rather demonstrate the process. To make it look ''right'', it will take some custom tweaking while [[Locking Npc Animations#Moving the root bone|moving the root bone]].}}
{{tutpov}}


== Quick guide to locking NPC animations for a custom model. by: Frederick Ellis ==
==Required tools==


* [[Goldsource]] / [[Source]] engine
* [[Cannonfodders Studio Compiler]]
{{warning|do not use Cannonfodders stand-alone .[[mdl]] decompiler, it has a bug in it affecting decompilation of this file.}}
* [[3DSMax]] / Cannonfodders 3DSMax .[[smd]] import/export plug-ins
* [[GCFScape]]
* [http://www.adobe.com/products/photoshop/main.html Adobe Photoshop] and [[VTF]] Import plugin


This is my first tutorial, so bear with me. After hours of of fooling around with .qc files and searching for a solution
==Creating a decompile directory to store your .smd, .mdl and [[texture]] files==


to this problem, I finally figured out how to fix it. It's simplier than you think. We will use the Zombie Classic model
# On your desktop or where-ever, create a directory called <code>decompile</code>.
# In your mod directory, open your <code>models</code> directory (if there isn't one, create it) and create a directory named <code>Zombie</code>.
# Back in your mod directory, open the directory <code>materials</code> and create a directory named <code>models</code>. Under that directory create another directory named <code>zombie_classic</code>. It should now look like <code>materials/models/zombie_classic</code>.


for this tutorial. We will only cover the decompiling process and locking the animations, then recompiling.
{{note|These directory names are case-sensitive. Please use the ones described here or you are likely to have problems further into the tutorial.}}


''''Tools required:''''
==Extracting the zombie model and its textures.==


-hl/ hl source
# Open [[GCFScape]]
# Extract the zombie classic model found with GCFscape in <code>Program Files\Steam\SteamApps\source models</code> in the <code>decompile</code> directory.
# Next, extract the zombie textures found with GCFScape in <code>Program Files\Steam\SteamApps\source materials</code> in the <code>decompile</code> directory.


-Cannonfodders studio compiler (do not use Cannonfodders stand-alone mdl decompile, it has a bug in it when decompiling this file.
{{note|GCFScape will sometimes not open with [[Steam]] running in the background. If this happens, just close Steam.}}


-3d studioMax/ Cannon fodders 3dstudioMax .smd export/import plug-ins
{{note|For the Zombie texture location, look in GCFScape under <code>hl2/materials/Models/Zombie_Classic</code>.}}


-GCFScape
==Opening the .VTF files with Photoshop and converting them to .[[targa]]==


-Adobe Photoshop and VTF Import plugin
You need to change the zombie textures you just extracted into targas for viewing later on.


Lets begin:
# Launch Photoshop
# Navigate to <code>file</code> -> <code>open</code>
# Scroll to your <code>decompile</code> directory and select <code>Zombie_Classic_Sheet.vtf</code>.
# Navigate to <code>file</code> -> <code>save as</code> and save the document as a .targa file in the <code>decompile</code> directory.
# Repeat the process for the normal map texture.


'''1. Create a decompile folder to store your .smd's files, mdl. files and texture files.'''
{{note|Be sure NOT to load the .VMT file instead of the .VTF file.}}


-On the desktop, create a folder called 'decompile'
==Decompiling the model==


-In your mod directory, open your 'models' folder (if there isn't one, then create one) create a folder named 'Zombie' exactly like that.
[[Image:decompile.jpg|thumb|50px|right]]


-In your mod directory, open the folder 'materials', then create a folder named 'models'. Under that folder create another folder named zombie_classic. So it should look like materials/models/zombie_classic. p.s ignore the period
# Open Studio Compiler and select <code>Model Decompile</code>.
# Next, in the <code>choose model file</code> line, select the blue directory icon and open the <code>Classic.mdl</code> file that you extracted in your <code>decompile</code> directory.
# Under <code>choose output directory</code>, select the blue directory icon and browse to the <code>decompile</code> directory.
# Click the <code>extract</code> button to decompile your model.


Note: if you screw up your directories and don't label them verbatim i.e. not using caps when needed, then your going to run into a world of problems.
{{note|You may have to type in the location of the model under <code>choose model file</code>.}}


'''2. Extract the zombie model and its textures.'''
[[Image:smd.jpg|thumb|50px|right]]


-Open GCFScape
You will notice in the directory you created (make sure you set studio compiler's <code>mdl decompile</code> to extract the files in the directory you just made) a bunch of files with the extension .smd and a text file with the extension .[[qc]]. It will be explained later &mdash; for now, we just need the .smd files.


Note: GCFScape will sometimes not open with steam running in the background, if this happens, just close steam.
==Using 3DSMax==


-Extract the zombie classic model with GCFscape found in: C:\Program Files\Steam\SteamApps\source models and place it in the decompile folder
[[Image:import.jpg|thumb|300px|right]]


-Next extract the zombie textures with GCFScape found in: C:\Program Files\Steam\SteamApps\source materials and place them in the decompile folder as well.
{{note|Make sure you have installed Cannonfodders 3D Studio Max .smd import/export plug-ins into the 3DSMax plug-in directory.}}


Note: for the Zombie texture location, look in GCFScape under hl2/materials/Models/Zombie_Classic
# In 3DSMax, navigate to <code>File</code> -> <code>Import</code>.
# Select the .smd file type, navigate to the <code>decompile</code> directory and select the file <code>Zombie_reference.smd</code>. Click <code>Open</code>.
# A window will pop up asking what you want to import. Check <code>import triangles</code>, <code>import skeleton</code>, <code>prompt for missing textures</code>, <code>rebuild smoothing groups</code> and click <code>OK</code>.
# Another window will pop up asking for the textures you extracted earlier. Under file type, select .targa. Navigate to the <code>decompile</code> directory and select the .targa file you created earlier. Load the file.


'''3. Open the .VTF files with Photoshop and convert them to .targa'''
{{note|Be sure not to load the normal map image file! Your model should look like [[:Image:max_view.jpg|this]].}}


-We need to change the zombie textures you just extracted into targa's temporily for viewing later on. Launch Photoshop and goto 'file', 'open' scroll to your 'decompile' folder and select Zombie_Classic_Sheet.vtf. Then goto 'file' 'save as' and save the document as a .targa file an place it in the 'decompile' folder. Do the same for the normal map texture.
Now you have your zombie model in the viewport.


Note: be sure NOT to load the .VMT file, instead of the .VTF file.
==Loading animation files==


'''4. Decompile the model.'''
Now, for the part you all have been waiting for: how in the world do you lock the animations?


-Open StudioCompiler and select 'Model Decompile'
# Navigate to <code>File</code> -> <code>Import</code>, scroll to the <code>decompile</code> directory and select <code>a_walk1.smd</code>.
[[Image:decompile.jpg]]
# This time when the Cannonfodders window pops up, uncheck all the boxes except <code>import skeleton</code>. You'll notice the figure change pose.
# Scroll the time slider at the bottom to view the animation. You will notice that the model walks in one place, this is where the problem lies.  


{{note|If you happen to get a bone at the bottom of your model named <code>smd import</code>, delete it.}}


Next to the 'choose model file' line, select the blue folder icon and open the Classic.mdl file that you extracted from GCFScape located in your 'decompile' folder.
==Moving the root bone==


Note: you might have to type in the location of the model under 'choose model file'
[[Image:root.jpg|thumb|100px|right]]
[[Image:auto.jpg|thumb|100px|right]]
[[Image:root_move.jpg|thumb|100px|right]]


-Under 'choose output directory' select the blue folder icon and browse to the 'decompile' folder you created on the desktop.
# Press F3 on your keyboard to view the wire frame.
# Zoom into the middle of the model's pelvis area and select the bone labeled <code>ValveBiped.Bip01_Pelvis</code>.
# To ensure we have selected the correct bone, select the move tool and move the bone around the screen. The entire model should move with the bone. If it does not, try to select the bone again until the model moves with the selected bone.
# Next, select all the time keys at the bottom of the screen.
# Delete all of them except the first one.
# Move your camera to the side of the model.
# Press the <code>auto key</code> button at the bottom of the screen.
# Move the time slider to the last key.
# Using the move tool, move the model a few feet forward by the root bone.
# Turn off <code>auto key</code>.
# Scroll the time slider back and forth to view the animation. The model should move back and forth, instead of in one place.
# Navigate to <code>File</code> -> <code>Export</code>. For file type select .smd. Scroll to the <code>decompile</code> directory and overwrite the existing file named <code>a_walk1.smd</code>.
# Now import the remaining walk files labeled <code>a_walk1.smd</code>, <code>a_walk2.smd</code>, <code>a_walkNE.smd</code>, <code>a_walkSW.smd</code>, etc. and repeat the process to them. Make sure you overwrite all the walk animations with the new ones.
# After overwriting all the walk animations with new ones, close 3DSMax.


-Click the 'extract' button to decompile your model and extract it into the 'decompile' folder you created on the desktop
{{note|When working with animation files labeled with a SW, NW and so on at the end of them i.e. <code>a_walkSW.smd</code>, make sure you move the root bone into that direction. Example: move a walk animation labeled <code>A_walkNE.smd</code> into the north east direction, like so: [[:Image:nw_move1.jpg|before]], [[:Image:nw_move2.jpg|after]].}}
[[Image:smd.jpg]]


==Editing the .qc file==


You will notice in the folder you created (make sure you set studio compilers 'mdl decompile' to extract the files in the folder you just made) a bunch of files with the extension .smd and a text file with the extension .qc . I will get back to the .qc file later, for now, we just need the .smd files.
[[Image:qc1111.jpg|thumb|50px|right]]
[[Image:qc2111.jpg|thumb|50px|right]]


[[Image:import.jpg]]
# In Notepad or similar, navigate to the <code>decompile</code> directory and open the .qc file as shown in the picture.
# This step is the most important. We will now officially ''lock'' the animations. After every animation line, you have to add the text <code>LX LY</code>.
# Paste the following code in your .qc file and close it.


'''5. Launch 3D StudioMax.'''
{{clr}}


-In 3D StudioMax goto 'File' then 'import' select .smd for the file type. Goto the 'decompile' folder you created and select the file named 'Zombie_reference.smd', click 'Open'. Note: make sure you have installed Cannon Fodders 3D Studio Max .smd import/export plugins into the 3dsmax plugin directory.
$cd "C:\Documents and Settings\Owner\Desktop\decompile"
$modelname "Zombie/Classic.mdl"
$model "studio" "Zombie_reference.smd"
$poseparameter move_yaw -180.00 180.00 360.00
$cdmaterials "models\zombie_classic\"
$cdmaterials "models\headcrab_classic\"
$hboxset "default"
$hbox 2 "ValveBiped.Bip01_Spine1" -8.500 -3.840 -7.120 15.500 9.840 7.730
$hbox 4 "ValveBiped.Bip01_L_UpperArm" -1.000 -3.500 -2.500 11.000 3.500 2.500
$hbox 4 "ValveBiped.Bip01_L_Forearm" -0.500 -1.860 -1.900 10.500 3.110 2.360
$hbox 4 "ValveBiped.Bip01_L_Hand" 0.000 -1.780 -1.000 6.000 1.230 2.000
$hbox 5 "ValveBiped.Bip01_R_UpperArm" -1.000 -3.500 -2.500 11.000 3.500 2.500
$hbox 5 "ValveBiped.Bip01_R_Forearm" -0.500 -1.890 -1.600 10.500 3.090 2.660
$hbox 5 "ValveBiped.Bip01_R_Hand" 0.000 -1.780 -2.500 6.000 1.230 0.500
$hbox 6 "ValveBiped.Bip01_L_Thigh" 0.000 -4.000 -3.730 17.250 4.000 4.290
$hbox 6 "ValveBiped.Bip01_L_Calf" 0.000 -4.870 -3.540 17.250 3.180 2.630
$hbox 6 "ValveBiped.Bip01_L_Foot" -1.500 -2.000 -2.500 7.500 2.000 2.500
$hbox 7 "ValveBiped.Bip01_R_Thigh" 0.000 -4.000 -3.730 17.250 4.000 4.290
$hbox 7 "ValveBiped.Bip01_R_Calf" 0.000 -4.920 -3.120 17.250 3.250 2.650
$hbox 7 "ValveBiped.Bip01_R_Foot" -1.500 -2.000 -2.500 7.500 2.000 2.500
$hbox 1 "ValveBiped.HC_Body_Bone" -6.590 -5.000 -5.760 8.500 5.000 6.240
// Model uses material "Zombie_Classic_sheet.vmt"
// Model uses material "headcrabsheet.vmt"
$attachment "headcrab" "ValveBiped.HC_Body_Bone" -4.49 -1.32 -0.02 rotate -0.00 20.25 29.25
$attachment "eyes" "ValveBiped.HC_Body_Bone" 0.00 0.00 0.00 rotate -0.00 0.00 -50.00
$attachment "head" "ValveBiped.HC_Body_Bone" 0.00 0.00 0.00 rotate -0.00 0.00 -50.00
$attachment "chest" "ValveBiped.Bip01_Spine4" -3.00 6.00 0.00 rotate 0.00 60.00 90.00
$attachment "maw" "ValveBiped.Bip01_Spine2" -0.00 8.00 0.00 rotate 0.00 90.00 90.00
$attachment "Blood_Left" "ValveBiped.Bip01_L_Finger2" -0.00 -0.00 0.00 rotate -0.00 -0.00 0.00
$attachment "Blood_Right" "ValveBiped.Bip01_R_Finger2" -0.00 -0.00 0.00 rotate 0.00 -0.00 0.00
$surfaceprop "zombieflesh"
$eyeposition 0.000 0.000 64.000
$illumposition 6.562 -2.972 31.757
$sequence Idle01 "Idle01" loop ACT_IDLE 1 fps 30.00
$animation a_WalkS "a_WalkS" loop fps 24.000000 LX LY
$animation a_WalkSE "a_WalkSE" loop fps 24.000000 LX LY
$animation a_WalkE "a_WalkE" loop fps 24.000000 LX LY
$animation a_WalkNE "a_WalkNE" loop fps 24.000000 LX LY
$animation a_walk1 "a_walk1" loop fps 24.000000 LX LY
$animation a_WalkNW "a_WalkNW" loop fps 24.000000 LX LY
$animation a_WalkW "a_WalkW" loop fps 24.000000 LX LY
$animation a_WalkSW "a_WalkSW" loop fps 24.000000 LX LY
$sequence walk "a_WalkS" loop ACT_WALK 1 fps 24.00 {
{ event AE_ZOMBIE_STEP_LEFT 5 }
{ event AE_ZOMBIE_STEP_RIGHT 15 }
{ event AE_ZOMBIE_SCUFF_LEFT 20 }
{ event AE_ZOMBIE_STEP_LEFT 28 }
{ event AE_ZOMBIE_STEP_RIGHT 38 }
{ event AE_ZOMBIE_SCUFF_LEFT 40 }
blendwidth 9
blend move_yaw -180.000000 180.000000
a_WalkSE a_WalkE a_WalkNE a_walk1 a_WalkNW a_WalkW a_WalkSW a_WalkS
}
$animation a_walk2 "a_walk2" loop fps 24.000000
$sequence walk2 "a_WalkS" loop ACT_WALK 1 fps 24.00 {
{ event AE_ZOMBIE_STEP_LEFT 7 }
{ event AE_ZOMBIE_SCUFF_RIGHT 10 }
{ event AE_ZOMBIE_STEP_RIGHT 21 }
{ event AE_ZOMBIE_STEP_LEFT 31 }
{ event AE_ZOMBIE_SCUFF_RIGHT 34 }
{ event AE_ZOMBIE_STEP_RIGHT 44 }
blendwidth 9
blend move_yaw -180.000000 180.000000
a_WalkSE a_WalkE a_WalkNE a_walk2 a_WalkNW a_WalkW a_WalkSW a_WalkS
}
$animation a_walk3 "a_walk3" loop fps 24.000000 LX LY
$sequence walk3 "a_WalkS" loop ACT_WALK 1 fps 24.00 {
{ event AE_ZOMBIE_STEP_LEFT 7 }
{ event AE_ZOMBIE_STEP_RIGHT 18 }
{ event AE_ZOMBIE_SCUFF_LEFT 21 }
{ event AE_ZOMBIE_STEP_LEFT 32 }
{ event AE_ZOMBIE_STEP_RIGHT 40 }
{ event AE_ZOMBIE_SCUFF_LEFT 44 }
blendwidth 9
blend move_yaw -180.000000 180.000000
a_WalkSE a_WalkE a_WalkNE a_walk3 a_WalkNW a_WalkW a_WalkSW a_WalkS
}
$animation a_Walk4 "a_Walk4" loop fps 24.000000 LX LY
$sequence walk4 "a_Walk4" loop ACT_WALK 1 fps 24.00 {
{ event AE_ZOMBIE_STEP_LEFT 4 }
{ event AE_ZOMBIE_STEP_RIGHT 16 }
{ event AE_ZOMBIE_STEP_LEFT 22 }
{ event AE_ZOMBIE_STEP_RIGHT 28 }
{ event AE_ZOMBIE_STEP_LEFT 43 }
{ event AE_ZOMBIE_STEP_RIGHT 49 }
{ event AE_ZOMBIE_STEP_LEFT 58 }
{ event AE_ZOMBIE_STEP_RIGHT 67 }
}
$sequence FireWalk "FireWalk" loop ACT_WALK_ON_FIRE 1 fps 30.00
$sequence FireIdle "FireIdle" loop ACT_IDLE_ON_FIRE 1 fps 30.00
$sequence attackA "attackA" ACT_MELEE_ATTACK1 2 fps 30.00 {
{ event AE_ZOMBIE_ATTACK_SCREAM 5 }
{ event AE_ZOMBIE_ATTACK_RIGHT 25 }
}
$sequence attackB "attackB" ACT_MELEE_ATTACK1 2 fps 30.00 {
{ event AE_ZOMBIE_ATTACK_SCREAM 5 }
{ event AE_ZOMBIE_ATTACK_RIGHT 25 }
}
$sequence attackC "attackC" ACT_MELEE_ATTACK1 2 fps 30.00 {
{ event AE_ZOMBIE_ATTACK_SCREAM 5 }
{ event AE_ZOMBIE_ATTACK_LEFT 25 }
}
$sequence attackD "attackD" ACT_MELEE_ATTACK1 2 fps 30.00 {
{ event AE_ZOMBIE_ATTACK_SCREAM 5 }
{ event AE_ZOMBIE_ATTACK_LEFT 25 }
}
$sequence attackE "attackE" ACT_MELEE_ATTACK1 2 fps 30.00 {
{ event AE_ZOMBIE_ATTACK_SCREAM 5 }
{ event AE_ZOMBIE_ATTACK_BOTH 25 }
}
$sequence attackF "attackF" ACT_MELEE_ATTACK1 2 fps 30.00 {
{ event AE_ZOMBIE_ATTACK_SCREAM 5 }
{ event AE_ZOMBIE_ATTACK_BOTH 25 }
}
$sequence swatleftmid "swatleftmid" ACT_ZOM_SWATLEFTMID 1 fps 30.00 {
{ event AE_ZOMBIE_STARTSWAT 1 }
{ event AE_ZOMBIE_SWATITEM 9 }
}
$sequence swatrightmid "swatrightmid" ACT_ZOM_SWATRIGHTMID 1 fps 30.00 {
{ event AE_ZOMBIE_STARTSWAT 1 }
{ event AE_ZOMBIE_SWATITEM 9 }
}
$sequence swatleftlow "swatleftlow" ACT_ZOM_SWATLEFTLOW 1 fps 30.00 {
{ event AE_ZOMBIE_STARTSWAT 1 }
{ event AE_ZOMBIE_SWATITEM 15 }
}
$sequence swatrightlow "swatrightlow" ACT_ZOM_SWATRIGHTLOW 1 fps 30.00 {
{ event AE_ZOMBIE_STARTSWAT 1 }
{ event AE_ZOMBIE_SWATITEM 18 }
}
$sequence releasecrab "releasecrab" ACT_ZOM_RELEASECRAB 1 fps 30.00
$sequence physflinch1 "physflinch1" ACT_FLINCH_PHYSICS 1 fps 30.00
$sequence physflinch2 "physflinch2" ACT_FLINCH_PHYSICS 1 fps 30.00
$sequence physflinch3 "physflinch3" ACT_FLINCH_PHYSICS 1 fps 30.00
$sequence smashfall64 "smashfall64" fps 30.00 {
{ event AE_NPC_BODYDROP_HEAVY 10 }
{ event AE_NPC_BODYDROP_HEAVY 27 }
{ event AE_NPC_BODYDROP_HEAVY 37 }
{ event AE_ZOMBIE_GET_UP 75 }
}
$sequence slump_a "slump_a" loop fps 30.00
$sequence slumprise_a "slumprise_a" fps 30.00 {
{ event AE_NPC_LEFTFOOT 15 }
{ event AE_NPC_RIGHTFOOT 50 }
{ event AE_ZOMBIE_GET_UP 80 }
}
$sequence slumprise_a_attack "slumprise_a_attack" fps 30.00 {
{ event AE_NPC_LEFTFOOT 15 }
{ event AE_NPC_RIGHTFOOT 50 }
{ event AE_ZOMBIE_GET_UP 80 }
{ event AE_ZOMBIE_ATTACK_SCREAM 16 }
{ event AE_ZOMBIE_ATTACK_RIGHT 36 }
}
$sequence slumprise_a2 "slumprise_a2" fps 30.00 {
{ event AE_NPC_RIGHTFOOT 16 }
{ event AE_NPC_RIGHTFOOT 22 }
{ event AE_ZOMBIE_GET_UP 24 }
}
$sequence slump_b "slump_b" loop fps 30.00
$sequence slumprise_b "slumprise_b" fps 30.00 {
{ event AE_NPC_LEFTFOOT 13 }
{ event AE_NPC_RIGHTFOOT 27 }
{ event AE_ZOMBIE_GET_UP 57 }
}
$sequence Breakthrough "Breakthrough" fps 30.00
$sequence canal5await "canal5await" fps 30.00
$sequence canal5aattack "canal5aattack" fps 30.00
$animation mdldecompiler_delta.smd "mdldecompiler_delta.smd" fps 30
$sequence flinch1inDelta "flinch1inDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch1inFrame "flinch1inFrame" fps 30.00
$sequence flinch1CoreDelta "flinch1CoreDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch1OutFrame "flinch1OutFrame" fps 30.00
$sequence flinch1outDelta "flinch1outDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch1 "flinch1" ACT_GESTURE_FLINCH_HEAD 1 fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch2inDelta "flinch2inDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch2inFrame "flinch2inFrame" fps 30.00
$sequence flinch2CoreDelta "flinch2CoreDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch2OutFrame "flinch2OutFrame" fps 30.00
$sequence flinch2outDelta "flinch2outDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch2 "flinch2" ACT_GESTURE_FLINCH_HEAD 1 fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch3inDelta "flinch3inDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch3inFrame "flinch3inFrame" fps 30.00
$sequence flinch3CoreDelta "flinch3CoreDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch3OutFrame "flinch3OutFrame" fps 30.00
$sequence flinch3outDelta "flinch3outDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch3 "flinch3" ACT_GESTURE_FLINCH_HEAD 1 fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence Tantrum "Tantrum" loop ACT_ZOMBIE_TANTRUM 1 fps 30.00
$sequence WallPound "WallPound" loop ACT_ZOMBIE_WALLPOUND 1 fps 30.00 {
{ event AE_ZOMBIE_POUND 14 }
{ event AE_ZOMBIE_POUND 35 }
}
$sequence ragdoll "ragdoll" ACT_DIERAGDOLL 1 fps 30.00
$ikchain rhand ValveBiped.Bip01_R_Hand knee 0.640 0.769 0.000
$ikchain lhand ValveBiped.Bip01_L_Hand knee 0.607 0.795 0.000
$ikchain rfoot ValveBiped.Bip01_R_Foot knee 0.545 -0.838 0.000
$ikchain lfoot ValveBiped.Bip01_L_Foot knee 0.518 -0.855 -0.000
$collisionjoints "phymodel.smd" {
$mass 100.0
$inertia 10.00
$damping 0.10
$rotdamping 3.00
$rootbone "valvebiped.bip01_pelvis"
$jointmerge "ValveBiped.Bip01_Pelvis" "ValveBiped.Bip01_Spine1"
$jointconstrain "valvebiped.bip01_spine2" x limit -44.00 44.00 0.20
$jointconstrain "valvebiped.bip01_spine2" y limit -39.00 39.00 0.20
$jointconstrain "valvebiped.bip01_spine2" z limit -32.00 50.00 0.20
$jointconstrain "valvebiped.bip01_r_clavicle" x limit -30.00 30.00 0.20
$jointconstrain "valvebiped.bip01_r_clavicle" y limit -46.00 46.00 0.20
$jointconstrain "valvebiped.bip01_r_clavicle" z limit -26.00 48.00 0.20
$jointconstrain "valvebiped.bip01_r_upperarm" x limit -39.00 39.00 0.20
$jointconstrain "valvebiped.bip01_r_upperarm" y limit -79.00 95.00 0.20
$jointconstrain "valvebiped.bip01_r_upperarm" z limit -93.00 28.00 0.20
$jointconstrain "valvebiped.bip01_l_clavicle" x limit -30.00 30.00 0.20
$jointconstrain "valvebiped.bip01_l_clavicle" y limit -46.00 46.00 0.20
$jointconstrain "valvebiped.bip01_l_clavicle" z limit -26.00 48.00 0.20
$jointconstrain "valvebiped.bip01_l_upperarm" x limit -30.00 30.00 0.20
$jointconstrain "valvebiped.bip01_l_upperarm" y limit -95.00 84.00 0.20
$jointconstrain "valvebiped.bip01_l_upperarm" z limit -86.00 26.00 0.20
$jointconstrain "valvebiped.bip01_l_forearm" x limit 0.00 0.00 0.20
$jointconstrain "valvebiped.bip01_l_forearm" y limit 0.00 0.00 0.20
$jointconstrain "valvebiped.bip01_l_forearm" z limit -149.00 4.00 0.20
$jointconstrain "valvebiped.bip01_l_hand" x limit -55.00 55.00 0.20
$jointconstrain "valvebiped.bip01_l_hand" y limit -55.00 55.00 0.20
$jointconstrain "valvebiped.bip01_l_hand" z limit -55.00 55.00 0.20
$jointconstrain "valvebiped.bip01_r_forearm" x limit 0.00 0.00 0.20
$jointconstrain "valvebiped.bip01_r_forearm" y limit 0.00 0.00 0.20
$jointconstrain "valvebiped.bip01_r_forearm" z limit -149.00 4.00 0.20
$jointconstrain "valvebiped.bip01_r_thigh" x limit -12.00 12.00 0.20
$jointconstrain "valvebiped.bip01_r_thigh" y limit -8.00 75.00 0.20
$jointconstrain "valvebiped.bip01_r_thigh" z limit -97.00 32.00 0.20
$jointconstrain "valvebiped.bip01_r_calf" x limit 0.00 0.00 0.20
$jointconstrain "valvebiped.bip01_r_calf" y limit 0.00 0.00 0.20
$jointconstrain "valvebiped.bip01_r_calf" z limit -12.00 126.00 0.20
$jointconstrain "valvebiped.bip01_r_foot" x limit 0.00 0.00 0.00
$jointconstrain "valvebiped.bip01_r_foot" y limit -25.00 6.00 0.20
$jointconstrain "valvebiped.bip01_r_foot" z limit -15.00 35.00 0.20
$jointconstrain "valvebiped.bip01_l_thigh" x limit -12.00 12.00 0.20
$jointconstrain "valvebiped.bip01_l_thigh" y limit -73.00 6.00 0.20
$jointconstrain "valvebiped.bip01_l_thigh" z limit -93.00 30.00 0.20
$jointconstrain "valvebiped.bip01_l_calf" x limit 0.00 0.00 0.20
$jointconstrain "valvebiped.bip01_l_calf" y limit 0.00 0.00 0.20
$jointconstrain "valvebiped.bip01_l_calf" z limit -8.00 126.00 0.20
$jointconstrain "valvebiped.bip01_l_foot" x limit 0.00 0.00 0.00
$jointconstrain "valvebiped.bip01_l_foot" y limit -19.00 19.00 0.20
$jointconstrain "valvebiped.bip01_l_foot" z limit -15.00 35.00 0.20
$jointconstrain "valvebiped.bip01_r_hand" x limit -55.00 55.00 0.20
$jointconstrain "valvebiped.bip01_r_hand" y limit -55.00 55.00 0.20
$jointconstrain "valvebiped.bip01_r_hand" z limit -55.00 55.00 0.20
}


==Recompiling the model and textures==


[[Image:compile_texts.jpg|thumb|70px|right]]
[[Image:compile.jpg|thumb|70px|right]]


-A window will pop up asking what you want to import. Check all boxes 'import triangles', 'import skeleton', 'prompt for missing textures', 'rebuild smoothing groups' then click 'O.K.'
# Launch Studio Compiler
# Select <code>Material Compile</code>
# Check all the boxes as seen in the picture.
# Under <code>Materials</code> click <code>Add</code> and select the .targa images we made in Photoshop earlier.
# Under <code>TGA for normal map</code> select the normal map texture in <code>decompile</code>.
# Under <code>compiled material directory</code> type <code>zombie_classic</code>.
# Click the <code>Compile</code> button, once completed move to the next step.
# Select <code>Model Compile</code>, then select <code>Compile with existing qc</code>.
# Select the blue directory icon next to the qc file space.
# Navigate to your <code>decompile</code> directory and select the .qc file you just edited.
# Press the <code>compile</code> icon.
# Studio Compiler then begins to process your .smd files.
# Your models have now been recompiled to their appropiate directories.
# Once you are finished, close studio compiler.


-After pressing 'O.K'. another window will pop up asking for the textures that you extracted earlier. Under file type, select .targa. Scroll to the 'decompile' folder and select the .targa file that you saved earlier. Load the file. Note: be sure not to load the normal map image file! Your model should look like this.
==Testing your model==


[[Image:max_view.jpg]]
Congratulations! You've just completed your first NPC with locked animations. The easiest way to view your models is to make a shortcut to model viewer on your desktop and drag the files onto it.


Bingo, there's your zombie model in the viewport.
[[Image:viewer.jpg|thumb|200px|right]]


'''6. Load animation files.'''
# Navigate to your Source SDK binary directory at <code>Program Files\Steam\SteamApps\yourname\sourcesdk\bin</code>.
# Select the program named <code>''hlmv''</code> and right click on it.
# Select <code>Send to</code> and click <code>Desktop (create shortcut)</code>. A shortcut is now on your desktop.
# Navigate to your <code>models</code> directory in your mod's directory.
# Open the <code>Zombie</code> directory.
# Select the model <code>Classic</code> and drag it onto the <code>hlmv</code> shortcut. Model viewer opens.
# Under the <code>Render</code> tab, select the <code>Ground</code> checkbox.
# Select the <code>Sequence</code> tab and select the <code>walk</code> animation.
# The ground underneath the model should now move, which means that the model will change position in game.


Were half-way there.
{{clr}}


Now, for the part you all have been waiting for, how in the world do I lock this things animations!?!
For further assistance, feel free to contact original author [[User:Microbeast|Frederick Ellis]] at {{e|fe029@operamail.com}}.


-Goto 'file', 'import' and scroll to the 'decompile' file and select the .smd file named 'a_walk1.smd'
-This time when Cannon Fodders window pops up, uncheck all boxes except 'import skeleton' which you will leave checked. You'll notice the figure change pose. Scroll the time slider at the bottom to view the animation. You will notice that the model walks in one place, this is where the problem lies. Note: if you happen to get a bone at the bottom of your model named 'smd import' -delete it.
'''7. Move the 'Root' bone.'''
-Press F3 on your keyboard to view wireframe.
-Zoom into the middle of the models pelvis area and select the bone labeled 'ValveBiped.Bip01_Pelvis'
-To insure we have selected the correct bone, select the move tool and move the bone around the screen. The entire model should move with the bone, if not, you have selected the wrong bone.
[[Image:root.jpg]]
-Next we will select all the time keys at the bottom of the screen.
-Delete all of them except the first one.
-Move your camera to the side of the model
-Press the 'auto key' button at the bottom of the screen
[[Image:auto.jpg]]
-Move the time slider to the last key in the slider.
-Using the move tool, move the model by the 'Root' Bone foward a few feet on the screen.
[[Image:root_move.jpg]]
-Turn off 'auto key'.
-Scroll the time slider back and forth to view the animation. The model should move back and forth, instead of in one place.
-Goto 'file', 'export', for file type select .smd. Scroll to the 'decompile' folder and overwrite the existing file named "a_walk1" with the one you just saved.
-Now import the remaining walk files labled "a_walk1, a_walk2, a_walkNE, a_walkSW, ect." and do the same to these files. Make sure you overwrite all the walk animations with your new ones. Note: when working with animation files labled with a SW or NW ect. at the end of them i.e. "a_walkSW" , make sure to move the root bone into that direction. Example: move a walk animation labeld A_walkNE into a north east direction, as shown below.
Start:
[[Image:nw_move1.jpg]]
End:
[[Image:nw_move2.jpg]]
'''8. Editing the .qc file.'''
-After overwriting all the walk animations with new ones, close 3d StudioMax.
-Goto the decompile folder and open the .qc file with notepad as shown below.
[[Image:qc1111.jpg]]
-The next step is the most important. We will now officially "lock" the animations.
-After every animation line you are going to add the text LX LY, exactly like that, with the spaces.
[[Image:qc2111.jpg]]
-Your code should look like this:
$cd "C:\Documents and Settings\Owner\Desktop\decompile"
$modelname "Zombie/Classic.mdl"
$model "studio" "Zombie_reference.smd"
$poseparameter move_yaw -180.00 180.00 360.00
$cdmaterials "models\zombie_classic\"
$cdmaterials "models\headcrab_classic\"
$hboxset "default"
$hbox 2 "ValveBiped.Bip01_Spine1" -8.500 -3.840 -7.120 15.500 9.840 7.730
$hbox 4 "ValveBiped.Bip01_L_UpperArm" -1.000 -3.500 -2.500 11.000 3.500 2.500
$hbox 4 "ValveBiped.Bip01_L_Forearm" -0.500 -1.860 -1.900 10.500 3.110 2.360
$hbox 4 "ValveBiped.Bip01_L_Hand" 0.000 -1.780 -1.000 6.000 1.230 2.000
$hbox 5 "ValveBiped.Bip01_R_UpperArm" -1.000 -3.500 -2.500 11.000 3.500 2.500
$hbox 5 "ValveBiped.Bip01_R_Forearm" -0.500 -1.890 -1.600 10.500 3.090 2.660
$hbox 5 "ValveBiped.Bip01_R_Hand" 0.000 -1.780 -2.500 6.000 1.230 0.500
$hbox 6 "ValveBiped.Bip01_L_Thigh" 0.000 -4.000 -3.730 17.250 4.000 4.290
$hbox 6 "ValveBiped.Bip01_L_Calf" 0.000 -4.870 -3.540 17.250 3.180 2.630
$hbox 6 "ValveBiped.Bip01_L_Foot" -1.500 -2.000 -2.500 7.500 2.000 2.500
$hbox 7 "ValveBiped.Bip01_R_Thigh" 0.000 -4.000 -3.730 17.250 4.000 4.290
$hbox 7 "ValveBiped.Bip01_R_Calf" 0.000 -4.920 -3.120 17.250 3.250 2.650
$hbox 7 "ValveBiped.Bip01_R_Foot" -1.500 -2.000 -2.500 7.500 2.000 2.500
$hbox 1 "ValveBiped.HC_Body_Bone" -6.590 -5.000 -5.760 8.500 5.000 6.240
// Model uses material "Zombie_Classic_sheet.vmt"
// Model uses material "headcrabsheet.vmt"
$attachment "headcrab" "ValveBiped.HC_Body_Bone" -4.49 -1.32 -0.02 rotate -0.00 20.25 29.25
$attachment "eyes" "ValveBiped.HC_Body_Bone" 0.00 0.00 0.00 rotate -0.00 0.00 -50.00
$attachment "head" "ValveBiped.HC_Body_Bone" 0.00 0.00 0.00 rotate -0.00 0.00 -50.00
$attachment "chest" "ValveBiped.Bip01_Spine4" -3.00 6.00 0.00 rotate 0.00 60.00 90.00
$attachment "maw" "ValveBiped.Bip01_Spine2" -0.00 8.00 0.00 rotate 0.00 90.00 90.00
$attachment "Blood_Left" "ValveBiped.Bip01_L_Finger2" -0.00 -0.00 0.00 rotate -0.00 -0.00 0.00
$attachment "Blood_Right" "ValveBiped.Bip01_R_Finger2" -0.00 -0.00 0.00 rotate 0.00 -0.00 0.00
$surfaceprop "zombieflesh"
$eyeposition 0.000 0.000 64.000
$illumposition 6.562 -2.972 31.757
$sequence Idle01 "Idle01" loop ACT_IDLE 1 fps 30.00
$animation a_WalkS "a_WalkS" loop fps 24.000000 LX LY
$animation a_WalkSE "a_WalkSE" loop fps 24.000000 LX LY
$animation a_WalkE "a_WalkE" loop fps 24.000000 LX LY
$animation a_WalkNE "a_WalkNE" loop fps 24.000000 LX LY
$animation a_walk1 "a_walk1" loop fps 24.000000 LX LY
$animation a_WalkNW "a_WalkNW" loop fps 24.000000 LX LY
$animation a_WalkW "a_WalkW" loop fps 24.000000 LX LY
$animation a_WalkSW "a_WalkSW" loop fps 24.000000 LX LY
$sequence walk "a_WalkS" loop ACT_WALK 1 fps 24.00 {
{ event AE_ZOMBIE_STEP_LEFT 5 }
{ event AE_ZOMBIE_STEP_RIGHT 15 }
{ event AE_ZOMBIE_SCUFF_LEFT 20 }
{ event AE_ZOMBIE_STEP_LEFT 28 }
{ event AE_ZOMBIE_STEP_RIGHT 38 }
{ event AE_ZOMBIE_SCUFF_LEFT 40 }
blendwidth 9
blend move_yaw -180.000000 180.000000
a_WalkSE a_WalkE a_WalkNE a_walk1 a_WalkNW a_WalkW a_WalkSW a_WalkS
}
$animation a_walk2 "a_walk2" loop fps 24.000000
$sequence walk2 "a_WalkS" loop ACT_WALK 1 fps 24.00 {
{ event AE_ZOMBIE_STEP_LEFT 7 }
{ event AE_ZOMBIE_SCUFF_RIGHT 10 }
{ event AE_ZOMBIE_STEP_RIGHT 21 }
{ event AE_ZOMBIE_STEP_LEFT 31 }
{ event AE_ZOMBIE_SCUFF_RIGHT 34 }
{ event AE_ZOMBIE_STEP_RIGHT 44 }
blendwidth 9
blend move_yaw -180.000000 180.000000
a_WalkSE a_WalkE a_WalkNE a_walk2 a_WalkNW a_WalkW a_WalkSW a_WalkS
}
$animation a_walk3 "a_walk3" loop fps 24.000000 LX LY
$sequence walk3 "a_WalkS" loop ACT_WALK 1 fps 24.00 {
{ event AE_ZOMBIE_STEP_LEFT 7 }
{ event AE_ZOMBIE_STEP_RIGHT 18 }
{ event AE_ZOMBIE_SCUFF_LEFT 21 }
{ event AE_ZOMBIE_STEP_LEFT 32 }
{ event AE_ZOMBIE_STEP_RIGHT 40 }
{ event AE_ZOMBIE_SCUFF_LEFT 44 }
blendwidth 9
blend move_yaw -180.000000 180.000000
a_WalkSE a_WalkE a_WalkNE a_walk3 a_WalkNW a_WalkW a_WalkSW a_WalkS
}
$animation a_Walk4 "a_Walk4" loop fps 24.000000 LX LY
$sequence walk4 "a_Walk4" loop ACT_WALK 1 fps 24.00 {
{ event AE_ZOMBIE_STEP_LEFT 4 }
{ event AE_ZOMBIE_STEP_RIGHT 16 }
{ event AE_ZOMBIE_STEP_LEFT 22 }
{ event AE_ZOMBIE_STEP_RIGHT 28 }
{ event AE_ZOMBIE_STEP_LEFT 43 }
{ event AE_ZOMBIE_STEP_RIGHT 49 }
{ event AE_ZOMBIE_STEP_LEFT 58 }
{ event AE_ZOMBIE_STEP_RIGHT 67 }
}
$sequence FireWalk "FireWalk" loop ACT_WALK_ON_FIRE 1 fps 30.00
$sequence FireIdle "FireIdle" loop ACT_IDLE_ON_FIRE 1 fps 30.00
$sequence attackA "attackA" ACT_MELEE_ATTACK1 2 fps 30.00 {
{ event AE_ZOMBIE_ATTACK_SCREAM 5 }
{ event AE_ZOMBIE_ATTACK_RIGHT 25 }
}
$sequence attackB "attackB" ACT_MELEE_ATTACK1 2 fps 30.00 {
{ event AE_ZOMBIE_ATTACK_SCREAM 5 }
{ event AE_ZOMBIE_ATTACK_RIGHT 25 }
}
$sequence attackC "attackC" ACT_MELEE_ATTACK1 2 fps 30.00 {
{ event AE_ZOMBIE_ATTACK_SCREAM 5 }
{ event AE_ZOMBIE_ATTACK_LEFT 25 }
}
$sequence attackD "attackD" ACT_MELEE_ATTACK1 2 fps 30.00 {
{ event AE_ZOMBIE_ATTACK_SCREAM 5 }
{ event AE_ZOMBIE_ATTACK_LEFT 25 }
}
$sequence attackE "attackE" ACT_MELEE_ATTACK1 2 fps 30.00 {
{ event AE_ZOMBIE_ATTACK_SCREAM 5 }
{ event AE_ZOMBIE_ATTACK_BOTH 25 }
}
$sequence attackF "attackF" ACT_MELEE_ATTACK1 2 fps 30.00 {
{ event AE_ZOMBIE_ATTACK_SCREAM 5 }
{ event AE_ZOMBIE_ATTACK_BOTH 25 }
}
$sequence swatleftmid "swatleftmid" ACT_ZOM_SWATLEFTMID 1 fps 30.00 {
{ event AE_ZOMBIE_STARTSWAT 1 }
{ event AE_ZOMBIE_SWATITEM 9 }
}
$sequence swatrightmid "swatrightmid" ACT_ZOM_SWATRIGHTMID 1 fps 30.00 {
{ event AE_ZOMBIE_STARTSWAT 1 }
{ event AE_ZOMBIE_SWATITEM 9 }
}
$sequence swatleftlow "swatleftlow" ACT_ZOM_SWATLEFTLOW 1 fps 30.00 {
{ event AE_ZOMBIE_STARTSWAT 1 }
{ event AE_ZOMBIE_SWATITEM 15 }
}
$sequence swatrightlow "swatrightlow" ACT_ZOM_SWATRIGHTLOW 1 fps 30.00 {
{ event AE_ZOMBIE_STARTSWAT 1 }
{ event AE_ZOMBIE_SWATITEM 18 }
}
$sequence releasecrab "releasecrab" ACT_ZOM_RELEASECRAB 1 fps 30.00
$sequence physflinch1 "physflinch1" ACT_FLINCH_PHYSICS 1 fps 30.00
$sequence physflinch2 "physflinch2" ACT_FLINCH_PHYSICS 1 fps 30.00
$sequence physflinch3 "physflinch3" ACT_FLINCH_PHYSICS 1 fps 30.00
$sequence smashfall64 "smashfall64" fps 30.00 {
{ event AE_NPC_BODYDROP_HEAVY 10 }
{ event AE_NPC_BODYDROP_HEAVY 27 }
{ event AE_NPC_BODYDROP_HEAVY 37 }
{ event AE_ZOMBIE_GET_UP 75 }
}
$sequence slump_a "slump_a" loop fps 30.00
$sequence slumprise_a "slumprise_a" fps 30.00 {
{ event AE_NPC_LEFTFOOT 15 }
{ event AE_NPC_RIGHTFOOT 50 }
{ event AE_ZOMBIE_GET_UP 80 }
}
$sequence slumprise_a_attack "slumprise_a_attack" fps 30.00 {
{ event AE_NPC_LEFTFOOT 15 }
{ event AE_NPC_RIGHTFOOT 50 }
{ event AE_ZOMBIE_GET_UP 80 }
{ event AE_ZOMBIE_ATTACK_SCREAM 16 }
{ event AE_ZOMBIE_ATTACK_RIGHT 36 }
}
$sequence slumprise_a2 "slumprise_a2" fps 30.00 {
{ event AE_NPC_RIGHTFOOT 16 }
{ event AE_NPC_RIGHTFOOT 22 }
{ event AE_ZOMBIE_GET_UP 24 }
}
$sequence slump_b "slump_b" loop fps 30.00
$sequence slumprise_b "slumprise_b" fps 30.00 {
{ event AE_NPC_LEFTFOOT 13 }
{ event AE_NPC_RIGHTFOOT 27 }
{ event AE_ZOMBIE_GET_UP 57 }
}
$sequence Breakthrough "Breakthrough" fps 30.00
$sequence canal5await "canal5await" fps 30.00
$sequence canal5aattack "canal5aattack" fps 30.00
$animation mdldecompiler_delta.smd "mdldecompiler_delta.smd" fps 30
$sequence flinch1inDelta "flinch1inDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch1inFrame "flinch1inFrame" fps 30.00
$sequence flinch1CoreDelta "flinch1CoreDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch1OutFrame "flinch1OutFrame" fps 30.00
$sequence flinch1outDelta "flinch1outDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch1 "flinch1" ACT_GESTURE_FLINCH_HEAD 1 fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch2inDelta "flinch2inDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch2inFrame "flinch2inFrame" fps 30.00
$sequence flinch2CoreDelta "flinch2CoreDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch2OutFrame "flinch2OutFrame" fps 30.00
$sequence flinch2outDelta "flinch2outDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch2 "flinch2" ACT_GESTURE_FLINCH_HEAD 1 fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch3inDelta "flinch3inDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch3inFrame "flinch3inFrame" fps 30.00
$sequence flinch3CoreDelta "flinch3CoreDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch3OutFrame "flinch3OutFrame" fps 30.00
$sequence flinch3outDelta "flinch3outDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch3 "flinch3" ACT_GESTURE_FLINCH_HEAD 1 fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence Tantrum "Tantrum" loop ACT_ZOMBIE_TANTRUM 1 fps 30.00
$sequence WallPound "WallPound" loop ACT_ZOMBIE_WALLPOUND 1 fps 30.00 {
{ event AE_ZOMBIE_POUND 14 }
{ event AE_ZOMBIE_POUND 35 }
}
$sequence ragdoll "ragdoll" ACT_DIERAGDOLL 1 fps 30.00
$ikchain rhand ValveBiped.Bip01_R_Hand knee 0.640 0.769 0.000
$ikchain lhand ValveBiped.Bip01_L_Hand knee 0.607 0.795 0.000
$ikchain rfoot ValveBiped.Bip01_R_Foot knee 0.545 -0.838 0.000
$ikchain lfoot ValveBiped.Bip01_L_Foot knee 0.518 -0.855 -0.000
$collisionjoints "phymodel.smd" {
$mass 100.0
$inertia 10.00
$damping 0.10
$rotdamping 3.00
$rootbone "valvebiped.bip01_pelvis"
$jointmerge "ValveBiped.Bip01_Pelvis" "ValveBiped.Bip01_Spine1"
$jointconstrain "valvebiped.bip01_spine2" x limit -44.00 44.00 0.20
$jointconstrain "valvebiped.bip01_spine2" y limit -39.00 39.00 0.20
$jointconstrain "valvebiped.bip01_spine2" z limit -32.00 50.00 0.20
$jointconstrain "valvebiped.bip01_r_clavicle" x limit -30.00 30.00 0.20
$jointconstrain "valvebiped.bip01_r_clavicle" y limit -46.00 46.00 0.20
$jointconstrain "valvebiped.bip01_r_clavicle" z limit -26.00 48.00 0.20
$jointconstrain "valvebiped.bip01_r_upperarm" x limit -39.00 39.00 0.20
$jointconstrain "valvebiped.bip01_r_upperarm" y limit -79.00 95.00 0.20
$jointconstrain "valvebiped.bip01_r_upperarm" z limit -93.00 28.00 0.20
$jointconstrain "valvebiped.bip01_l_clavicle" x limit -30.00 30.00 0.20
$jointconstrain "valvebiped.bip01_l_clavicle" y limit -46.00 46.00 0.20
$jointconstrain "valvebiped.bip01_l_clavicle" z limit -26.00 48.00 0.20
$jointconstrain "valvebiped.bip01_l_upperarm" x limit -30.00 30.00 0.20
$jointconstrain "valvebiped.bip01_l_upperarm" y limit -95.00 84.00 0.20
$jointconstrain "valvebiped.bip01_l_upperarm" z limit -86.00 26.00 0.20
$jointconstrain "valvebiped.bip01_l_forearm" x limit 0.00 0.00 0.20
$jointconstrain "valvebiped.bip01_l_forearm" y limit 0.00 0.00 0.20
$jointconstrain "valvebiped.bip01_l_forearm" z limit -149.00 4.00 0.20
$jointconstrain "valvebiped.bip01_l_hand" x limit -55.00 55.00 0.20
$jointconstrain "valvebiped.bip01_l_hand" y limit -55.00 55.00 0.20
$jointconstrain "valvebiped.bip01_l_hand" z limit -55.00 55.00 0.20
$jointconstrain "valvebiped.bip01_r_forearm" x limit 0.00 0.00 0.20
$jointconstrain "valvebiped.bip01_r_forearm" y limit 0.00 0.00 0.20
$jointconstrain "valvebiped.bip01_r_forearm" z limit -149.00 4.00 0.20
$jointconstrain "valvebiped.bip01_r_thigh" x limit -12.00 12.00 0.20
$jointconstrain "valvebiped.bip01_r_thigh" y limit -8.00 75.00 0.20
$jointconstrain "valvebiped.bip01_r_thigh" z limit -97.00 32.00 0.20
$jointconstrain "valvebiped.bip01_r_calf" x limit 0.00 0.00 0.20
$jointconstrain "valvebiped.bip01_r_calf" y limit 0.00 0.00 0.20
$jointconstrain "valvebiped.bip01_r_calf" z limit -12.00 126.00 0.20
$jointconstrain "valvebiped.bip01_r_foot" x limit 0.00 0.00 0.00
$jointconstrain "valvebiped.bip01_r_foot" y limit -25.00 6.00 0.20
$jointconstrain "valvebiped.bip01_r_foot" z limit -15.00 35.00 0.20
$jointconstrain "valvebiped.bip01_l_thigh" x limit -12.00 12.00 0.20
$jointconstrain "valvebiped.bip01_l_thigh" y limit -73.00 6.00 0.20
$jointconstrain "valvebiped.bip01_l_thigh" z limit -93.00 30.00 0.20
$jointconstrain "valvebiped.bip01_l_calf" x limit 0.00 0.00 0.20
$jointconstrain "valvebiped.bip01_l_calf" y limit 0.00 0.00 0.20
$jointconstrain "valvebiped.bip01_l_calf" z limit -8.00 126.00 0.20
$jointconstrain "valvebiped.bip01_l_foot" x limit 0.00 0.00 0.00
$jointconstrain "valvebiped.bip01_l_foot" y limit -19.00 19.00 0.20
$jointconstrain "valvebiped.bip01_l_foot" z limit -15.00 35.00 0.20
$jointconstrain "valvebiped.bip01_r_hand" x limit -55.00 55.00 0.20
$jointconstrain "valvebiped.bip01_r_hand" y limit -55.00 55.00 0.20
$jointconstrain "valvebiped.bip01_r_hand" z limit -55.00 55.00 0.20
}
-To prevent any bugs, I suggest copying this code, and pasting it into your .qc file.
-Close the .qc file.
'''9. Recompiling the model and textures.'''
-Launch studio compiler
-Select 'Material Compile'
[[Image:compile_texts.jpg]]
-Check all the boxes as seen above.
-Under 'Materials' click 'add' and select the .targa images we made in photoshop earlier.
-Under 'TGA for normal map' select the normal map texture in 'decompile' as well.
-Under 'compiled material directory' type zombie_classic
-MAKE SURE YOUR SCREEN LOOKS LIKE THE ONE ABOVE!
-Click the 'Compile' button, once completed move to the next step.
Next:
-In Studio Compiler select Model Compile, then select compile with existing qc.
[[Image:compile.jpg]]
-Select the blue folder icon next to the qc file space.
-Scroll back to your 'decompile' folder and select the .qc file you just edited.
-Press the 'compile' icon.
-Studio Compiler then begins to process your .smd files.
-Your models have now been recompiled to there appropiate directories.
-Once completed, close studio compiler.
'''
10. Testing your model.'''
Congratulations! You've just completed your first NPC with locked animations. Now, for the moment of truth, cross your fingers and pucker your butt cheeks cause here we go!
The easiest way to view your models is to make a shortcut to model viewer on your desktop and drag the files onto it.
-Goto your sourcesdk bin folder: C:\Program Files\Steam\SteamApps\yourname\sourcesdk\bin
-Select the program named 'hlmv' and right click it.
-Select 'send to' the select 'desktop(create shortcut)' a shortcut is now on the desktop
-Goto your models directory in YOUR mod.
-Open the 'Zombie' folder
-Select the model 'Classic' and drag it onto the hlmv (half-life model viewer) shortcut you just created
-Model viewer opens. Under the render tab, select the 'Ground' Checkbox'
-Select the 'Sequence tab' and select the 'walk' animation.
[[Image:viewer.jpg]]
-The ground underneath the model should now move. Which means that the model will move postion in HL.
And there you have it, locking animations for custom NPC'S. I hope this tutorial will help someone out there, so they won't have to spend the hours I did figuring this thing out. Please note: when in game you animations might move awkwardly. This tutorial wasn't meant to make them move perfect, it was made just to make them move, period. It will take some custom tweaking when moving the root bone to make it look right.
Any questions feel free to contact me at '''fe029@operamail.com.
'''
Tutorial by: Frederick Ellis
Special thanks to Cannon Fodder for creating these awesome programs that ''we all'' use for our mods.
Cheers!
--[[User:Microbeast|Microbeast]] 20:38, 20 Apr 2006 (PDT)
[[Category:Tutorials]]
[[Category:Tutorials]]
[[Category:Modeling]]

Revision as of 09:50, 21 April 2006

This is a quick guide to locking NPC animations for a custom model. As an example in this tutorial, we will use the Zombie Classic model. Only the decompiling process, locking the animations and recompiling will be covered.

Note.pngNote:When in game, animations created using this tutorial might move awkwardly. This tutorial is not supposed to make them move perfectly, but rather demonstrate the process. To make it look right, it will take some custom tweaking while moving the root bone.

Required tools

Warning.pngWarning:do not use Cannonfodders stand-alone .mdl decompiler, it has a bug in it affecting decompilation of this file.

Creating a decompile directory to store your .smd, .mdl and texture files

  1. On your desktop or where-ever, create a directory called decompile.
  2. In your mod directory, open your models directory (if there isn't one, create it) and create a directory named Zombie.
  3. Back in your mod directory, open the directory materials and create a directory named models. Under that directory create another directory named zombie_classic. It should now look like materials/models/zombie_classic.
Note.pngNote:These directory names are case-sensitive. Please use the ones described here or you are likely to have problems further into the tutorial.

Extracting the zombie model and its textures.

  1. Open GCFScape
  2. Extract the zombie classic model found with GCFscape in Program Files\Steam\SteamApps\source models in the decompile directory.
  3. Next, extract the zombie textures found with GCFScape in Program Files\Steam\SteamApps\source materials in the decompile directory.
Note.pngNote:GCFScape will sometimes not open with Steam running in the background. If this happens, just close Steam.
Note.pngNote:For the Zombie texture location, look in GCFScape under hl2/materials/Models/Zombie_Classic.

Opening the .VTF files with Photoshop and converting them to .targa

You need to change the zombie textures you just extracted into targas for viewing later on.

  1. Launch Photoshop
  2. Navigate to file -> open
  3. Scroll to your decompile directory and select Zombie_Classic_Sheet.vtf.
  4. Navigate to file -> save as and save the document as a .targa file in the decompile directory.
  5. Repeat the process for the normal map texture.
Note.pngNote:Be sure NOT to load the .VMT file instead of the .VTF file.

Decompiling the model

Decompile.jpg
  1. Open Studio Compiler and select Model Decompile.
  2. Next, in the choose model file line, select the blue directory icon and open the Classic.mdl file that you extracted in your decompile directory.
  3. Under choose output directory, select the blue directory icon and browse to the decompile directory.
  4. Click the extract button to decompile your model.
Note.pngNote:You may have to type in the location of the model under choose model file.
Smd.jpg

You will notice in the directory you created (make sure you set studio compiler's mdl decompile to extract the files in the directory you just made) a bunch of files with the extension .smd and a text file with the extension .qc. It will be explained later — for now, we just need the .smd files.

Using 3DSMax

Import.jpg
Note.pngNote:Make sure you have installed Cannonfodders 3D Studio Max .smd import/export plug-ins into the 3DSMax plug-in directory.
  1. In 3DSMax, navigate to File -> Import.
  2. Select the .smd file type, navigate to the decompile directory and select the file Zombie_reference.smd. Click Open.
  3. A window will pop up asking what you want to import. Check import triangles, import skeleton, prompt for missing textures, rebuild smoothing groups and click OK.
  4. Another window will pop up asking for the textures you extracted earlier. Under file type, select .targa. Navigate to the decompile directory and select the .targa file you created earlier. Load the file.
Note.pngNote:Be sure not to load the normal map image file! Your model should look like this.

Now you have your zombie model in the viewport.

Loading animation files

Now, for the part you all have been waiting for: how in the world do you lock the animations?

  1. Navigate to File -> Import, scroll to the decompile directory and select a_walk1.smd.
  2. This time when the Cannonfodders window pops up, uncheck all the boxes except import skeleton. You'll notice the figure change pose.
  3. Scroll the time slider at the bottom to view the animation. You will notice that the model walks in one place, this is where the problem lies.
Note.pngNote:If you happen to get a bone at the bottom of your model named smd import, delete it.

Moving the root bone

Root.jpg
Auto.jpg
Root move.jpg
  1. Press F3 on your keyboard to view the wire frame.
  2. Zoom into the middle of the model's pelvis area and select the bone labeled ValveBiped.Bip01_Pelvis.
  3. To ensure we have selected the correct bone, select the move tool and move the bone around the screen. The entire model should move with the bone. If it does not, try to select the bone again until the model moves with the selected bone.
  4. Next, select all the time keys at the bottom of the screen.
  5. Delete all of them except the first one.
  6. Move your camera to the side of the model.
  7. Press the auto key button at the bottom of the screen.
  8. Move the time slider to the last key.
  9. Using the move tool, move the model a few feet forward by the root bone.
  10. Turn off auto key.
  11. Scroll the time slider back and forth to view the animation. The model should move back and forth, instead of in one place.
  12. Navigate to File -> Export. For file type select .smd. Scroll to the decompile directory and overwrite the existing file named a_walk1.smd.
  13. Now import the remaining walk files labeled a_walk1.smd, a_walk2.smd, a_walkNE.smd, a_walkSW.smd, etc. and repeat the process to them. Make sure you overwrite all the walk animations with the new ones.
  14. After overwriting all the walk animations with new ones, close 3DSMax.
Note.pngNote:When working with animation files labeled with a SW, NW and so on at the end of them i.e. a_walkSW.smd, make sure you move the root bone into that direction. Example: move a walk animation labeled A_walkNE.smd into the north east direction, like so: before, after.

Editing the .qc file

Qc1111.jpg
Qc2111.jpg
  1. In Notepad or similar, navigate to the decompile directory and open the .qc file as shown in the picture.
  2. This step is the most important. We will now officially lock the animations. After every animation line, you have to add the text LX LY.
  3. Paste the following code in your .qc file and close it.
$cd "C:\Documents and Settings\Owner\Desktop\decompile"
$modelname "Zombie/Classic.mdl"
$model "studio" "Zombie_reference.smd"
$poseparameter move_yaw -180.00 180.00 360.00
$cdmaterials "models\zombie_classic\"
$cdmaterials "models\headcrab_classic\"
$hboxset "default"
$hbox 2 "ValveBiped.Bip01_Spine1" -8.500 -3.840 -7.120 15.500 9.840 7.730
$hbox 4 "ValveBiped.Bip01_L_UpperArm" -1.000 -3.500 -2.500 11.000 3.500 2.500
$hbox 4 "ValveBiped.Bip01_L_Forearm" -0.500 -1.860 -1.900 10.500 3.110 2.360
$hbox 4 "ValveBiped.Bip01_L_Hand" 0.000 -1.780 -1.000 6.000 1.230 2.000
$hbox 5 "ValveBiped.Bip01_R_UpperArm" -1.000 -3.500 -2.500 11.000 3.500 2.500
$hbox 5 "ValveBiped.Bip01_R_Forearm" -0.500 -1.890 -1.600 10.500 3.090 2.660
$hbox 5 "ValveBiped.Bip01_R_Hand" 0.000 -1.780 -2.500 6.000 1.230 0.500
$hbox 6 "ValveBiped.Bip01_L_Thigh" 0.000 -4.000 -3.730 17.250 4.000 4.290
$hbox 6 "ValveBiped.Bip01_L_Calf" 0.000 -4.870 -3.540 17.250 3.180 2.630
$hbox 6 "ValveBiped.Bip01_L_Foot" -1.500 -2.000 -2.500 7.500 2.000 2.500
$hbox 7 "ValveBiped.Bip01_R_Thigh" 0.000 -4.000 -3.730 17.250 4.000 4.290
$hbox 7 "ValveBiped.Bip01_R_Calf" 0.000 -4.920 -3.120 17.250 3.250 2.650
$hbox 7 "ValveBiped.Bip01_R_Foot" -1.500 -2.000 -2.500 7.500 2.000 2.500
$hbox 1 "ValveBiped.HC_Body_Bone" -6.590 -5.000 -5.760 8.500 5.000 6.240
// Model uses material "Zombie_Classic_sheet.vmt"
// Model uses material "headcrabsheet.vmt"
$attachment "headcrab" "ValveBiped.HC_Body_Bone" -4.49 -1.32 -0.02 rotate -0.00 20.25 29.25
$attachment "eyes" "ValveBiped.HC_Body_Bone" 0.00 0.00 0.00 rotate -0.00 0.00 -50.00
$attachment "head" "ValveBiped.HC_Body_Bone" 0.00 0.00 0.00 rotate -0.00 0.00 -50.00
$attachment "chest" "ValveBiped.Bip01_Spine4" -3.00 6.00 0.00 rotate 0.00 60.00 90.00
$attachment "maw" "ValveBiped.Bip01_Spine2" -0.00 8.00 0.00 rotate 0.00 90.00 90.00
$attachment "Blood_Left" "ValveBiped.Bip01_L_Finger2" -0.00 -0.00 0.00 rotate -0.00 -0.00 0.00
$attachment "Blood_Right" "ValveBiped.Bip01_R_Finger2" -0.00 -0.00 0.00 rotate 0.00 -0.00 0.00
$surfaceprop "zombieflesh"
$eyeposition 0.000 0.000 64.000
$illumposition 6.562 -2.972 31.757
$sequence Idle01 "Idle01" loop ACT_IDLE 1 fps 30.00 
$animation a_WalkS "a_WalkS" loop fps 24.000000 LX LY 
$animation a_WalkSE "a_WalkSE" loop fps 24.000000 LX LY 
$animation a_WalkE "a_WalkE" loop fps 24.000000 LX LY 
$animation a_WalkNE "a_WalkNE" loop fps 24.000000 LX LY 
$animation a_walk1 "a_walk1" loop fps 24.000000 LX LY 
$animation a_WalkNW "a_WalkNW" loop fps 24.000000 LX LY 
$animation a_WalkW "a_WalkW" loop fps 24.000000 LX LY 
$animation a_WalkSW "a_WalkSW" loop fps 24.000000 LX LY 
$sequence walk "a_WalkS" loop ACT_WALK 1 fps 24.00 {
{ event AE_ZOMBIE_STEP_LEFT 5 }
{ event AE_ZOMBIE_STEP_RIGHT 15 }
{ event AE_ZOMBIE_SCUFF_LEFT 20 }
{ event AE_ZOMBIE_STEP_LEFT 28 }
{ event AE_ZOMBIE_STEP_RIGHT 38 }
{ event AE_ZOMBIE_SCUFF_LEFT 40 }
blendwidth 9
blend move_yaw -180.000000 180.000000
a_WalkSE a_WalkE a_WalkNE a_walk1 a_WalkNW a_WalkW a_WalkSW a_WalkS
}
$animation a_walk2 "a_walk2" loop fps 24.000000 
$sequence walk2 "a_WalkS" loop ACT_WALK 1 fps 24.00 {
{ event AE_ZOMBIE_STEP_LEFT 7 }
{ event AE_ZOMBIE_SCUFF_RIGHT 10 }
{ event AE_ZOMBIE_STEP_RIGHT 21 }
{ event AE_ZOMBIE_STEP_LEFT 31 }
{ event AE_ZOMBIE_SCUFF_RIGHT 34 }
{ event AE_ZOMBIE_STEP_RIGHT 44 }
blendwidth 9
blend move_yaw -180.000000 180.000000
a_WalkSE a_WalkE a_WalkNE a_walk2 a_WalkNW a_WalkW a_WalkSW a_WalkS
}
$animation a_walk3 "a_walk3" loop fps 24.000000 LX LY 
$sequence walk3 "a_WalkS" loop ACT_WALK 1 fps 24.00 {
{ event AE_ZOMBIE_STEP_LEFT 7 }
{ event AE_ZOMBIE_STEP_RIGHT 18 }
{ event AE_ZOMBIE_SCUFF_LEFT 21 }
{ event AE_ZOMBIE_STEP_LEFT 32 }
{ event AE_ZOMBIE_STEP_RIGHT 40 }
{ event AE_ZOMBIE_SCUFF_LEFT 44 }
blendwidth 9
blend move_yaw -180.000000 180.000000
a_WalkSE a_WalkE a_WalkNE a_walk3 a_WalkNW a_WalkW a_WalkSW a_WalkS
}
$animation a_Walk4 "a_Walk4" loop fps 24.000000 LX LY 
$sequence walk4 "a_Walk4" loop ACT_WALK 1 fps 24.00 {
{ event AE_ZOMBIE_STEP_LEFT 4 }
{ event AE_ZOMBIE_STEP_RIGHT 16 }
{ event AE_ZOMBIE_STEP_LEFT 22 }
{ event AE_ZOMBIE_STEP_RIGHT 28 }
{ event AE_ZOMBIE_STEP_LEFT 43 }
{ event AE_ZOMBIE_STEP_RIGHT 49 }
{ event AE_ZOMBIE_STEP_LEFT 58 }
{ event AE_ZOMBIE_STEP_RIGHT 67 }
}

$sequence FireWalk "FireWalk" loop ACT_WALK_ON_FIRE 1 fps 30.00 
$sequence FireIdle "FireIdle" loop ACT_IDLE_ON_FIRE 1 fps 30.00 
$sequence attackA "attackA" ACT_MELEE_ATTACK1 2 fps 30.00 {
{ event AE_ZOMBIE_ATTACK_SCREAM 5 }
{ event AE_ZOMBIE_ATTACK_RIGHT 25 }
}

$sequence attackB "attackB" ACT_MELEE_ATTACK1 2 fps 30.00 {
{ event AE_ZOMBIE_ATTACK_SCREAM 5 }
{ event AE_ZOMBIE_ATTACK_RIGHT 25 }
}

$sequence attackC "attackC" ACT_MELEE_ATTACK1 2 fps 30.00 {
{ event AE_ZOMBIE_ATTACK_SCREAM 5 }
{ event AE_ZOMBIE_ATTACK_LEFT 25 }
}

$sequence attackD "attackD" ACT_MELEE_ATTACK1 2 fps 30.00 {
{ event AE_ZOMBIE_ATTACK_SCREAM 5 }
{ event AE_ZOMBIE_ATTACK_LEFT 25 }
}

$sequence attackE "attackE" ACT_MELEE_ATTACK1 2 fps 30.00 {
{ event AE_ZOMBIE_ATTACK_SCREAM 5 }
{ event AE_ZOMBIE_ATTACK_BOTH 25 }
}

$sequence attackF "attackF" ACT_MELEE_ATTACK1 2 fps 30.00 {
{ event AE_ZOMBIE_ATTACK_SCREAM 5 }
{ event AE_ZOMBIE_ATTACK_BOTH 25 }
}

$sequence swatleftmid "swatleftmid" ACT_ZOM_SWATLEFTMID 1 fps 30.00 {
{ event AE_ZOMBIE_STARTSWAT 1 }
{ event AE_ZOMBIE_SWATITEM 9 }
}

$sequence swatrightmid "swatrightmid" ACT_ZOM_SWATRIGHTMID 1 fps 30.00 {
{ event AE_ZOMBIE_STARTSWAT 1 }
{ event AE_ZOMBIE_SWATITEM 9 }
}

$sequence swatleftlow "swatleftlow" ACT_ZOM_SWATLEFTLOW 1 fps 30.00 {
{ event AE_ZOMBIE_STARTSWAT 1 }
{ event AE_ZOMBIE_SWATITEM 15 }
}

$sequence swatrightlow "swatrightlow" ACT_ZOM_SWATRIGHTLOW 1 fps 30.00 {
{ event AE_ZOMBIE_STARTSWAT 1 }
{ event AE_ZOMBIE_SWATITEM 18 }
}

$sequence releasecrab "releasecrab" ACT_ZOM_RELEASECRAB 1 fps 30.00
$sequence physflinch1 "physflinch1" ACT_FLINCH_PHYSICS 1 fps 30.00
$sequence physflinch2 "physflinch2" ACT_FLINCH_PHYSICS 1 fps 30.00
$sequence physflinch3 "physflinch3" ACT_FLINCH_PHYSICS 1 fps 30.00
$sequence smashfall64 "smashfall64" fps 30.00 {
{ event AE_NPC_BODYDROP_HEAVY 10 }
{ event AE_NPC_BODYDROP_HEAVY 27 }
{ event AE_NPC_BODYDROP_HEAVY 37 }
{ event AE_ZOMBIE_GET_UP 75 }
}

$sequence slump_a "slump_a" loop fps 30.00
$sequence slumprise_a "slumprise_a" fps 30.00 {
{ event AE_NPC_LEFTFOOT 15 }
{ event AE_NPC_RIGHTFOOT 50 }
{ event AE_ZOMBIE_GET_UP 80 }
}

$sequence slumprise_a_attack "slumprise_a_attack" fps 30.00 {
{ event AE_NPC_LEFTFOOT 15 }
{ event AE_NPC_RIGHTFOOT 50 }
{ event AE_ZOMBIE_GET_UP 80 }
{ event AE_ZOMBIE_ATTACK_SCREAM 16 }
{ event AE_ZOMBIE_ATTACK_RIGHT 36 }
}

$sequence slumprise_a2 "slumprise_a2" fps 30.00 {
{ event AE_NPC_RIGHTFOOT 16 }
{ event AE_NPC_RIGHTFOOT 22 }
{ event AE_ZOMBIE_GET_UP 24 }
}

$sequence slump_b "slump_b" loop fps 30.00
$sequence slumprise_b "slumprise_b" fps 30.00 {
{ event AE_NPC_LEFTFOOT 13 }
{ event AE_NPC_RIGHTFOOT 27 }
{ event AE_ZOMBIE_GET_UP 57 }
}

$sequence Breakthrough "Breakthrough" fps 30.00
$sequence canal5await "canal5await" fps 30.00
$sequence canal5aattack "canal5aattack" fps 30.00
$animation mdldecompiler_delta.smd "mdldecompiler_delta.smd" fps 30
$sequence flinch1inDelta "flinch1inDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch1inFrame "flinch1inFrame" fps 30.00
$sequence flinch1CoreDelta "flinch1CoreDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch1OutFrame "flinch1OutFrame" fps 30.00
$sequence flinch1outDelta "flinch1outDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch1 "flinch1" ACT_GESTURE_FLINCH_HEAD 1 fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch2inDelta "flinch2inDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch2inFrame "flinch2inFrame" fps 30.00
$sequence flinch2CoreDelta "flinch2CoreDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch2OutFrame "flinch2OutFrame" fps 30.00
$sequence flinch2outDelta "flinch2outDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch2 "flinch2" ACT_GESTURE_FLINCH_HEAD 1 fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch3inDelta "flinch3inDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch3inFrame "flinch3inFrame" fps 30.00
$sequence flinch3CoreDelta "flinch3CoreDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch3OutFrame "flinch3OutFrame" fps 30.00
$sequence flinch3outDelta "flinch3outDelta" fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence flinch3 "flinch3" ACT_GESTURE_FLINCH_HEAD 1 fps 30.00 subtract mdldecompiler_delta.smd 0
$sequence Tantrum "Tantrum" loop ACT_ZOMBIE_TANTRUM 1 fps 30.00
$sequence WallPound "WallPound" loop ACT_ZOMBIE_WALLPOUND 1 fps 30.00 {
{ event AE_ZOMBIE_POUND 14 }
{ event AE_ZOMBIE_POUND 35 }
}

$sequence ragdoll "ragdoll" ACT_DIERAGDOLL 1 fps 30.00
$ikchain rhand ValveBiped.Bip01_R_Hand knee 0.640 0.769 0.000
$ikchain lhand ValveBiped.Bip01_L_Hand knee 0.607 0.795 0.000
$ikchain rfoot ValveBiped.Bip01_R_Foot knee 0.545 -0.838 0.000
$ikchain lfoot ValveBiped.Bip01_L_Foot knee 0.518 -0.855 -0.000
$collisionjoints "phymodel.smd" {

$mass 100.0
$inertia 10.00
$damping 0.10
$rotdamping 3.00
$rootbone "valvebiped.bip01_pelvis"
$jointmerge "ValveBiped.Bip01_Pelvis" "ValveBiped.Bip01_Spine1"

$jointconstrain "valvebiped.bip01_spine2" x limit -44.00 44.00 0.20
$jointconstrain "valvebiped.bip01_spine2" y limit -39.00 39.00 0.20
$jointconstrain "valvebiped.bip01_spine2" z limit -32.00 50.00 0.20

$jointconstrain "valvebiped.bip01_r_clavicle" x limit -30.00 30.00 0.20
$jointconstrain "valvebiped.bip01_r_clavicle" y limit -46.00 46.00 0.20
$jointconstrain "valvebiped.bip01_r_clavicle" z limit -26.00 48.00 0.20

$jointconstrain "valvebiped.bip01_r_upperarm" x limit -39.00 39.00 0.20
$jointconstrain "valvebiped.bip01_r_upperarm" y limit -79.00 95.00 0.20
$jointconstrain "valvebiped.bip01_r_upperarm" z limit -93.00 28.00 0.20

$jointconstrain "valvebiped.bip01_l_clavicle" x limit -30.00 30.00 0.20
$jointconstrain "valvebiped.bip01_l_clavicle" y limit -46.00 46.00 0.20
$jointconstrain "valvebiped.bip01_l_clavicle" z limit -26.00 48.00 0.20

$jointconstrain "valvebiped.bip01_l_upperarm" x limit -30.00 30.00 0.20
$jointconstrain "valvebiped.bip01_l_upperarm" y limit -95.00 84.00 0.20
$jointconstrain "valvebiped.bip01_l_upperarm" z limit -86.00 26.00 0.20

$jointconstrain "valvebiped.bip01_l_forearm" x limit 0.00 0.00 0.20
$jointconstrain "valvebiped.bip01_l_forearm" y limit 0.00 0.00 0.20
$jointconstrain "valvebiped.bip01_l_forearm" z limit -149.00 4.00 0.20

$jointconstrain "valvebiped.bip01_l_hand" x limit -55.00 55.00 0.20
$jointconstrain "valvebiped.bip01_l_hand" y limit -55.00 55.00 0.20
$jointconstrain "valvebiped.bip01_l_hand" z limit -55.00 55.00 0.20

$jointconstrain "valvebiped.bip01_r_forearm" x limit 0.00 0.00 0.20
$jointconstrain "valvebiped.bip01_r_forearm" y limit 0.00 0.00 0.20
$jointconstrain "valvebiped.bip01_r_forearm" z limit -149.00 4.00 0.20

$jointconstrain "valvebiped.bip01_r_thigh" x limit -12.00 12.00 0.20
$jointconstrain "valvebiped.bip01_r_thigh" y limit -8.00 75.00 0.20
$jointconstrain "valvebiped.bip01_r_thigh" z limit -97.00 32.00 0.20

$jointconstrain "valvebiped.bip01_r_calf" x limit 0.00 0.00 0.20
$jointconstrain "valvebiped.bip01_r_calf" y limit 0.00 0.00 0.20
$jointconstrain "valvebiped.bip01_r_calf" z limit -12.00 126.00 0.20

$jointconstrain "valvebiped.bip01_r_foot" x limit 0.00 0.00 0.00
$jointconstrain "valvebiped.bip01_r_foot" y limit -25.00 6.00 0.20
$jointconstrain "valvebiped.bip01_r_foot" z limit -15.00 35.00 0.20

$jointconstrain "valvebiped.bip01_l_thigh" x limit -12.00 12.00 0.20
$jointconstrain "valvebiped.bip01_l_thigh" y limit -73.00 6.00 0.20
$jointconstrain "valvebiped.bip01_l_thigh" z limit -93.00 30.00 0.20

$jointconstrain "valvebiped.bip01_l_calf" x limit 0.00 0.00 0.20
$jointconstrain "valvebiped.bip01_l_calf" y limit 0.00 0.00 0.20
$jointconstrain "valvebiped.bip01_l_calf" z limit -8.00 126.00 0.20

$jointconstrain "valvebiped.bip01_l_foot" x limit 0.00 0.00 0.00
$jointconstrain "valvebiped.bip01_l_foot" y limit -19.00 19.00 0.20
$jointconstrain "valvebiped.bip01_l_foot" z limit -15.00 35.00 0.20

$jointconstrain "valvebiped.bip01_r_hand" x limit -55.00 55.00 0.20
$jointconstrain "valvebiped.bip01_r_hand" y limit -55.00 55.00 0.20
$jointconstrain "valvebiped.bip01_r_hand" z limit -55.00 55.00 0.20
}

Recompiling the model and textures

Compile texts.jpg
Compile.jpg
  1. Launch Studio Compiler
  2. Select Material Compile
  3. Check all the boxes as seen in the picture.
  4. Under Materials click Add and select the .targa images we made in Photoshop earlier.
  5. Under TGA for normal map select the normal map texture in decompile.
  6. Under compiled material directory type zombie_classic.
  7. Click the Compile button, once completed move to the next step.
  8. Select Model Compile, then select Compile with existing qc.
  9. Select the blue directory icon next to the qc file space.
  10. Navigate to your decompile directory and select the .qc file you just edited.
  11. Press the compile icon.
  12. Studio Compiler then begins to process your .smd files.
  13. Your models have now been recompiled to their appropiate directories.
  14. Once you are finished, close studio compiler.

Testing your model

Congratulations! You've just completed your first NPC with locked animations. The easiest way to view your models is to make a shortcut to model viewer on your desktop and drag the files onto it.

Viewer.jpg
  1. Navigate to your Source SDK binary directory at Program Files\Steam\SteamApps\yourname\sourcesdk\bin.
  2. Select the program named hlmv and right click on it.
  3. Select Send to and click Desktop (create shortcut). A shortcut is now on your desktop.
  4. Navigate to your models directory in your mod's directory.
  5. Open the Zombie directory.
  6. Select the model Classic and drag it onto the hlmv shortcut. Model viewer opens.
  7. Under the Render tab, select the Ground checkbox.
  8. Select the Sequence tab and select the walk animation.
  9. The ground underneath the model should now move, which means that the model will change position in game.

For further assistance, feel free to contact original author Frederick Ellis at fe029@operamail.com.