• Register
Post tutorial RSS How to make a custom DX crosshair

As I wanted to make a new crosshair for my mod, I felt that I should make a tutorial about it ^^ This is my first tutorial so please don't judge it critically. I have linked to several of other tutorials.

Posted by on - Intermediate UI/HUD

Welcome to the tutorial, by the end of this, you'll be playing around with your new crosshair in Deus Ex!

  • First off, you need a custom package, if you haven't done so you can learn how to make one here or here.
  • Secoundly your player class, to save my typing, simply go here
  • Thirdly, making the actual crosshair texture. Learn how to mask the texture here and how to import it into DX here

Now that the basics are done, you need to make your own game HUD. The player class links to the HUD in which links to your new crosshair class. I have an example of mine below, just simply copy and paste into notepad, then replace SummerHUD with the name of your HUD class and SummerCrosshair with the name of your future crosshair class. And finally replace CrossCircle with the name of your crosshair texture.

// HUD: Superclass of the heads-up display.
class SummerHUD extends DeusExHUD;

// Variables.

var globalconfig int HudMode;    
var globalconfig int Crosshair;
var() class MainMenuType;
var() string HUDConfigWindowType;
var color WhiteColor;
var    Menu MainMenu;
var Mutator HUDMutator;
var PlayerPawn PlayerOwner; // always the actual owner


struct HUDLocalizedMessage
    var Class Message;
    var int Switch;
    var PlayerReplicationInfo RelatedPRI;
    var Object OptionalObject;
    var float EndOfLife;
    var float LifeTime;
    var bool bDrawing;
    var int numLines;
    var string StringMessage;
    var color DrawColor;
    var font StringFont;
    var float XL, YL;
    var float YPos;

function ClearMessage(out HUDLocalizedMessage M)
    M.Message = None;
    M.Switch = 0;
    M.RelatedPRI = None;
    M.OptionalObject = None;
    M.EndOfLife = 0;
    M.StringMessage = "";
    M.DrawColor = WhiteColor;
    M.XL = 0;
    M.bDrawing = false;

function CopyMessage(out HUDLocalizedMessage M1, HUDLocalizedMessage M2)
    M1.Message = M2.Message;
    M1.Switch = M2.Switch;
    M1.RelatedPRI = M2.RelatedPRI;
    M1.OptionalObject = M2.OptionalObject;
    M1.EndOfLife = M2.EndOfLife;
    M1.StringMessage = M2.StringMessage;
    M1.DrawColor = M2.DrawColor;
    M1.XL = M2.XL;
    M1.YL = M2.YL;
    M1.YPos = M2.YPos;
    M1.bDrawing = M2.bDrawing;
    M1.LifeTime = M2.LifeTime;
    M1.numLines = M2.numLines;

// Status drawing.

simulated event PreRender( canvas Canvas );
simulated event PostRender( canvas Canvas );
simulated function InputNumber(byte F);
simulated function ChangeHud(int d);
simulated function ChangeCrosshair(int d);
simulated function DrawCrossHair( canvas Canvas, int StartX, int StartY);

// Messaging.

simulated function Message( PlayerReplicationInfo PRI, coerce string Msg, name N );
simulated function LocalizedMessage( class Message, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject, optional string CriticalString );

simulated function PlayReceivedMessage( string S, string PName, ZoneInfo PZone )

    if (PlayerPawn(Owner).bMessageBeep)

// DisplayMessages is called by the Console in PostRender.
// It offers the HUD a chance to deal with messages instead of the
// Console.  Returns true if messages were dealt with.
simulated function bool DisplayMessages(canvas Canvas)
    return false;
// ----------------------------------------------------------------------
// InitWindow()
// ----------------------------------------------------------------------

event InitWindow()
    cross = Crosshair(NewChild(Class'SummerCrosshair'));



Save this file as the name of your GameHUD class, in this example it is SummerHUD.uc in your Package's Classes folder.

Now to link the player with the HUD. In your player class enter the code below, just replace SummerHUD with the name of your HUD class. In the below example I also made my own DataLinkPlay, you can simply ignore this if you do not want to make your own data link play.


function Possess() 

local DeusExRootWindow root; 


root = DeusExRootWindow(rootWindow); 

root.hud = DeusexHUD(root.NewChild(Class'SummerHUD'));

root.hud.SetWindowAlignments(HALIGN_Full,VALIGN_Full, 0, 0); 
//datalinkPlay = Spawn(class'Summer101DataLinkPlay');

Now that the HUD is all good, time to make the crosshair class itself. Replace the SUMMER references with your own just like before in the below example. SummerCrosshair with the name of your crosshair class and CrossCircle with the name of your crosshair texture.

// SummerCrosshair.
class SummerCrosshair extends Crosshair;

// ----------------------------------------------------------------------
// InitWindow()
// ----------------------------------------------------------------------

event InitWindow()
    local Color col;


    col.R = 255;
    col.G = 255;
    col.B = 255;


Save this as the name of your crosshair class, in this case it is SummerCrosshair.

Now compile your package, assuming you know how. Now to link DX with your player class, go to User.ini in the Deus Ex System folder and edit:

The above is my example, Summer is the name of your package and SummerJack is the player class name.

Besides what was linked, this was code made by Danjun and myself.

Eye.sys - - 70 comments

You said that "you need to make your own game HUD". Concerning what you know, is there a similar process to customize the color schemes for menu/hud?

Reply Good karma Bad karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.