Fixing CStrike models for HL2

From Valve Developer Community
Jump to: navigation, search

These tutorals will help people who are porting content from CStrike over to HL2. You will need:

- Blender with Source Tools

- Cowbar

- A CS:S Skin (you should get permision from the author before you add it to your mod!)

- GFCScape


Now first decompile the model into a folder like, say the model is w_pist_deagle.mdl then call the folder "decompiled_deagle" and then you should see something like:

w_pist_deagle_anims (folder) 
w_pist_deagle_logs (folder) 

and next you will need to open hl2_misc_dir.vpk (Its in a lot of source engine games like HL2, TF2, CSS, Portal, ect) it will be in the hl2 folder. and when in side of it open "models" then "weapons" and inside of that take W_pistol (take the one for the type of weapon, like a MP5 you would use w_SMG1 or for a rfile you would use "w_irifle", ect) and extract it into a folder.

Then decompile it as "decompiled_pistol" and inside of it you should see:

w_pistol_anims (folder) 
w_pistol_logs (folder) 

now that you have that you should now open your modeling tool (I'm using blender, so it might not be the same for everyone) and delete the camera, light and default cube. then use the import option under file to import the w_pistol.qc and then import w_pist_deagle_reference.smd and line it up to w_pistol_reference.smd and then delete:


now, export it into where you have decompiled the deagle as a .SMD and then open w_pist_deagle.qc and edit the $modelname to be, well, lets say "weapons\w_pist_meagle.mdl" or what ever you want the model to be named. now compile it in crowbar and test it in the HLMV. open a NPC model, say alyx.mdl and then load your weapon as a weapon model. if you like how it came out, your done! if you don't, try the alining step again.


decompile the playermodel and in the qc file it outputted, find the lines that say "$includemodel" and delete them all and then add these lines where the old "$includemodel" use to be:

$includemodel "player/(gender)_anims.mdl"
$includemodel "humans/(gender)_gestures.mdl"
$includemodel "humans/(gender)_postures.mdl"
$includemodel "humans/(gender)_ss.mdl"
$includemodel "humans/(gender)_shared.mdl" 

The gender is eather male or female.

but if you are doing it for GMod, then its:

$includemodel "(gender)_anim.mdl"

gender in that case is "m" (male), "f" (female) or "z" (zombie)

Next, add the fowling lines below the rest of the "$attachment"s:

$attachment "anim_attachment_RH" "ValveBiped.Bip01_R_Hand" 0 0 0 rotate 0 0 0                                  
$attachment "anim_attachment_LH" "ValveBiped.Bip01_L_Hand"  0 0 0 rotate 0 0 0            
$attachment "lefthand" "ValveBiped.Bip01_L_Hand" 0 0 0 rotate 0 0 0                                                   
$attachment "eyes" "ValveBiped.Bip01_Head1" 4.5 -5 0 rotate 0 -90 -90                     

Next edit the "modelname"_reference.smd and add these lines to under the rest of the "nodes" at the begining of the file:

NUMBER "ValveBiped.Anim_Attachment_LH" 18                                                
NUMBER "ValveBiped.Anim_Attachment_RH" 31                                                

Replace "NUMBER" with the next 2 numbers in the list, so say the last node is 24, then replace the first "NUMBER" with 25 and the 2nd "NUMBER" with 26. Now compile the mode, and every thing should be working. I hope this helped you!