How do you convert a model to a playermodel?

How do you convert a model to a playermodel? This is a question I have been having.
It has joints and an animation using both
$animation
and
$sequence
in the .qc file because I was planning on also making it a playermodel :slight_smile:

So it has the animation, it has the joints, got the nice looks, I WANT TO TURN IT INTO A PLAYERMODEL!!!
The animation is also suppoused to play on a loop, as it is a walking animation.

Put this in your .QC:
$includemodel “m_anm.mdl”

or this for the females:

$includemodel “f_anm.mdl”

or this for the zombies:

$includemodel “z_anm.mdl”

Make sure the reference .smd is on the ValveBiped skeleton too.

ValveBiped?
I use MilkShape for exporting .smd files, never heard of it.
I’ll try anyway, will reply when I do.

It doesn’t work…

Am I suppoused to put something in lua/autorun?

Is your model rigged?
You need to rig it using the ValveBiped, which is basically what all the player animations use.

Most likely, as I don’t have control over that, the program rigs it for me…

Since a lot of people use milkshape 3D and make working animations in it, I’m going to say yes.

Edit: This is my compile.qc file, may be useful :slight_smile: http://pastebin.com/fsn9mgsT

So… :

[lua]

AddCSLuaFile()

local function AddPlayerModel( name, model )
player_manager.AddValidModel( name, model )
end

local function AddPlayerHands( name, model, skin, bodygroup )
player_manager.AddValidHands( name, model, skin, bodygroup )
end

AddPlayerModel(“My Dumb Model”, “models/yourname/players/your_dumb_model.mdl” )
AddPlayerHands( “My Dumb Model”, “models/weapons/my_dumb_hands.mdl”, 0, “00000000” )
list.Set( “PlayerOptionsAnimations”, “My Dumb Model”, { “menu_combine” } )

[/lua]

Put in a file named sh_whatever.lua in Lua/autorun in the addon’s main root folder.

Should be:

dumb_addon/Lua/autorun/sh_whatever.lua

If the model comes out in A-pose or T-pose then it’s not rigged to Valve biped and you’re boned.

I don’t think there are any programs out there that do it for you automatically, unfortunately.
But, try what Lucky9Two said and hope for the best.

for game engine or 3d software?

I got rid of all the “hands” stuff because it is all in one model.
Will this work?




AddCSLuaFile()

local function AddPlayerModel( name, model )     
    player_manager.AddValidModel( name, model )     
end

AddPlayerModel("Robo Dude", "models/coal/robot/robot.mdl" )
list.Set( "PlayerOptionsAnimations", "Robo Dude",     { "menu_combine" } )


I don’t think the lua is your problem. I’m guessing it isn’t a valve skeleton your model is rigged to. In the 3d software you’re using do all the bones in your skeleton include “ValveBiped”? Like this

If it doesn’t then I’m afraid it’s not the right skeleton. You can use a male or female skeleton decompiled or online and modify the mesh to fit the skeleton or use Captainbigbutt’s Proportions method.

I did what you said, and I am going to try it…
But what is all of this “skeleton” jazz? Sorry, I am a modeling n00b.
Mine is just a solid model.
Also, this is NOT, in my opinion, my best work. I just try to do easy things before I tackle it on full-blown.

http://s9.postimg.org/li96vqvan/examp1.png

Sorry, that specific model won’t work no matter what, even with the proportions method. Only human or humanoid things can be playermodels, and they need to be the right size as well.

Yeah, what Sergerant said.

I presumed it was a humanoid model you were working on. If it’s not humanoid you’ll need to make your animations which is quite an undertaking. Also that isn’t a valve skeleton. When I say skeleton I mean the bones INSIDE the model/mesh. They’re what you actually move to animate it, and if the bones don’t match the animations (in this case, valves animations) it wont work.

(Im an Idiot and dont know how to make a skeleton)
Does anyone know how to convert THAT into a skeleton?

You can throw any valve skeleton you want on there and it won’t work. Your model is not humanoid. I can’t really tell what it is supposed be without textures honestly. (and I don’t mean that in a bad way. I just am not seeing it)

Well, if he weighted the model right it would work, but it would look odd like this:

Should I start off with a valve skeleton and build off of it?
Do I include the skeleton in a seperate .smd file?
BWLAGH?!?!?
IM A NEWB
Also, where do you get the base valve skeleton anyway? I thought there was one in the GarrysMod files because you told me to enter $includemodel “file to male skeleton”…
I mean, where else would it get the skeleton from?

2 years later

I don’t know how much I can really help you on this… I’ve only ever used milkshape to export a model once and it was a broken model so it didn’t even work. Just start testing stuff by decompiling a male or female playermodel in your gmod folder. Delete the skeleton on your model (NOT THE MESH) and import the .smd of male or female skeleton on top of your mesh. THAT will be the RIGHT skeleton. Work from there.