Cleanup is going to take awhile, so the site is back up but editing has been disabled.

Using Own Player Models

From HalfLife 2 Knowledge Base

Jump to: navigation, search

by Jorg40

Contents

Intro

This is a very basic tutorial to help new users learn to edit the Source engine.

In Half-Life 2 multiplayer, players spawn into the game as random citizens or Combine soldiers. This tutorial will show how to modify which character models can be used.

First, fire up your prefered Coding program, I use the Microsoft Architect 2003 .Net Then after that, fire up your project (which is normally called game_sdk in your scr folder)

Changing the code

When you change the code in a .cpp file or in a header file you have to be careful about how you type. C++ is a very strict language, so a small typo can completely prevent your code from working. Be careful while typing!

hlmp_player.cpp

Open up the file hlmp_player.cpp in your hl side (the server). Once you are in there, scroll a few lines down until you come to this section:

const char *g_ppszRandomCitizenModels[] = 
{
	"models/humans/group03/male_01.mdl",
	/*"models/humans/group03/male_02.mdl",
	"models/humans/group03/female_01.mdl",
	"models/humans/group03/male_03.mdl",
	"models/humans/group03/female_02.mdl",
	"models/humans/group03/male_04.mdl",
	"models/humans/group03/female_03.mdl",
	"models/humans/group03/male_05.mdl",
	"models/humans/group03/female_04.mdl",
	"models/humans/group03/male_06.mdl",
	"models/humans/group03/female_06.mdl",
	"models/humans/group03/male_07.mdl",
	"models/humans/group03/female_07.mdl",
	"models/humans/group03/male_08.mdl",
	"models/humans/group03/male_09.mdl",*/
};

const char *g_ppszRandomCombineModels[] =
{
	"models/combine_soldier.mdl",
	//"models/combine_soldier_prisonguard.mdl",
	//"models/combine_super_soldier.mdl",
	//"models/police.mdl",
};

Note the added slashes "//" on the last few lines.

What does this do?

Adding "//" before a line of code "comments out" the line, so it will be ignored when the code is compiled.

The g_ppszRandomCombineModels[] array stores a list of all of the Combine character models that can be used during multiplayer. A random element from the array is picked whenever the player spawns and the corresponding model file is used to represent that player. By commenting out entries into the array, you can restrict what character models will be used. This example allows only one character model to be used by the Combine forces - the generic combine_soldier model. Note that you must leave at least one model in the array, otherwise the game won't be able to pick a model!

Personal tools