Creating a custom player class (without the Mod Loader)

Prerequisites:
The Basics
How to add custom packages

Overview:
A common question that comes up is: "Can I change the player's character to look like someone else?"  The answer is "Yes".  The way you do it is by setting up a custom player class and specifying a different model or skins in that class.  Custom player classes let you do other things too, but those types of things typically require some coding knowledge.  This tutorial covers how to use custom player classes WITHOUT using the Team UC Mod Loader.  This is not recommended, but I'm providing the information for those who want to know how.  It includes an example player class file, GameInfo class file, and an example map.

If you're planning on distributing a mod that uses a custom player class, please consider using the Team UC Mod Loader as described here.

Download:
Download example files (5K)
You will need to compile the included .uc files into a package before the example will work.  Be sure to unzip the files into the corresponding folders as stored in the zip file.

 

1. Create your custom player class

You'll need to create a .uc file in your \DeusEx\MyPackage\Classes folder (where MyPackage is the name of your package) to define your custom player class.  In this example, the file would be called WaltonSimonsPlayer.uc.  If you aren't into coding, don't worry about it - just use this as an example of what to put in the file and you should be fine:

//=============================================================================
// WaltonSimonsPlayer.
//=============================================================================
class WaltonSimonsPlayer extends JCDentonMale;

event TravelPostAccept()
{
    Super.TravelPostAccept();

    MultiSkins[0] = Texture'DeusExCharacters.Skins.WaltonSimonsTex0';
    MultiSkins[3] = Texture'DeusExCharacters.Skins.WaltonSimonsTex0';
}

defaultproperties
{
CarcassType=Class'DeusEx.WaltonSimonsCarcass'
Mesh=LodMesh'DeusExCharacters.GM_Trench'
MultiSkins(0)=Texture'DeusExCharacters.Skins.WaltonSimonsTex0'
MultiSkins(1)=Texture'DeusExCharacters.Skins.WaltonSimonsTex2'
MultiSkins(2)=Texture'DeusExCharacters.Skins.PantsTex5'
MultiSkins(3)=Texture'DeusExCharacters.Skins.WaltonSimonsTex0'
MultiSkins(4)=Texture'DeusExCharacters.Skins.WaltonSimonsTex1'
MultiSkins(5)=Texture'DeusExCharacters.Skins.WaltonSimonsTex2'
MultiSkins(6)=Texture'DeusExItems.Skins.GrayMaskTex'
MultiSkins(7)=Texture'DeusExItems.Skins.BlackMaskTex'
BindName="WaltonSimons"
TruePlayerName="Walton Simons"
FamiliarName="Walton Simons"
UnfamiliarName="Walton Simons"
}

Save this in your \DeusEx\MyPackage\Classes folder as WaltonSimonsPlayer.uc.  If you're using the example files "as is", you'll want to add an EditPackages=MyPackage line to the [Editor.EditorEngine] section of your DeusEx.ini file.  You should already be familiar with setting up custom packages before continuing.

In this case, Mesh=LodMesh'DeusExCharacters.GM_Trench' is redundant, since the base class is already set to that mesh.  So what does that mean?  GM_Trench is the model (mesh) that several characters use, including JC Denton.  By specifying different MultiSkins values though, different character textures (skins) will be applied.

You'll need to set the 0 and 3 MultiSkins values in the TravelPostAccept function as shown above.  It has to do with the custom skins that you select at the beginning of a game.  If you know a bit about coding, you can even set it up so that the player can pick a custom portrait at the start of your mod and then set the appropriate skin in that function.

So... how exactly do you set the model and skins to a particular character from the game?  To find out which values to set, pull up that NPC's player class.  If you've never done an "Export All" in UnrealEd, pull it up and push that button.  That exports all of the UnrealScript code into various folders under your \DeusEx folder.  If you look under \DeusEx\Classes\Classes, you'll see a *bunch* of .uc files.  Pull up the .uc file for the character you want the player to look like, and set the same Mesh and MultiSkins values.  For example, pull up WaltonSimons.uc and you'll see where I got the above settings.

You can also set any of the MultiSkins values to your own custom-made textures.  And if you're *really* hard core, you could even use your own character mesh, but that would be a huge amount of work.

NOTE: Not all character models have as much animation as GM_Trench.  That doesn't seem to cause any problems, but it can look weird.

 

2. Create your custom GameInfo class

Create another .uc file in your Classes folder.  Call it MyGameInfo.uc and put this in it:

class MyGameInfo extends DeusExGameInfo;

function bool ApproveClass( class<playerpawn> SpawnClass)
{
    return true;
}

 

3. Compile your package

Now just do your "ucc make" to build your new player class and GameInfo class into your package.  But you're not done yet.  You have a new player class, but you haven't told the game engine to use it.  Since we're not using the Mod Loader, you also need to tell the engine to use your new GameInfo class as well.  Read on.

 

4. Edit the User.ini file

Pull up the User.ini file that's in your \DeusEx\System folder.  In the [DefaultPlayer] section, change your Class= line to:

Class=MyPackage.WaltonSimonsPlayer

 

5. Edit the DeusEx.ini file

Pull up the DeusEx.ini file that's in your \DeusEx\System folder.  In the [Engine.Engine] section, change your DefaultGame= line to:

DefaultGame=MyPackage.MyGameInfo

NOTE: If you have the Mod Loader installed, be sure and change this back to DefaultGame=DeusExML.MLGameInfo when you're done playing around.

Now you'll need to play a map to try it out.  Since you're not using the Mod Loader, I'll guess you'll have to fire up UnrealEd and load in a map or something!

If you're trying it with the example files, you'll be in a hallway with a mirror at the end.  If you look in the mirror, you'll see this lovely mug staring back at you:


Back to main page