Converting an NPC into a Playermodel

I’ve spent an enormous amount of time getting the various bits of my TTT server working, but now I’m really out of my depth. I’m brand new to coding in GMOD, but not to programming in general. I’m trying to get some more playermodels in my pointshop, some of them I’ve had no trouble with, others are stuck in the T-pose and will not animate as they run. They will, however, react to jumping or falling and will crouch as they land.

I’m told that this is because they are NPCs, and NPCs don’t work in the same way as playermodels. I’d like to give these models the right animations, I’ve used them in sandbox and seen them running around properly- I just want them to do that as a playermodel! It’d be great if you could do this for me, but I’d prefer to learn how to do it so that I can do it with some of the others I have. I’ve also got a few that are just ragdolls but I really like, is it possible to convert them?

Anyway, this is the model I’m currently using:

And this is the LUA code I’m running on the server:

Any help you could give me would be grand. So many of the guides I’ve found are incomplete or out of date- I’ve been able to teach myself everything else I’ve done on this server, but I feel like I’ve hit a wall here!

I’d also like to highlight the lack of Trek, Firefly or BSG models in general, I kinda want to learn to model to try and fill in the gaps! If only I had the time.

If I’m correct, the NPCs have neither the bones nor the animations to be used as player models. In order to make an NPC into a player model you would have to decompile the mdl of the NPC and a current player model, delete all of the bones from the NPC and replace them with the bones from the playermodel, and rig each bone, then recompile the SMD files produced by this, including the animation files for players. It probably sounds confusing but if you google something along the lines of Mario’s Guide To Ragdolling it’ll probably make a lot more sense.

Uhhh… not really. If they’re NPCs then they’re already on the ValveBiped, all you need to do is decompile and and add m_anm.mdl to the animations.

Basically what SergerantJoe said.

  1. Decompile the model using a program such as MDL Decompiler
  2. Open the mdldecompiler.qc
  3. Add in this line

$includemodel "m_anm.mdl"

  1. Recompile the model using GuiStudioMDL
  2. The files will be located in the models folder of your garrysmod folder
  3. Replace the old files with the new ones you just made

And use Crowbar, Mdldecompiler is an outdated piece of garbage that can’t make QCs properly.

The problem is, you’d likely have to clean out the animations used by the NPCs since they do not support 9-way animations like in Team Fortress, Left 4 Dead, even Counter-Strike… Too bad we’ll never be able to have things like HL2DM; the exact same models used by NPCs, and only added player animations.

What are you talking about? This is for Gmod. You don’t even have to remove anything, just add on the player animations and you’ll be good to go.

What if the NPC animations (that are by default “8-way?”) get priority? Combining move_yaw with move_x and _y don’t seem to make good mixes… if I’m not wrong. Though, I will always have to look back at my thoughts about using the NPC models (like Half Life 2: DM does) and only adding player animations. There are some other suggestions I made on the GMOD Google Moderator that might’ve gone unanswered, like being able to fingerpose other currently non-fingerposable models in the Valve games, like Chell and the Vortigaunts, that includes DOG.

I once tossed a bunch of NPC/playermodel animations into a single model all will-nilly, and it worked perfectly.

The only thing you have to worry about is not mixing male and female animations, because those will definitely override each other.