Assuming you have already created your mod using the Source SDK...
Source models are made up of 3 kinds of files:
* Reference SMDs - contains the geometry of the model, skin names the skeleton heirarchy and rigging.
* Animation SMDs - containing the skeleton and describes one animation
* QC file - Script telling the compiler how to put it all together.
You need to get your model exported into SMD reference format and each of it's animations into SMD animation format. You might need a plugin or extension for your modelling app to get it to export SMDs.
Source SMDs are a bit different from half-life 1 SMDs so mak sure you get them in the right format.
QC files are just text documents with a .QC extension so whip open notepad (or your prefered text editor) and stick in the following:
//path and name of the final model relative to the sourcemods/yourmod/models folder
$modelname npc/xenomorph.mdl
// Directory of skin materials sourcemods/yourmod/materials folder
$cdmaterials models/npc/xenomorph/
//Sometimes it comes out larger or smaller than expected in-game, use this to adjust it's in-game size
$scale 1.0
//Sometimes it's not where you expect it to be in-game, use this to adjust it's origin (mainly used for view weapons)
$origin 0 0 0
//Check the valve wiki for other surface props
$surfaceprop flesh
//Where are it's eyes (relative to the origin)
$eyeposition 0.000 0.000 128.000
//name of your models refrence SMD
$body studio "reference"
//describe your animation sequences : name , smd file name , acitivity from the valve wiki, weight (if you have several animations for the same activity), the frames per second to play it back at
$sequence idle_lower "idle" activity ACT_HL2MP_IDLE 1 fps 30 loop
// Example run/walk combinging multiple animations into one sequence that can be contorolled by the NPCs angle in-game
$animation a_RunSW run_sW startloop 0 LX LY alignto Idle_lower rotateto 135 fps 30.00
$animation a_RunS run_s startloop 0 LX LY alignto Idle_lower rotateto -180 fps 30.00
$animation a_RunSE run_se startloop 0 LX LY alignto Idle_lower rotateto -135 fps 30.00
$animation a_RunE run_e startloop 0 LX LY alignto Idle_lower rotateto -90 fps 30.00
$animation a_RunNE run_ne startloop 0 LX LY alignto Idle_lower rotateto -45 fps 30.00
$animation a_RunN run_n startloop 0 LX LY alignto Idle_lower rotateto 0 fps 30.00
$animation a_RunNW run_nw startloop 0 LX LY alignto Idle_lower rotateto 45 fps 30.00
$animation a_RunW run_w startloop 0 LX LY alignto Idle_lower rotateto 90 fps 30.00
$animation a_RunZero "idle" loop
$sequence Run_lower "a_RunS" loop ACT_HL2MP_RUN 1 fps 30.00 {
blendwidth 9
blend move_yaw -180.000000 180.000000
a_RunS a_RunE a_RunNE a_RunN a_RunNW a_RunW a_RunS a_RunS
}
//Example technique for creating "gesture" sequences, used by weapons to modify an NPCs exising activity
$animation a_attack "primary_attack"
$animation b_attack "primary_attack" subtract a_attack 0
$sequence attack "b_attack" activity ACT_HL2MP_GESTURE_RANGE_ATTACK_SMG1 1 fps 30 delta
Read and inwardly digest the comments (QC uses "C" style comments). Their are more QC commands on the wiki, but those are the core.
Notice the mention of materials, Source uses 2 files for each material(model skin in this case)
* VTF - Binary file, I suggest you use VTFEdit to convert your skins to VTF format, it doesn't come with the SDK but IMHO it's an essential Source modding tool.
* VMT - A text file that describes what shaders and VTFs to use. The skin name in you model will cause Source to look for a VMT of that name in the folder specified by $cdmaterials
Heres a sample VMT for a model skin (NOTE VTF edit can generate VMTs for you but assumes they are for map textures and so specifies the wrong shader)
//Shader used for models
"VertexLitGeneric"
{
//Required, refers to the VTF file for the models colour map
"$basetexture" "models/npc/xenomorph/xenomorph_sheet"
//Required, tells Source this is going to be used on a model
"$model" 1
//Optional
"$surfaceprop" "flesh"
//Optional use the normal maps alpha channel for how shiny to make that pixel and how strong the mapping is
"$normalmapalphaenvmapmask" 1
//Optional, refers to the VTF file for the models normal map
"$bumpmap" "models/npc/xenomorph/xenomorph_normalmap"
//Optional, used for normal mapping
"$envmap" "env_cubemap"
//Optional, used to tint reflections in the normal map
"$envmaptint" "[1.0 1.0 1.0]"
//Optional, used to adjust contrast of reflections in the normal map
"$envmapcontrast" 1.0
}
OK now stick all your SMDs and QC script into a single folder, start up the Source SDK, select your mod from the drop down,
find the studiomdl.exe in the Source SDK/bin folder and drag 'n' drop the QC file on to it. It will throw up a load of tetx in a DOS window which will vanish when it it's done. It *should* then compile into a bunch of binary files in SourceMods/yourmod/models/npc/.
It probably wont, the odds of you getting this right first time are minuscule, just because it is so picky. So you'll want to open up a command prompt and run studiomdl.exe from there, giving it the full path to your QC file. It should then hint at whereabouts it's gone wrong.
You should now have a model you can look at in the Model Viewer and assign to your new npc.
OK? :wink: