Creating gmod Player Models

I have been trying to make a player model for garrys mod and have gotten to a point where i need some help understanding where to go next. I have created the model and exported it form blender with the bones and stuff in a smd file. I have compiled the file into a ragdoll and imported it into gmod, i did not understand what to do for the hlmv to set the limits on the bones. Basically when I get ingame the model will shoot its body parts across the map. I am trying to make this model into a player model and am stuck on what to do next.

This is my code for my qc file so far but I know there is more that should be added I just need some direction/help.


$modelname kratoxrigged/kratox3
$cdmaterials models/kratox3
$model studio full_body_.smd

$collisionjoints full_body_.smd
$sequence ragdoll full_body_.smd

I have not found many tutorials on creating player models for gmod and have had to pick piece information from wikis and forum post to actually get this far, so if anyone has a link to a very well written explanatory one that would be great. The few ones I have found either are not for the area I want or just do not explain enough to help me. I am guessing I need to go back and rename all of the joints to valve joints as I have read. I have renamed most of the joints except the ones leading from the spine to the upper arms. What is that bone name in valve? After that What stuff needs to be added in the qc file to help me?

Ok I wanted to try and decompile a hl2 and see fi that worked. I replaced all of the files and stuff with mine an used the valve skeleton. I deleted any error lines I had with stuff like eyes. It compiled and stuff but it still shows the original model I decompiled and will not spawn the one i made. I do not understand what the problem is it compiled fine.

Ok i figuired out some things and now have gotten my model ingame as a ragdoll, but it glitches out when spawned. The arm like flies behind its head and just liek starts hitting itself. I tried decompiling a source model but that did not work the skelton just caused it to fly to the middle of the map and not move. I do not want a ragdoll though. I want a player model. One that I can move and use vlave animations. Can someone please help. I have spent 3 days working on this on my own and am at the point where i need some direction. Google yields no more help and all the things i can find just simply do not go with what I need help on.

Basically you can follow this tutorial http://forum.facepunch.com/showthread.php?t=542906.
But when making the skeleton you need to be using the ValveBiped one, so decompile a hl2 model, for example alyx, and grab the skeleton from that, weight it to your mesh, and all that junk.
Then within the qc you’re going to want to include the animations for a playermodel.

The line for such being:


$includemodel "m_anm.mdl"

You’re then going to need to have a lua script to add the playermodel to the list of selectable and valid ones.

Example being (within ‘lua/autorun/mypmodel.lua’, lua file can actually be named anything):


player_manager.AddValidModel("models/player/example.mdl")
list.Add("PlayerOptionsModel", "models/player/example.mdl")

Plus, all player models ARE ragdolls.

I followed that guide as much as I could In blender and exported it to gmod. I used the skeletons from a decompiled model but when i get ingame to test out the ragdoll it crashes. This is my qc file


$modelname kratoxrigged4/kratox
$cdmaterials models/kratox
$model model "reference.smd"

$includemodel "m_anm.mdl"

$Sequence ragdoll "ragdoll.smd"FPS 30
$collisionjoints phymodel.smd {

	$mass 1.0
	$inertia 1.00
	$damping 0.00
	$rotdamping 0.00
	$rootbone "pelvis"
}

I did not do the constraint joints yet but wanted to see if it would spawn ingame first.

-------------Update-----
I recently tried removing the $includemodel “m_anm.mdl” and recompiling it. It fixed the crashing but now this is happening:

http://cloud.steampowered.com/ugc/578971142932546253/90226BFBB943784F3B4AD5682971C6A3E8211FB7/

PS: I am worrying about textures last want to get the difficult stuff out of the way.

I have been askign around and apprentaly the bones can not exceed 24 and that is what causes your character to fly tot he middle of the map. The main issue though is that the bonesthat I decompilied are 56 in total. How do I use the vave skeelton but still keep it at 24 bones. Here is a pic :

Include the QCIs from the SDK in your QC

QCIs? Can you post the code your talking about

Turns out they’re not in the SDK — or I can’t find them.

Grab this archive: http://source.maxofs2d.net/gmod/gm_anim_includes.7z

Include the needed QCIs, for example:


$include "standardhierarchy.qci"
$include "standardikchains.qci"
$include "male/commonbones.qci"
$include "male/hitbox.qci"
$include "male/ragdoll.qci"

Note that the limit of bones is actually 127 bones. I don’t know who told you about the 24/56 ones but it’s bullcrap!

The skeleton of your model must match the structure/naming scheme of the ValveBiped.

I included those qcis in my qc file. I got an error with $include “male/ragdoll.qci”. It kept saying ERROR: c:\users\kratox_x3\desktop
ew folder (4)\male/ragdoll.qci(87): - could not load file ‘ragdoll_pose.obj’
so i removed it and everything compiled correctly. When I get ingame though the model is still in the middle of the map. I am gonna re rig this model for the 10th time now and try to copy valves name for the bones. Hopefully that is the issue because it seems to only do this if i use the skeleton from the decompiled model.

the model appearing in the middle of a map is a bug, not your fault

go into thirdperson to check if it looks ok as a playermodel

Oh wow thanks it is working now. I couldn’t use the lua that bloodarowman provided so i just downloaded a playermodel from garrysmod.org and chnaged some things in the lua file of that for my model. It kept giving me " something is creating script errors". Well now the final problem hopefully. THe model has been scaled to the size of a normal player model. It has stretched its arms out too.

http://cloud.steampowered.com/ugc/578971142940496877/04EB7E0C0521A3015361EEBFD49C63D01E7E3692/

I tried using the $scale command in my qc an recompiling but that did not help any. Do I need to open hlmv and set the join constraints or something? I know it can be done because I have been on servers where the you can walk around as a headcrab and be the size of the normal head crab. There is even one where the model grows every so often.

Nothing you can do without creating your own animations (or somehow scaling the skeleton but I doubt thats possible)

The model is rigged like a normal HL2 male, and you’re using an animation model merged onto that, so all the bones are sized/positioned/rotated according to the standard HL2 male skeleton the animations are made for, not your midget one

Well I have done animations before and have looked up how to get them ingame, but how do you make it where it plays that animation when such and such is done ingame. Like the model is running how would i tell it to use the animation I made. Also I am guessing that means I would need to remake every single gun animation as well.

you could try scaling your midget model up so it looks less distorted/thin

$scale 1.8 or so maybe?

I tried that and nothing changed. when i imported this into blender I made sure to scale it to the size i wanted which was like up to the waist of the normal sized models. Here is the code I am using


$modelname kratoxrigged4/kratox
$cdmaterials models/kratox
$model model "reference.smd"

$scale 1.8

$includemodel "m_anm.mdl"
$includemodel "m_gst.mdl"
$includemodel "m_pst.mdl"
$includemodel "m_shd.mdl"
$includemodel "m_ss.mdl"
$include "standardhierarchy.qci"
$include "standardikchains.qci"
$include "male/commonbones.qci"
$include "male/hitbox.qci"

$Sequence ragdoll "ragdoll.smd"FPS 30

$collisionjoints phymodel.smd {

	$mass 1.0
	$inertia 1.00
	$damping 0.00
	$rotdamping 0.00
	$rootbone "pelvis"
}

I have been thinking. Can I not just go back and rescale the models up to the size of the male model and then change the $scale to like .5?

remove those, they don’t exist anymore

[editline]31st October 2012[/editline]

No, because the animations are what dictates the “height” of the model. It’s kind of the “last step”, if you will.

I’ll try and make an animation mdl for half-sized characters, if I manage to do it it’ll be included in the next update (no guarantees about how good it’ll look — for now)

Ok and thanks. I am gonna continue and try to do the same. I need to get an understanding and learn from all this. Just keep doing what your doing. The only thing I am lost with is making it override the games animations. I am guessing it will be the same as those $include models but I just include that animations mdl in. I don’t know but two heads are better than one.

I have a lamp thats a player model and I just decompiled it to see how it works. It has the Valve Biped skeleton and is animated via some weightmapping. I don’t know if you can do some fancy weightmapping to get your model to work with the default skeleton, but it’s worth a shot if nothing else works.

o.O can you send me a link to a download of it or something. Maybe i can decompile it and understand how they did the weighting on theirs. I honestly still think it can be done without needing to make custom animations. I remember there used to be a player model resizer where you could make your character smaller and still keep the same animations. I have even been on one server where you spawn as a headcrab with a phys gun but you the size of a normals model hand and just get larger and larger until you the size of a human model.

I’ll pm you a link. Good luck figuring it out, but you should get the basic concept of how weightmapping effects a model. I’m currently trying to re-weightmap a model in Blender and it is frustrating, but if you load an animation onto your model while weightmapping, you can veiw your changes in real time and make adjustments.
Also, I THINK I know the tool you’re thinking of, but it doesn’t change collision, it just changes the magnification everyone sees you as, or something like that.