PDA

View Full Version : Stupid head. Stupid HUD.


WheatPuppet
31st Jul 2003, 09:28 PM
Okay, I've been on and off this board more times than I can count over the past five years. I always was up to something else other than UnrealScript, so I never was too serious about it. Anyway, I've started yet another foray into UScript, and I've forgotten most of what I figured out last time. I'm trying to, in the original Unreal Tournament (I'm too lazy and broke to get 2k3), get the Chimeric floating actor tips to work. I know they don't work as advertised, but I just want to get them to work...

I'm running into trouble when registering the mutator. I've forgotten how to register HUD mutators, so I have no idea if I'm doing it right.

I'm also having trouble with getting the fonts and such to print to the screen, I keep getting errors. Here's the problematic code:


// Here's my initialization. I have no idea if it's correct or not.
// It's close. I think.
var bool initialized;

function postBeginPlay () {
if(initialized) return;
initialized = true;
RegisterHUDMutator();
}

// SNIP
// ...
// SNIP

simulated function DrawActorTip(Canvas Canvas)
{
local Actor FocusedActor;
local vector ScreenPos;

// Find Target
FocusedActor = GetFocusedActor();

// Label Target
if (FocusedActor != None)
{
Canvas.DrawColor = WhiteColor;
// I've seen this in other code, but it doesn't seem to work for me.

Canvas.Style = ERenderStyle.STY_Translucent;
Canvas.Font = MyFonts.GetSmallFont( Canvas.ClipX );
// This, too, I've seen in other code and doesn't work here.

ScreenPos = MapToScreen(FocusedActor.Location, Canvas);
Canvas.SetPos(Screenpos.x, Screenpos.y);
Canvas.DrawText(FocusedActor.Name);
}
}