View Full Version : How do you make a new HUD?
4th Sep 2001, 04:59 PM
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?
4th Sep 2001, 06:37 PM
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;
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.
5th Sep 2001, 04:47 AM
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.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.
5th Sep 2001, 05:59 AM
Thank you people. :D
You know that machine gun I coded, well I'm too busy making it and trying to get it in game.
But once I've done that, I'll have a go at the HUD and if it works I'll post the code here. :D
5th Sep 2001, 06:46 AM
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 : firstname.lastname@example.org
5th Sep 2001, 09:54 AM
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.:o
5th Sep 2001, 11:29 AM
me repeats precisely what TaoPaiPai said.
5th Sep 2001, 12:21 PM
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 :)
5th Sep 2001, 05:57 PM
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.
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;
6th Sep 2001, 01:09 AM
yea, I have a new gamereplicationinfo with the following code:
class BioMassReplicationInfo expands TournamentGameReplicationInfo;
var int InfestationAmount;
reliable if ( Role == ROLE_Authority )
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.
vBulletin® v3.8.7, Copyright ©2000-2014, vBulletin Solutions, Inc.