How do you make a new HUD?

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Euphoric Beaver

impeccably groomed
Apr 19, 2001
3,158
0
0
Great Britain
www.euphoric-beaver.me.uk
I just coded a machine gun that takes clips.
(Hey that's good for me. :D)

And have been using the chat window to show how much ammo is in the clip.
But I want it so it shows up on the HUD.

Is there any tuts, info or suggestions you can give me?
 

Kangus

Zombie on your pwn!
Jan 29, 2001
978
0
16
Illinois, USA
www.planetunreal.com
Eater has almost finished a HUD tutorial for WoD, but I'll give you a quick example of what you need here.


var int InClip;

simulated function PostRender( canvas Canvas )
{
local PlayerPawn P;
local float Scale;

Super.PostRender(Canvas);
P = PlayerPawn(Owner);
if ( (P != None) )
{
Scale = Canvas.ClipX/640;
//the next part sets where the text will draw
Canvas.SetPos(0.5 * Canvas.ClipX + 74 * Scale, 0.5 * Canvas.ClipY + 200 * Scale);

//The Font used to draw the text.
Canvas.Font = Font'Botpack.WhiteFont';

//The Color the text draws in.
Canvas.DrawColor.R = 255;
Canvas.DrawColor.G = 255;
Canvas.DrawColor.B = 255;

// The Actual Text, $string(InClip) tacks the number
// stored in InClip on the end.
Canvas.DrawText("In Clip: "$string(InClip));
}
}

This should work, I hope it helps.
 

TaoPaiPai

Commisaire Van Loc
Jun 13, 2000
1,626
0
0
Matnik
Visit site
Make a subclass of one of the HUD classes (or anything with a postrender function in it).
This class must have a post render function in it ,that is were you'll make all your drawings.(If you're making a hud for a tournament gametype you'd want to make it a subclass of challengeHUD or ChallengeTeamHUD if it's a team game).
Noow to actually draw things on screen you have to know the secrets of the canvas class.The canvas is a reference to the displayed screen on the player's machine ,here are the main functions and variables:

canvas.setpos(x,y) go to pixel x,y
canvas,drawtext(String text,boolean carriageReturn)
canvas.drawIcon(texture,scale)
canvas.drawTile(texture,posx,poy,endx,endy,scale

canvas.clipx
canvas.clipy these give you the resolution of the screen on the player's comp
canvas.drawcolor change it to the color you'll want to use for the next drawing operation


there are several others check the canvas class as well as the EPIC Hud classes.
 

Jack oneill

New Member
Sep 4, 2001
81
0
0
42
France
atlantis.jolt.co.uk
Need help too :)

Well, as you seems to have a great knowledge in canvas and Unreal HUDs, i would have to ask you something.

I'm the leader of a Stargate mod for UT. I'm also the lead coder. I'm searching for coders to help me in coding the mod. I'm currently really busy with the weapons and gametypes, so i can't learn the HUD fonctions.... I saw that you are good on this point. So, if someone which know how to make HUDs (and menus if possible), i would be really interested.

Here is the website : www.unrealism.com/modstargate

I hope someone will be interested by our project :) If you are intereszted, please e-mail me here : jackoneill@wanadoo.fr

Thx
 

TaoPaiPai

Commisaire Van Loc
Jun 13, 2000
1,626
0
0
Matnik
Visit site
If that's me your talking about,I am far too busy working on my mod of mine.
And that should be the case for everybody "with a great knowledge about scripting".
So the best advice if you're in a mod and looking from somebody to make sthg special,is to learn how to do the thing by yourself.
And yes,making a mod makes you busy and takes plenty of time,and you can now imagine how many work it requires to have something playable released.:eek:
 

Jack oneill

New Member
Sep 4, 2001
81
0
0
42
France
atlantis.jolt.co.uk
I don't need your exemple to know that U Scripter are very busy... I'm a coder too, and if i'm looking for help, the main reason is that i'm too busy...

Anybody else can make HUDs ??? I hope someone will be interested...

Thx for your asnwer. Good luck for your mod :)
 

HOB

King of the Jungle
Mar 14, 2000
22
0
0
42
CT
www.planetunreal.com
is the HUD only client side or it can display server variables also?

I have a HUD for a mod I'm making and I'm trying to make it display a variable in the gametype's replicationinfo, it works on the server's HUD fine but for the clients it just displays 0.
 

ca

CHiMERiC Grandmaster
Oct 11, 1999
84
0
0
www.unrealscript.com
If you want to show an ammo clip for a weapon, the best (and easiest) place to do that would be RenderOverlays(Canvas C) in the weapon class. Look at UT's sniperrifle, I believe it does some stuff when zoomed - just be sure to call Super.RenderOverlays() otherwise the weapon won't be drawn. Oh, and remember to put a simulated in front of you overrided function, otherwise it won't be called for clients.

HOB - the variables you're trying to read apparently aren't replicating to the client, so you'll need to change the replication statement (or write a new one if you haven't done so yet) - check this replication statement from Pawn, it should give you a hint:

// Variables the server should send to the client.
reliable if( Role==ROLE_Authority )
Weapon, PlayerReplicationInfo, Health, bCanFly;
 

HOB

King of the Jungle
Mar 14, 2000
22
0
0
42
CT
www.planetunreal.com
yea, I have a new gamereplicationinfo with the following code:

class BioMassReplicationInfo expands TournamentGameReplicationInfo;

var int InfestationAmount;

replication
{
reliable if ( Role == ROLE_Authority )
InfestationAmount;
}

and I have the new gametype defualt replication info set to the BioMassReplicationInfo, but on all the clients on the HUD it still displays 0%.
but I'm pretty sure it works fine in the new scoreboard though.
it only displays 0% on the client's HUD.