How to Create an NPC Out of a Ragdoll in "GMOD"

By Matt Scheer

"Garry's MOD," also known as "GMOD," is a 3D modeling environment. It lets creators build interactive worlds with scripts and pre-made models. A ragdoll refers to a 3D model that can be manually posed. Normally, non-player characters (NPCs) are not made from ragdolls. This is because NPCs need animations to visually represent their scripted behaviors. Unless you are familiar with creating 3D animations, you should not attempt to make an NPC from a ragdoll, but instead customize GMOD's built-in NPCs.

Things You'll Need

  • Animation Software
  • Text editor
  • Garry's MOD
  • Decompiler

Step 1

Create the animations with your ragdoll that you need for your NPC. For example, if your NPC can walk, you need to create an animation that shows your ragdoll walking. Download the decompiler listed in the Resources Section. Decompile the ragdoll you wish to use by opening it in the decompiler. Create a folder for the decompiled ragdoll files. Open the decompiled ragdoll in an animation program, such as Blender, record the animation and save it. Save the file as a ".smd" file. Insert this file into the decompiled file folder you made earlier. Open the ".qc" file in the decompiled folder. Add this line of code to the file: " $includemodel "nameofyourfile.smd"Use a compiling software application, such as StudioMDL, to recompile the model into a new folder.

Step 2

Open a text editor.

Step 3

Type:local NPC = { Name = "Your NPC's name", Class = "npc_entertheclass", Choose a name for your NPC to replace "Your NPC's name." Now change "entertheclass" to the type of NPC class you wish your ragdoll to be, such as "citizen," which is an NPC that follows you, or ""vartigaunt," which is an enemy NPC.

Step 4

Go to the next line and type: Model = "models/modelname.mdl"Enter the name of the .mdl file you made in Step 1.

Step 5

Type "," after the name of the .mdl file. After the comma, type: "Health =" and choose a number for the health of the NPC. Type: KeyValues = { citizentype = 4 },GMOD comes with four citizen types: citizen, downtrodden, rebel and medic, numbered in that order. Each corresponds to different citizen behaviors. If you didn't choose a citizen for your NPC type, skip this line of code.

Step 6

Type:Category = Category } list.Set( "NPC", "npc_nameofNPC", NPC )Change "nameofNPC" to the name of your NPC. This sets the NPC in the list of NPC's in the game.

Step 7

Save the file with the name of your NPC and the file extension ".lua." Save the file to the file directory "garrysmod\autorun\." Your NPC has now been made from a ragdoll.