Announcement

Collapse
No announcement yet.

Help: Getting a new HUD working

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Help: Getting a new HUD working

    This is my first post here just like to say hello.

    Now to business...

    The mod I am working on needs me to add a custom HUD. I understand that to do this you need a custom game type. The problem in the image I have that is suppose to be the new HUD dose not show up and the normal DM HUD is there instead. I have looked all over the different boards and wiki to see if I am missing anything but I am at a complete lose.

    UCC finish without a problem. Then I run then mod with UT2004.exe
    -mod=Serenity

    The GUI has 3 buttons Play, Settings, and Exit. Play takes player right into a DM. What I am trying do is the player hits Play they go into the custom game type with the HUD image I have.

    This is the code:

    Code:
    //==================================================
    //  This the for the new HUD right now its suppose to display a image  
    //==================================================   
    
    class myHUD extends HudBase;
    
    #exec TEXTURE IMPORT NAME=pHUD FILE=..\Textures\traintag.pcx GROUP="HUD" MIPS=OFF FLAGS=2
    
    var texture T;
    
    simulated event PostRender( canvas Canvas )
    {
        Super.PostRender(Canvas);
    
        if (Level.TimeSeconds < 25.5)
           RenderScreenshot(Canvas);
    
    	RenderIcons(Canvas);
    	OverlayIcons(Canvas);
    }
    
    //Render Two Icons side-by-side
    function RenderIcons( Canvas Canvas )
    {
    	local float X,Y;
    
    	X=Canvas.ClipX * 0.45;
    	Y=Canvas.ClipY * 0.05;
    
    	Canvas.SetPos(X,Y);
    	Canvas.DrawIcon(T, 1);
    	Canvas.DrawIcon(T, 1);
    }
    
    function OverlayIcons(Canvas Canvas)
    {
       local float X,Y;
    
       X=Canvas.ClipX * 0.25;
       Y=Canvas.ClipY * 0.5;
    
       Canvas.SetPos(X,Y);
       Canvas.DrawIcon(T, 1);
       X += 25;
       Canvas.SetPos(X,Y);
       Canvas.DrawIcon(T, 1);
    }
    
    function RenderScreenshot( Canvas C )
    {
       local float XWidth, YHeight, XMod, YMod;
    
    
       XMod = C.ClipX;
       YMod = C.ClipY;
    
       //Reset the Canvas in case the rendering mode has been changed
       C.Reset();
       C.SetPos(0,0);
       C.DrawTile(T, XMod, YMod, 0, 0, t.USize, t.VSize );
    
    }
    
    defaultproperties
    {
    	T=Texture'pHUD'
    }
    Code:
    //========================================================
    // This is the code for the custom game type 
    //========================================================
    class CustomDM extends xDeathmatch;
    
    
    defaultproperties
    {
    bAllowTrans=True
    InitialBots=8
    HUDType="Serenity.myHUD"
    MapPrefix="CDM"
    Description="Gotta keep the **** hand strong!"
    }
    Code:
    //========================================================
    // defult.ini
    //========================================================
    
    [Core.System]
    +Paths=../Serenity/System/*.u
    +Paths=../Serenity/Textures/*.utx
    +Paths=../Serenity/StaticMeshes/*.usx
    +Paths=../Serenity/Maps/*.ut2
    
    [Editor.EditorEngine]
    
    [Engine.GameEngine]
    MainMenuClass=GUI2K4.UT2K4MainMenu
    
    [Engine.MaplistManager]
    Games=(GameType="Serenity.CDM",ActiveMaplist="Default CDM")
    Code:
    [Public]
    
    Object=(Class=Class,MetaClass=Engine.GameInfo,Name=Serenity.CustomDM,Description="CDM|Custom DM|xinterface.Tab_IADeathMatch|xinterface.MapListDeathMatch|false")
    
    [Serenity.CustomDM]
    GameName="CustomDM"

    #2
    Hello,
    I'm not a game programmer and I don't know much about programming on UT.

    However, you've posted code for the hud but you start off with talking about modifying the menu. From looking over your code, I don't see how your new menu will show if you are using the default menu..

    ---
    [Engine.GameEngine]
    MainMenuClass=GUI2K4.UT2K4MainMenu
    ---

    I could be wrong but this was just my thought.
    Chris

    Comment


      #3
      Originally posted by Slayzer
      The mod I am working on needs me to add a custom HUD. I understand that to do this you need a custom game type.
      From my experience, you only need to change Level.Game.HUDType to the class of your custom HUD; a custom game type is not necessary. I simply did this in the PreBeginPlay event of a Mutator, and it worked perfectly. (I'm going off what I learned in writing the ONS Supreme HUD; you might try opening that up in WOTgreal Exporter or a similar program to see an example of how to add a custom HUD.)

      Comment


        #4
        Thxs I will take a look at the HUD you posted

        Comment

        Working...
        X