Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Beginner basics requested here, While i'm familiar with the basics of OOP programming i've just started looking as UnrealScript for a game i had made in the UDK editor up to now.

I have a class that extends UTHUD and another that extends UDKPAWN. I have the pawn destroyed when its been shot 3 times and some basic helloworld text displaying in my HUD but i'm completely lost as to how one would get some sort of feedback between the two classes going on?

What i would like to do to start off, is have some text that says something like "Amount of baddies killed: 0" Displayed on the HUD which would then increment each time the player destroyed one of my pawns.

I'm sorry if this is an inappropriate question but i've never really worked within a framework like this before and wasn't sure where to go for help to get my footing. All advice appreciated!

share|improve this question

1 Answer 1

up vote 0 down vote accepted

First i created my own class that extended UTPlayerReplicationInfo and had a variable baddiesKilled.

Then in my game type class i added this line to default properties:

PlayerReplicationInfoClass = class'myPlayerReplicationInfo'

Then in the HUD class:

function DrawGameHud()
{
local myPlayerReplicationInfo PRI;

PRI = myPlayerReplicationInfo(PawnOwner.PlayerReplicationInfo);

Canvas.SetPos(Canvas.ClipX/2,Canvas.ClipY/6);
Canvas.SetDrawColor(255,60,210,255);
Canvas.Font = class'Engine'.static.GetLargeFont();
Canvas.DrawText("Baddies Killed=" + PRI.baddiesKilled);

}

Hope someone finds this useful.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.