Garry's Mod

Garry's Mod

232 ratings
Creating Basic Playermodels and NPCs from existing Valve Rigged Models
By Zach88889 and 1 collaborators
This guide for Garry's Mod is going to show you how to make NPCs and Playermodels from models that are already rigged to the ValveBiped System. This will show you a little bit on how I make my NPC mods from models that my friends/subscribers/commenters request me to do.

This will show you how to make your own NPC and/or Playermodel out of a model that is already on the workshop but is not one or the other or neither.
DISCLAIMER :
You should ASK FOR PERMISSION from the author to make NPCs and/or Playermodels of the model from the Garry's Mod Workshop.
If ANYONE who reads this guide posts the example models from Citizens+ Part 1 as their OWN work from this tutorial I WILL HAVE IT REPORTED AND BANNED! You may only use this guide as REFERENCE for your own mods not to take the models from my mod and make them your own.
   
Award
Favorite
Favorited
Unfavorite
What you will need before you start
You will need to have downloaded :

  • Crowbar
  • Any game or software with a model compiler { Half Life 2 or Source SDK would work the best. }
  • Garry's Mod Publishing Utility
  • WinRaR
  • Java []
  • (Optional) Notepad++

When you first open up Garry's Mod Publishing Utility you will be greated with this :



You will need to look for gmad.exe and gmpublish.exe.
I'm going to help you with this.

- Gmad.exe is located in :
"C:\Program Files (x86)\Steam\steamapps\common\GarrysMod\bin\gmad.exe"

- Gmpublish.exe is located in :
"C:\Program Files (x86)\Steam\steamapps\common\GarrysMod\bin\gmpublish.exe"

Getting started to make the addon.
First thing's first. We need a model to start the tutorial for this guide. In this tutorial we will use a model from my Citizens+ Part 1 Mod.

Step 1.
Find and Subscribe to Citizens+ Part 1
Step 2.
Open up GMPU.
Step 3.
In GMPU select the "Extract" option in the upper left corner.



Step 4.
Go to the Extract Section in the window and click the File button to open search.
Step 5.
Go to your addons folder and locate the Citizens+ gma file. ( Hint : Your addons folder is located in
- For Window systems with 64 bit and up : C:\Program Files (x86)\Steam\steamapps\common\GarrysMod\garrysmod\addons
- For Window systems 32 bits and lower : C:\Program Files\Steam\steamapps\common\GarrysMod\garrysmod\addons



Step 6.
Look for the citizens+_mod_(_npcs_+_playermodels_)_part_1_841802655.gma file.
Step 7.1.
Double Click the File in order to select it.



Step 7.2.
Click the Checkbox that says "out" down in the Extract Cateogry
Step 7.3.
Choose a place to extract it to. { I would recommend your desktop. }
Step 7.4.
Click the Add to Queue button. ( It will then appear in the queue on the right. )
Step 7.5.
Run your queue by pressing the Execute button at the bottom of the queue.

Step 8.
The queue will run. The files may say they are extracted but if they don't appear on your desktop or where the output file you chose is. The easy solution to this is to make sure you have the files being extracted to a file.

Step 9.
You are now ready to start developing your own addon.
Decompiling your model
Now that we have extracted our model, we must decompile it in order to work with it properly to make the mod.

Step 1.
Open up Crowbar.
Step 2.
Before Decompiling we will prepare for the future. Select the Compile Tab. Choose a Game that has a model compiler. { I would recommend Half Life 2 if you have it. } ( It will be towards the middle of the compile window. )



Step 3.1.
Select the Decompile Tab in Crowbar.
Step 3.2.
Click the Browse... button and go to the models folder that you extracted from
Citizens+.


Step 3.3.
Go into the to the tnb folder then into the citizens folder.
Step 3.4.
Choose any model of your choice from there. ( I am going to choose Male 16 for the tutorial. ) { The only difference will be the name of the model. }
Step 3.5.
Double click your model that you have decided to use. After that the search window will close and you will be ready to decompile your model.
Step 4.
Choose the full path to be your desktop.
Step 5.
Press the Decompile Button.

Step 6.
You have now a decompiled model. Next we will edit the model itself and then compile it to make it into an NPC/Playermodel.
Editing the model's QC File.
We have now extracted and decompiled our model we want to work with.
This is what should be on your desktop.

Most of these files are smd files that you can't access. { The amount of smd files will vary due to if the model you are using has bodygroups or not. }
There will be a folder of the animations that will be on the ragdoll.
There will be a qc file that you will need to open.
DO NOT MESS WITH ANY OF THE FILES EXCEPT THE QC FILE WHEN EDITING A MODEL THAT YOU DID NOT MAKE.


IMPORTANT NOTE :
If it asks you what to open a QC File with, choose NotePad or NotePad++ ( It depends on if you downloaded NotePad++ or not. )

Step 1.
Open the qc file. You will be greated with one of these two images :
If you didn't download Notepad++ :



If you did download Notepad++ and used it to open the qc file :


Step 2.
Look for $ModelName "tnb\citizens\male_16.mdl" We need to change this so we dont mess up the original model from my mod. So change it to anything you want EXCEPT the \male_16.mdl at the end.
( For my self I will change it to npc/hostile/male_16.mdl. )
Step 3.
Scroll down until you find the animations of the model [] :
Step 4.
Choose the animations you want to add to this model.
List of Animations that you can choose from :
IMPORTANT! You must use ALL of the include models for that NPC/Player because if you NOT the model will error out!

For Friendly NPCs :

Male Citizen NPC
$includemodel "humans/male_shared.mdl"
$includemodel "humans/male_ss.mdl"
$includemodel "humans/male_gestures.mdl"
$includemodel "humans/male_postures.mdl"

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

Alyx NPC :
$IncludeModel "alyx_animations.mdl"
$IncludeModel "alyx_postures.mdl"
$IncludeModel "alyx_gestures.mdl"
$IncludeModel "humans/female_shared.mdl"
$IncludeModel "humans/female_ss.mdl"

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

For Hostile NPCs :

Combine Soldier :
$includemodel "combine_soldier_anims.mdl"
$includemodel "humans/male_shared.mdl"

MetroCop/MetroPolice :
$includemodel "Police_animations.mdl"
$includemodel "Police_ss.mdl"
$includemodel "humans/male_shared.mdl"

Zombie
$IncludeModel "zombie\zmanims.mdl"

Playermodels :

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

Female Player :
$includemodel "f_anm.mdl"
$includemodel "f_gst.mdl"
$includemodel "f_pst.mdl"
$includemodel "f_shd.mdl"
$includemodel "f_ss.mdl"

Step 5.
Paste the animations you want in place of the current animation the model has. ( I will use the MetroPolice Animations.)

Step 6.
You now have edited the qc file and are ready to compile the model.


Compiling your model.
Compiling is different than Decompiling. We have to edit the .qc file we got from decompiling our .mdl file.
We have already edited the QC file so all we need to do now is compile the model.

Step 1.
Open up Crowbar or unminimize it if you minimized it.

Step 2.
Select the Compile Tab.

Step 3.
Press Browse... and select the qc file from the desktop.


Step 4.
Press the Compile Button.

Step 5.
There should be a "compiled 0.34" file that showed up that contains the compile model.









Step 6.
Remember back to when we changed the folders the model would be located? I typed out npc/hostile/male_16.mdl We need to make a new folder in the models folder from the extracted models.

Step 7.
Open the model folder on the desktop and delete all of the subfolders inside that folder.








Step 8.
Make a new folder in there and name it what the first part of the $ModelName said. ( Mine said npc/ so I need to name the file npc. )


Step 9.
If you only had only 1 thing then the model ( Ex. npc/male_16.mdl, then you would put the compiled model in there but if you had a second one you need to make a folder inside of that one. ) { I had npc/hostile/male_16.mdl so I name it hostile inside of the npc folder. }




Step 10.
Now you will copy the model from the compiled 0.34 file into the last subfolder you put under.

















Step 11.
You now have you compiled model in your models folder. Next we need to put some LUA Code to get our model in to the actual game.
Coding your model as an NPC or Playermodel.
We have compiled our model and made it be able to be used, but we need to code it into the game so we can select the playermodel/NPC.

Step 1.
Open the Lua folder from the extracted mod. Then open the autorun folder.

Step 2.
Delete all of the th lua files from Citizens+. Feel free to look at them but DO NOT COPY AND PASTE THEM INTO YOUR OWN FILE BECAUSE THEY WILL ERROR WITH MY MOD.


Step 3.
Make a new text document, name it, and change the .txt part to .lua.



Step 4.
Open the .lua and get ready to start coding.

Type this in for a Hostile Combine NPC :




For a Hostile MetroCop/MetroPolice :



For a Friendly NPC :



For a Playermodel type in this :







Putting your NPC/Playermodel into the game.
Now that we have made the model usable as we want, it is time to move the folders into the game.

Step 1.
Make a new folder on your desktop and name it whatever you want.

Step 2.
Move the lua, materials, and models folders into that folder you just made.

Step 3.
Locate your addons folder.
C:\Program Files (x86)\Steam\steamapps\common\GarrysMod\garrysmod\addons
or
C:\Program Files\Steam\steamapps\common\GarrysMod\garrysmod\addons

Step 4.
Move your folder into the addons folder.

Step 5.
Launch Garry's Mod.
Step 5.2.
Look in the Developer console and look for this line :






Step 6.
Load into any map and check to see if the NPC or Playermodel was added into the game.

Step 7. The finished product. The following Images are for the test NPC/Playermodel

The Spawn Icon and Category they should be located in :

Hositle NPC :

Playermodel :

Friendly NPC :
Ending Part
Congratulations you now know how to make a basic NPC and a playermodel from models that are already rigged to the ValveBiped System.

Now Uploading the addon will NOT be explained in this guide, because there are a lot of tutorials out there on how to upload those mods.

This guide was made by me to give the community a tutorial on how to make NPC from existing models because everyone does a tutorial on a playermodel or something other than an NPC so I decided to be one of the first people that gives an in-depth tutorial on how to make them.

And with that I say : Have fun with your NPC, have a nice day/evening, and enjoy your gaming experience :] .
36 Comments
antlion gaming 17 Apr @ 1:49pm 
what would i need to type down for the coding part of the file for zombies?
Proxi 25 Nov, 2023 @ 6:16am 
Сложна... ждём внутри Гарис мод такую функцию
FUNKHUNTERS 13 Jul, 2023 @ 3:39am 
can you make npc pack Tool code?
soldierfan240164 13 Jun, 2023 @ 10:07am 
mmmmmmmmmmmmmmmm good
MrTan 27 Jan, 2022 @ 2:30am 
@DogeisCut Go to "YOUR STEAM FOLDER\steamapps\workshop\content\4000..." and then look for a folder with Citizens+
DogeisCut 9 Aug, 2021 @ 2:49pm 
Despite installing the addon and literally playing with it, "citizens+_mod_(_npcs_+_playermodels_)_part_1_841802655.gma" wont show up in the folder
danblak08 13 Nov, 2020 @ 9:24pm 
Uh, this doesn’t exactly work. I typed it in exactly how it’s out on here, but Gmod just gives me errors and won’t load the npcs
zyzz 1 Dec, 2019 @ 6:28pm 
ERROR: Too many materials used, max 32
KawaiiSenpai 2 Jul, 2019 @ 9:44am 
I'm not getting the compiled 0.34 file.
KawaiiSenpai 2 Jul, 2019 @ 9:01am 
Is there a Fast Zombie animation extension?