PDA

View Full Version : WorldInfo.Game.Broadcast not working?



ClassicSpot
10-07-2011, 03:49 PM
I have a custom Gameinfo class, and with that a custom HUD class; naturally my Gameinfo class references my HUD class. Now I have a custom actor that calls 'WorldInfo.Game.Broadcast', but it does nothing. However, if I switch the HUD in my Gameinfo class to the UTHUD that it inherits, I get the broadcast. Can anyone tell me what is needed to add the broadcast functionality to my HUD class? Thank you so much, in the mean time I'll keep searching for an answer. My HUD class:
class DOHUD extends UTHUD;

var class C;
var class<DOPawn> PN;



function DrawBar(String Title, float Value, float MaxValue,int X, int Y, int R, int G, int B) // Create our function used to draw bars
{
local int PosX; //Declare our variable representing our postition on the X-axis
local int BarSizeX; //Declare our variable representing the size of our bar

PosX = X; //Where we should draw the rectangle
BarSizeX = 300 * FMin(Value / MaxValue, 1); // size of active rectangle (change 300 to however big you want your bar to be)

//Displays active rectangle
Canvas.SetPos(PosX,Y);
Canvas.SetDrawColor(R, G, B, 200);
Canvas.DrawRect(BarSizeX, 12);

//Displays empty rectangle
Canvas.SetPos(BarSizeX+X,Y);
Canvas.SetDrawColor(255, 255, 255, 80);
Canvas.DrawRect(300 - BarSizeX, 12); //Change 300 to however big you want your bar to be

//Draw our title
Canvas.SetPos(PosX+300+5, Y); //Change 300 to however big your bar is
Canvas.SetDrawColor(R, G, B, 200);
Canvas.Font = class'Engine'.static.GetSmallFont();
Canvas.DrawText(Title);

}


function DrawGameHud()
{
local DOPlayerController PC;
PC = DOPlayerController(PlayerOwner);


//If player is not dead or spectating... ( you could also use DrawLivingHud() )
if ( !PlayerOwner.IsDead() && !UTPlayerOwner.IsInState('Spectating'))
{
DrawBar("Health:"@PlayerOwner.Pawn.Health$"%",PlayerOwner.Pawn.Health, PlayerOwner.Pawn.HealthMax,20,20,240,20,20); //...draw our health-bar
DrawBar("Total Level:"@PC.Total_Level, PC.Total_Level, PC.Max_Total_Level ,20,40,200,200,200); //...and our level-bar
if ( PC.Total_Level != PC.Max_Total_Level ) //If our player hasn't reached the highest level...
{
DrawBar("XP:"@PC.XP_GatheredTillNext_Total_Level$"/"$PC.XP_RequiredTillNext_Total_Level, PC.XP_GatheredTillNext_Total_Level, PC.XP_RequiredTillNext_Total_Level, 20, 60, 80, 255, 80); //...draw our XP-bar
}

}

if ( !PlayerOwner.IsDead() && !UTPlayerOwner.IsInState('Spectating'))
{
DrawBar("Mining Level:"@PC.Mine_Level, PC.Mine_Level, PC.Max_Mine_Level ,20,80,14,52,52); //...and our Mining-level-bar

if ( PC.Mine_Level != PC.Max_Mine_Level ) //If our player hasn't reached the highest level...
{
DrawBar("Mining XP:"@PC.XP_GatheredTillNext_Mine_Level$"/"$PC.XP_RequiredTillNext_Mine_Level, PC.XP_GatheredTillNext_Mine_Level, PC.XP_RequiredTillNext_Mine_Level, 20,100,14,52,52); //...draw our Mining XP-bar
}
}
}

DefaultProperties
{
}

ffejnosliw
10-07-2011, 06:11 PM
You have to call DisplayConsoleMessages() in your HUD. UTHUD calls it in DrawGameHud() which you have overridden without calling the Super or adding a call to that function.

ClassicSpot
10-07-2011, 11:53 PM
Thank you very much, that worked perfectly, also, thank you so much for the explanation. Thanks, john.