2014 Gmod Playermodel Tutorial [Rigging + Lua]

Nearly all existing tutorials are several years old and outdated, so I decided to make one myself. This is probably not the best way, but it’s how I do it, and it seems to work.

Note: This tutorial assumes you have a basic knowledge of Source. IE you know how to make a QC, set up textures, etc.
I’m using Blender, the steps will be different for 3DSMax or Maya.

Now, when you have a model, the first thing you should do is ask: Is it rigged to the ValveBiped skeleton? If it is, skip Section 1.

Section 1-Repurposing Rigging

Alright, you have a ragdoll, you’ve decompiled it and loaded it into a 3D editor. Now you need the rig it to the ValveBiped skeleton. To get one, decompile any Half-Life 2 model. I recommend “models/humans/male_01.mdl”.

I don’t know about everyone else, but I cannot rig. I’m terrible with the Weight Paint tool and I don’t know how to do it in Max. So, here’s a trick to get around that.

Select the model, click the Object Data tab, then open Vertex Groups. You’ll see a list of all the bones the model is rigged to. Now, rename them all to match the ValveBiped bones. If you pose the model a bit you’ll see the mesh automatically jump to the bones as each group is renamed.


After all the weights are renamed, you may need to adjust the bone positions to match the mesh.


Tada! Your model is now on the ValveBiped, and without rerigging!

Section 2-Adding Animations

If the model was just a ragdoll, you need to give it animations or else it’ll be t-posing around.

Open your QC, then add the following lines, corresponding to the model gender/type.

Male: $includemodel m_anm.mdl
Female: $includemodel f_anm.mdl
Zombie: $includemodel z_anm.mdl

Section 3-Enabling it In-Game

Once your model is on the ValveBiped and has animations, you need to do some Lua scripting in order for it to appear in the playermodel list.

Navigate to “…\Steam\steamapps\common\GarrysMod\garrysmod\lua\autorun” and create a new .LUA file. The name of the file doesn’t matter.

player_manager.AddValidModel( "Model Name", "models/ModelPath/Model.mdl" )

This line adds the model to the playermodel list. “Model Name” will be the name of the model when you hover over the icon. ModelPath is your $modelname path.

player_manager.AddValidHands( "Model Name", "models/ModelPath/HandsModel.mdl", Skin#, "Bodygroup#" )

This line give the model custom hands. If your hands model has skins or bodygroups, you can toggle them on a per-model basis. That way if you have multiple playermodels you can put all their hands into one .MDL file.

And that’s it! Your model should now appear in the list. If it has paintability, skins, or bodygroups, you can change those in the tabs just like any other playermodel.


Model is the DBS Striker from my Sleeping Dogs pack, the map is nt_pissalley_ctg from the mod NeoTokyo.

If you need any clarification just ask. I don’t know how well I explained things.

Some of those animations have conflicts with eachother.

--Player animations
$includemodel m_anm.mdl

--NPC animations
$includemodel humans/male_shared.mdl
$includemodel humans/male_gestures.mdl
$includemodel humans/male_postures.mdl
$includemodel humans/male_ss.mdl

You should really just pick one or the other.

Not necessarily, everything still works just fine. But alright, I’ll remove it.

Not all of the animations have immediate conflicts but some of them do try to play at the same time such as jumping. I’ve had issues with NPCs getting caught in a loop while reloading as well. Players don’t need NPC animations and NPCs don’t need player animations, so I just started splitting them instead.

In-game maybe, but I was including them for other purposes as well. But whatever, it’s gone now.

Hopefully everything else is correct. It should be, unless I’m missing something like usual.

Wow nice, I’m planning to make a more in-depth tutorial for 3ds max.

I used to include both, but CBB is right, there are conflicts; I think the most glaring is that unarmed animations default to t-pose, which makes them unusable for RP (which if you’re doing playermodels you’re implicitly supporting RP).

Thanks really helpful to me :slight_smile:

Any idea why Gmod Legs wouldn’t work with playermodels?

What do you mean by Gmod legs?

The addon that adds first person legs. My playermodels work perfect as playermodels, and they even work as ragdolls, but the addon shows an error. I think it must be an error with the addon, but it doesnt happen to other playermodels.

I don’t really know what addon you’re talking about. Could you post a link?

I think he’s talking about this addon http://steamcommunity.com/sharedfiles/filedetails/?id=112806637 . Basically shows your legs when you look down.

Here’s a proper .qc example I annotated a while back

It might come in handy for some of you.

Ehh, that still could be fixed up a tiny bit, and this is more of Ragdoll->Playermodel rather than general compiling.

You should post it in the Ports WIP thread, that way more people will see it.

I tried to export a model in blender and got AttributeError: ‘NoneType’ object has no attribute ‘object’ with a load of other stuff too. How can I fix this?

No idea. I’m still only a beginner with Blender.

Also, I noticed that you get models with textures. How do you get them to load with textures?

Simply select the vertices, then drag the image file into the model.

I’m sure there’s another more professional way but I don’t know what it is.

Really useful, thanks man.