How to change an NPC to a Player Model?

Hello,

I am new to GMod, and want to change this NPC to a player model: http://www.garrysmod.org/downloads/?a=view&id=130374

How would I do that?

Thanks!

EDIT: Also, when I put addons into my addons folder under Steam\steamapps(username)\garrysmod\garrysmod\addons, they don’t show up in my game. Just the ones I subscribe to in the Workshop (.gma files).

Here.

1.Get the tools! MDLDecompiler Fixed, GUI StudioMDL Here’s my development tools.
Decompile the model you want. (I put my decompiled models in my documents “decompiled models/<nameofmodelhere>” so I can go back to it later)

  1. Get Notepad++
    http://notepad-plus.sourceforge.net/uk/site.htm
    It’s alot beter than the old notepad.

  2. Edit the model .qc

You might want to change the model path so you don’t screw up any other models.
So just edit this line to where the model will go
2.


$modelname "<modelpathhere>.mdl"

and change the “$includemodel” to what you want it to be.
Here’s a list of your anim choices


male NPC:
male NPC:
$includemodel "humans/male_shared.mdl"
$includemodel "humans/male_ss.mdl"
$includemodel "humans/male_gestures.mdl"
$includemodel "humans/male_postures.mdl"

male player:
$includemodel "m_anm.mdl"
$includemodel "m_gst.mdl"
$includemodel "m_pst.mdl"
$includemodel "m_shd.mdl"
$includemodel "m_ss.mdl"

female NPC:
$includemodel "humans/female_shared.mdl"
$includemodel "humans/female_ss.mdl"
$includemodel "humans/female_gestures.mdl"
$includemodel "humans/female_postures.mdl"

female player:
$includemodel "f_anm.mdl"
$includemodel "f_gst.mdl"
$includemodel "f_pst.mdl"
$includemodel "f_shd.mdl"
$includemodel "f_ss.mdl"
CS:S / Combine player


$includemodel "cs_fix.mdl"

Kleiner:
$includemodel "Kleiner_animations.mdl"
$includemodel "humans/male_shared.mdl"
$includemodel "Kleiner_postures.mdl"
$includemodel "Kleiner_gestures.mdl"

Police (fixed anims)
$includemodel "Police_animations.mdl"
$includemodel "Police_ss.mdl"
$includemodel "humans/male_shared.mdl"

If your making a CS:S model into a player, you will want to remove this line.


$ikchain ikclip ValveBiped.weapon_bone_Clip knee 0.707 -0.707 0.000

If it says: Eyelid “lower_right” neutral out of range (±0.5)

Then remove the line that says that, and the numbers for it below.

http://img366.imageshack.us/img366/4809/tutorialpic1jx4.png

If it says: unknown flex AU27ZR

Then remove the flex at the end of the flex data just above the $lod stuff and one of the parentheses at the end of the line

http://img366.imageshack.us/img366/1038/tutorialpic2ii1.png

  1. Compile and Test
    Open GUI studio mdl,

by now you should be able to just compile it, go to the target directory, retrieve your model, and be able to fully use it.

Open the Source SDK modelviewer to test your model.

When you’ve tested all of the anims in modelviewer, you may then proceed to add your custom playermodel / NPC to Garry’s Mod.

Make a lua file in “garrysmod/garrysmod/lua/autorun” and name it the whatever you want (you might want to name it whatever the model is named and add “_player” to the end)

Open the lua file and add these lines for a playermodel.


player_manager.AddValidModel( "modelnamehere", 					"modelpath" )

list.Set( "PlayerOptionsModel",  "modelnamehere", 					"modelpath" ) 

Here’s an example


player_manager.AddValidModel( "ShoTGuNGuY49", 					"models/player/group01/shtgngy.mdl" )

list.Set( "PlayerOptionsModel",  "ShoTGuNGuY49", 					"models/player/group01/shtgngy.mdl" ) 

This was created by Silver.Knight. Fixed the tools and stuff.

I also have some other things like HeadHacking and other stuff.

Okay, I’m getting close! I got it to appear in the menu and I can select it, but when I do, it looks like this:

http://cloud-2.steampowered.com/ugc/1137419435390275427/64AB441AD81BE0BCAD7D545F40A15E04A4AD4766/

All I did was take everything from the download I posted above, put it into where it’s supposed to go, and then rewrite the LUA file to what you said, because the model is already made. When I opened it up to do those steps, it was already configured to how it needed to be.

My LUA says:


player_manager.AddValidModel( "HUNK", "models/hunk_orc" );

list.Set( "PlayerOptionsModel",  "HUNK", "models/hunk_orc" );

So what am I doing wrong?

SOMEHOW, I magically made progress. It works totally perfectly! Except for one major issue… this:

http://cloud-2.steampowered.com/ugc/1137419435391667542/CD251834458894F87814FCCE80B14AEC24DA36F8/

I walk around in this pose. However, when I fall, I do react to it:

http://cloud-2.steampowered.com/ugc/1137419435391650123/006E5C72465EECFC4BF333E69308615E8F9BAB58/

Can someone please help me? D:

Edit: I just remembered that the NPC that I got the model from runs up to you. goes into this “T” pose when it is not equipped with a weapon.

http://cloud-2.steampowered.com/ugc/1137419435391926716/0C1C00FBE850F948452A82CC53E28EB5CF71DC67/

So now the problem is a bit more knowable.

I compared the HUNK.qc file to that of another official playermodel (one for the Crysis Nanosuit), and they were both the same. So I believe that isn’t the problem, either.

EDIT 2: That is, until I disable thinking. Then they just stand normally with their arms at their sides.

http://cloud-2.steampowered.com/ugc/1137419435392234071/138627957A96E90544BD830290927380DEFABDE0/

Help, please?

That pose tends to mean its not rigged correctly because I have a few player models that walk around like that as well.

I GOT IT TO WORK!

It all came down to silly little lines of code. Such as:


$includemodel "combine_soldier_anims.mdl"
$includemodel "m_anm.mdl"
$includemodel "m_ss.mdl"

and


$jointmerge "ValveBiped.Bip01_Pelvis" "ValveBiped.Bip01_Spine1"

and


$animatedfriction 1.000 400.000 0.500 0.000 0.300

Putting those into the model fixed my problem. It’s now perfect! Thanks for all the help guys! :smiley: I was going to shoot “Thanks” into the mirror on that sandbox map I’ve been taking the screednshots from, but I ran out of bullets :expressionless:

I know this is an old post but I’m trying to do the same thing and the issue I’m having is that the NPC files I want to use are GMA and not MDL files, any help?

Do you have any idea how i’d do this?

[editline]13th July 2014[/editline]

Never mind i figured it out

i get this error when i compile how do i fix this?

ERROR: c:\users\aj\desktop est\mdldecompiler.qc(31): - can’t find eyeball texture “eyeball_r” on model
ERROR: Aborted Processing on ‘Humans\Group01\fout_01.mdl’