• Making a .qc
    30 replies, posted
This is probably around the 500th thread about this topic, but I'm seriously insecure about making a .QC file for a ragdoll. I ripped a model from World of Warcraft with a skeleton, removed unnecessary bones and had it exported to .smd; how do I build a .QC to compile it to a .mdl?
Decompile a ragdoll from Half-Life 2/Episode 1 or 2 or Garrys Mod and use that qc, and rename the bones accordingly.
This is what I use, its from male7 decompiled: just comment out a line if you get an error and be sure to change the paths/names. Use // to comment out a line. [CODE]// Created by Crowbar 0.19.0.0 $modelname "player/naruto/hinata.mdl" $model "hinata" "hinata.smd" $cdmaterials "models\naruto\" // $attachment "eyes" "ValveBiped.Bip01_Head1" 3.2 -3.5 0.12 rotate 0 -80.1 -90 $attachment "mouth" "ValveBiped.Bip01_Head1" 0.6 -5.5 0 rotate 0 -80 -90 $attachment "chest" "ValveBiped.Bip01_Spine2" 5 4 0 rotate 0 90 90 $attachment "forward" "ValveBiped.forward" 0 0 0 rotate 0 0 0 $attachment "anim_attachment_RH" "ValveBiped.Anim_Attachment_RH" 0 0 0 rotate -90 -90 0 $attachment "anim_attachment_LH" "ValveBiped.Anim_Attachment_LH" 0 0 0 rotate -90 -90 0 $attachment "anim_attachment_head" "ValveBiped.Bip01_Head1" 0 0 0 rotate -90 -90 0 $surfaceprop "flesh" $contents "solid" $hboxset "default" $hbox 1 "ValveBiped.Bip01_Head1" -1.25 -6.5 -3.19 8.25 3.5 3.31 $hbox 4 "ValveBiped.Bip01_L_UpperArm" 0 -2.75 -2.75 12.51 1.75 2.25 $hbox 4 "ValveBiped.Bip01_L_Forearm" 0 -2.19 -2.38 13 1.81 1.62 $hbox 4 "ValveBiped.Bip01_L_Hand" 0.06 -2 -1.5 4.06 1 2.5 $hbox 5 "ValveBiped.Bip01_R_UpperArm" 0 -3 -2.25 12.39 2 2.75 $hbox 5 "ValveBiped.Bip01_R_Forearm" -0.5 -2.2 -1.55 12.5 1.8 2.45 $hbox 5 "ValveBiped.Bip01_R_Hand" 0.06 -2 -2.5 4.06 1 1.5 $hbox 6 "ValveBiped.Bip01_L_Thigh" 0 -3.75 -3.25 17.85 3.75 3.25 $hbox 6 "ValveBiped.Bip01_L_Calf" 0 -3.51 -3.28 15.64 3.49 2.72 $hbox 6 "ValveBiped.Bip01_L_Foot" -1.07 -2 -2.84 5.04 5 2.16 $hbox 6 "ValveBiped.Bip01_L_Toe0" -0.5 -3 -2.19 2.5 0 2.46 $hbox 7 "ValveBiped.Bip01_R_Thigh" 0 -3.75 -3.25 17.85 3.75 3.25 $hbox 7 "ValveBiped.Bip01_R_Calf" 0 -3.51 -2.82 15.64 3.49 3.18 $hbox 7 "ValveBiped.Bip01_R_Foot" -1.06 -2.01 -2.28 5.05 4.99 2.72 $hbox 7 "ValveBiped.Bip01_R_Toe0" -0.5 -3 -2.6 2.5 0 2.1 $hbox 3 "ValveBiped.Bip01_Pelvis" -7.5 -5.5 -6 7.5 8.5 5 $hbox 2 "ValveBiped.Bip01_Spine2" -2.5 -2.5 -7 14.5 7.5 7 $skipboneinbbox $sequence ragdoll "ragdoll" ACT_DIERAGDOLL 1 fps 30.00 $includemodel "m_anm.mdl" $ikchain "rhand" "ValveBiped.Bip01_R_Hand" knee 0.707 0.707 0 $ikchain "lhand" "ValveBiped.Bip01_L_Hand" knee 0.707 0.707 0 $ikchain "rfoot" "ValveBiped.Bip01_R_Foot" knee 0.707 -0.707 0 $ikchain "lfoot" "ValveBiped.Bip01_L_Foot" knee 0.707 -0.707 0 $ikautoplaylock "rfoot" 1 0.1 $ikautoplaylock "lfoot" 1 0.1 $collisionjoints "male_07_physics.smd" { $mass 0 $inertia 10 $damping 0.01 $rotdamping 1.5 $rootbone "valvebiped.bip01_pelvis" $jointconstrain "ValveBiped.Bip01_Spine2" x limit -48 48 0 $jointconstrain "ValveBiped.Bip01_Spine2" y limit -25 25 0 $jointconstrain "ValveBiped.Bip01_Spine2" z limit -25 50 0 $jointconstrain "ValveBiped.Bip01_R_UpperArm" x limit -39 39 0 $jointconstrain "ValveBiped.Bip01_R_UpperArm" y limit -79 95 0 $jointconstrain "ValveBiped.Bip01_R_UpperArm" z limit -93 23 0 $jointconstrain "ValveBiped.Bip01_L_UpperArm" x limit -30 30 0 $jointconstrain "ValveBiped.Bip01_L_UpperArm" y limit -95 84 0 $jointconstrain "ValveBiped.Bip01_L_UpperArm" z limit -86 26 0 $jointconstrain "ValveBiped.Bip01_L_Forearm" x limit 0 0 0 $jointconstrain "ValveBiped.Bip01_L_Forearm" y limit 0 0 0 $jointconstrain "ValveBiped.Bip01_L_Forearm" z limit -149 4 0 $jointconstrain "ValveBiped.Bip01_L_Hand" x limit -37 37 0 $jointconstrain "ValveBiped.Bip01_L_Hand" y limit 0 0 0 $jointconstrain "ValveBiped.Bip01_L_Hand" z limit -57 59 0 $jointconstrain "ValveBiped.Bip01_R_Forearm" x limit 0 0 0 $jointconstrain "ValveBiped.Bip01_R_Forearm" y limit 0 0 0 $jointconstrain "ValveBiped.Bip01_R_Forearm" z limit -149 4 0 $jointconstrain "ValveBiped.Bip01_R_Hand" x limit -60 60 0 $jointconstrain "ValveBiped.Bip01_R_Hand" y limit 0 0 0 $jointconstrain "ValveBiped.Bip01_R_Hand" z limit -57 70 0 $jointconstrain "ValveBiped.Bip01_R_Thigh" x limit -12 12 0 $jointconstrain "ValveBiped.Bip01_R_Thigh" y limit -8 75 0 $jointconstrain "ValveBiped.Bip01_R_Thigh" z limit -97 32 0 $jointconstrain "ValveBiped.Bip01_R_Calf" x limit 0 0 0 $jointconstrain "ValveBiped.Bip01_R_Calf" y limit 0 0 0 $jointconstrain "ValveBiped.Bip01_R_Calf" z limit -12 126 0 $jointconstrain "ValveBiped.Bip01_Head1" x limit -20 20 0 $jointconstrain "ValveBiped.Bip01_Head1" y limit -25 25 0 $jointconstrain "ValveBiped.Bip01_Head1" z limit -13 30 0 $jointconstrain "ValveBiped.Bip01_L_Thigh" x limit -12 12 0 $jointconstrain "ValveBiped.Bip01_L_Thigh" y limit -73 6 0 $jointconstrain "ValveBiped.Bip01_L_Thigh" z limit -93 30 0 $jointconstrain "ValveBiped.Bip01_L_Calf" x limit 0 0 0 $jointconstrain "ValveBiped.Bip01_L_Calf" y limit 0 0 0 $jointconstrain "ValveBiped.Bip01_L_Calf" z limit -8 126 0 $jointconstrain "ValveBiped.Bip01_L_Foot" x limit 0 0 0 $jointconstrain "ValveBiped.Bip01_L_Foot" y limit -19 19 0 $jointconstrain "ValveBiped.Bip01_L_Foot" z limit -15 35 0 $jointconstrain "ValveBiped.Bip01_R_Foot" x limit 0 0 0 $jointconstrain "ValveBiped.Bip01_R_Foot" y limit -25 6 0 $jointconstrain "ValveBiped.Bip01_R_Foot" z limit -15 35 0 } $collisiontext { animatedfriction { "animfrictionmin" "1.000000" "animfrictionmax" "400.000000" "animfrictiontimein" "0.500000" "animfrictiontimeout" "0.300000" "animfrictiontimehold" "0.000000" } editparams { "rootname" "valvebiped.bip01_pelvis" "totalmass" "90.000000" "jointmerge" "valvebiped.bip01_pelvis,valvebiped.bip01" "jointmerge" "valvebiped.bip01_pelvis,valvebiped.bip01_spine1" } } $proceduralbones "male_07.vrd" $bonemerge "ValveBiped.Bip01_Pelvis" $bonemerge "ValveBiped.Bip01_Spine" $bonemerge "ValveBiped.Bip01_Spine1" $bonemerge "ValveBiped.Bip01_Spine2" $bonemerge "ValveBiped.Bip01_Spine4" $bonemerge "ValveBiped.Bip01_R_Clavicle" $bonemerge "ValveBiped.Bip01_R_UpperArm" $bonemerge "ValveBiped.Bip01_R_Forearm" $bonemerge "ValveBiped.Bip01_R_Hand" $bonemerge "ValveBiped.Anim_Attachment_RH"[/CODE]
Thanks! [editline] God damn Studiocompiler...[/editline] I guess the .qc works, if it wasn'T for the studiocompiler who has pretty much no motivation to work at all. I set in the paths, textures, smds, animations and it spews out an error.
If it spews out an error, at least tell us what it says. In any case, I've been building off the example male05 QC file in sourcesdk_content's hl2mp reference files. There's also a male 06 QC reference in the hl2 files. Since then I've learned quite a bit from the files and I've started adapting some of the newer methods using the Left 4 Dead 2 sdk_content which once again has released QCs. There's a lot of info that decompilers simply cannot read and translate for us and they still sometimes spit out a bunch of unnecessary info. If the source files are publicly released for us to use, why use a crude decompiled version instead? Not to mention the source files available to use usually split the QC into multiple files rather than cramming everything into a giant eyesore. Splitting them into parent folders often even allows you to share certain tidbits of code across different models if, say, the hitboxes were shared (though I guess alternatively you could just copy and paste the hitbox code across your model multiple times whenever you make changes). Lastly, since the source code was actually released for modders to use, they often provide small comments above certain things in the QC which explain what it is and/or why they did it. It certainly helps reduce the amount of head scratching when working on QC edits.
[QUOTE=erkor;45745412]Thanks! [editline] God damn Studiocompiler...[/editline] I guess the .qc works, if it wasn'T for the studiocompiler who has pretty much no motivation to work at all. I set in the paths, textures, smds, animations and it spews out an error.[/QUOTE] Use Crowbar to compile & decompile models, it works much better and is actually being updated compared to other ones.
I made progress! I wrote a .qc myself, but I get the error "Leaking 1 element" or something like that before StudioMDL closes down. (I stopped using studiocompiler because I found it a bit too tedious) Is the error a qc-related one, or a model related one?
Honestly, it could be either problem. Mind posting the qc in [code] tags?
[code] $cd "D:\garrosh\" $modelname "garrosh\garrosh.mdl" $model "Garrosh" "Garrosh" { } $surface "flesh" $body Garrosh "garrosh.smd" $cdmaterials "garrosh" $sequence idle "garrosh" loop fps 30 $collisionjoints "garrosh.smd" { $mass 90.0 $inertia 10.000 $damping 0.01 $rotdamping 1.50 $rootbone "garrosh_bone_Root" } [/code] Here you go.
Instead of [code]$model "Garrosh" "Garrosh" { }[/code] you should do [code] $model "Garrosh" "Garrosh.smd"[/code] assuming you have an smd file named "Garrosh" in the same folder as the qc file.
I tried that out. Now it sends out a red text that I can't even read correctly before closing down. [Editline]sec[/editline] Oh wait! I used the wrong .QC file. I had an old one stored in D:. Here's the new one, I doubt anything other than the location changed, however: [Code] $cd "G:\Steam\steamapps\common\SourceFilmmaker\content\usermod\materialsrc\model" $modelname "garrosh\garrosh.mdl" $model "Garrosh" "Garrosh" { } $surface "flesh" $body Garrosh "garrosh2.smd" $cdmaterials "garrosh" $sequence idle "garrosh" loop fps 30 $collisionjoints "garrosh2.smd" { $mass 90.0 $inertia 10.000 $damping 0.01 $rotdamping 1.50 $rootbone "garrosh_bone_Root" } [/code] Take note that the .smd is now called garrosh2.
Your idle animation is still looking for garrosh which you said you renamed to garrosh2. You should also change $model to $body and removed the brackets you have there as they aren't doing anything. Other than that, we'd need to know what the error being printed is (or is leaking 1 element still it?). On a side note, you should probably move your materials folder into models/garrosh so it's located in materials/models/garrosh (just for organization purposes).
[QUOTE=CaptainBigButt;45760802]Your idle animation is still looking for garrosh which you said you renamed to garrosh2. You should also change $model to $body and removed the brackets you have there as they aren't doing anything. Other than that, we'd need to know what the error being printed is (or is leaking 1 element still it?). On a side note, you should probably move your materials folder into models/garrosh so it's located in materials/models/garrosh (just for organization purposes).[/QUOTE] The current error was a bunch of yellow text, then some red text and then studiomdl shut down. I couldn't read it. [editline]WOA[/editline] Another update: I removed one of the two $bodys and I ended up getting a full report. It's too quick for me to see what's going on, though, but I see no models anywhere. New new code: [CODE]$cd "G:\Steam\steamapps\common\SourceFilmmaker\content\usermod\materialsrc\models" $modelname "garrosh\garrosh2.mdl" $surface "flesh" $body Garrosh "garrosh2.smd" $cdmaterials "garrosh" $sequence idle "garrosh2" loop fps 30 $collisionjoints "garrosh2.smd" { $mass 90.0 $inertia 10.000 $damping 0.01 $rotdamping 1.50 $rootbone "garrosh_bone_Root" } [/CODE]
Change [code]$sequence idle "garrosh2" loop fps 30[/code] to [code]$sequence idle "idle" loop fps 30[/code] And make sure that the idle animation smd file is named idle.smd
[QUOTE=huntingrifle;45761051]Change [code]$sequence idle "garrosh2" loop fps 30[/code] to [code]$sequence idle "idle" loop fps 30[/code] And make sure that the idle animation smd file is named idle.smd[/QUOTE] Tried that; it didn't work, sadly.
Do you have an idle animation in an smd format for this model? Also, switch to Crowbar, it's 100x easier to use and will give you a full report on the error instead of closing.
[QUOTE=huntingrifle;45761266]Do you have an idle animation in an smd format for this model? Also, switch to Crowbar, it's 100x easier to use and will give you a full report on the error instead of closing.[/QUOTE] I don't. I tried copying the garrosh smd and using that one (with a rename, of course), but that didn't seem to work. -- I tried compiling. I end up with an empty log and no progress.
[QUOTE=erkor;45761303]I don't. I tried copying the garrosh smd and using that one (with a rename, of course), but that didn't seem to work.[/QUOTE] That's why you have the "leak". You'll have to make an idle animation that lasts at least 1 frame for you to loop it. Do a quick Google search on how to add animations in your 3d modeling program and make a 1 frame idle animation for it.
[QUOTE=huntingrifle;45761377]That's why you have the "leak". You'll have to make an idle animation that lasts at least 1 frame for you to loop it. Do a quick Google search on how to add animations in your 3d modeling program and make a 1 frame idle animation for it.[/QUOTE] I tried making an animation, but I can't get it to work in Blender. I'm using 3DS Max 2015, so no plugins for SMD export work, hence I must use Blender. I added keyframes, but it didn't seem to change anything.
I don't use Blender and have no idea how to use it, but try following [URL="https://www.youtube.com/watch?v=rZC8i7nq32k"]this[/URL] video on how to export the file with animations. Unfortunately, that's the best solution I can offer you, unless you want to look up more Blender animation tutorials.
You can recycle the model's default pose into the idle animation which is what he was doing before. If this is a playermodel or ragdoll, then you can change your sequence to look more like this: [code]$sequence ragdoll garrosh2 FPS 30 activity ACT_DIERAGDOLL 1[/code] The model has a skeleton in it with a set of locations which to studiomdl is literally exactly the same as having an animation with one frame. Your model does have to have at least one animation but it can be any animation you wish and it can have any name. It simply has to be an animation.
[QUOTE=erkor;45760840]The current error was a bunch of yellow text, then some red text and then studiomdl shut down. I couldn't read it. [editline]WOA[/editline] Another update: I removed one of the two $bodys and I ended up getting a full report. It's too quick for me to see what's going on, though, but I see no models anywhere. New new code: [CODE]$cd "G:\Steam\steamapps\common\SourceFilmmaker\content\usermod\materialsrc\models" $modelname "garrosh\garrosh2.mdl" $surface "flesh" $body Garrosh "garrosh2.smd" $cdmaterials "garrosh" $sequence idle "garrosh2" loop fps 30 $collisionjoints "garrosh2.smd" { $mass 90.0 $inertia 10.000 $damping 0.01 $rotdamping 1.50 $rootbone "garrosh_bone_Root" } [/CODE][/QUOTE] Create a batch file and drag and drop the QC on that. You can make the compiler stop after it completes then. [code] "H:\Games\Steam\steamapps\common\Half-Life 2\bin\studiomdl" -game "H:\Games\Steam\steamapps\SourceMods\test" %1 GOTO CUT "H:\Games\Steam\steamapps\common\SourceFilmmaker\game\bin\studiomdl" -game "H:\Games\Steam\steamapps\SourceMods\test" %1 :CUT pause[/code]
Post a download to all your files, I'll compile it for you using my .qc and send it to you.
[QUOTE=Demonic King;45763625]Post a download to all your files, I'll compile it for you using my .qc and send it to you.[/QUOTE] [URL="https://www.dropbox.com/sh/olsrw7ybj4dmzdy/AABGDTSmpzwOoTuO-Zpd6jVLa"]Here you go.[/URL]
Honestly your QC seems perfectly fine, aside from two things: [CODE]$cd "G:\Steam\steamapps\common\SourceFilmmaker\content\usermod\materialsrc\models"[/CODE] Delete that line. It's deprecated, unnecessary, and just makes things annoying to organize. [CODE]$surface "flesh"[/CODE] Change that to: [CODE]$surfaceprop flesh[/CODE] (a note about quotation marks: you only need them if there are spaces in the the text. Otherwise it's your choice whether to include them or not) Once you fix the $surfaceprop command it should compile just fine. Not sure what the issue is here. I really should hurry up and finish my full QC tutorial.
[QUOTE=SergerantJoe;45765898] I really should hurry up and finish my full QC tutorial.[/QUOTE] I really hope your QC tutorial involves building from the free open source files Valve already provides for us. It's like a playground of features to mess around with (or just comment out and come back to later). I'm kind of lost as to why half the posts in this thread still suggest using a decompiled one instead.
Yeh, it will focus on buildings QCs from scratch, although it'll also suggest that "one time QCers" simply reuse a decompiled one. Problem is, Valve's files aren't exactly up-to-date. Heck the TF2 ones haven't been updated since 2009.
I originally built from the hl2mp QC files which probably come from far before 2009. As of fairly recently I referenced a lot of the changes in the Left 4 Dead 2 and made modifications to the QC. Even if they come from 2009 or so, the engine comes from 2004 and the structure of QC files hasn't really changed. With the way the Dota 2 alpha tools work, you don't even use a QC. Instead, you import files directly in the model editor and build your model that way which could mean they haven't updated their files because they don't even use QC files anymore. Either way, there are quite a bit of useful things in the released QC files that most people often ignore. Decompiling a model doesn't restore all of the original information in perfect condition and it generally spits everything into a single QC file. Crowbar is definitely an improvement, but decompiling in general is imperfect.
Ok I just compiled it and this is what I got: ERROR: Too many bones used in model, used 134, max 128 Looks like you need to remove a 6 bones.
[QUOTE=Demonic King;45773724]Ok I just compiled it and this is what I got: ERROR: Too many bones used in model, used 134, max 128 Looks like you need to remove a 6 bones.[/QUOTE] I've removed some bones and re-exported. It should be alright now.
Sorry, you need to Log In to post a reply to this thread.