PDA

View Full Version : Adding Mutator Data to Hud


lofantasy
21st Oct 2001, 02:30 AM
greets, i am curious on how to add info to the hud. ive seen some tutorials on how to do it. but they were very out dated. (v400 or less). i am pretty new to the scripting but im slowly understanding it. right now i have a simple mod an would like to put some numbers on the hud. right above the frags icon. any help would be great =)
an any links to tutorials would be great also =)

ShadowWalker

2COOL4-U
21st Oct 2001, 05:45 AM
call the mutator function RegisterHUDMutator() and you'll get postrender calls for your mutator.

Just add this to your code and place all the drawing with the canvas in it:

simulated event PostRender( canvas Canvas )
{
}

ca
21st Oct 2001, 01:34 PM
If you're using a weapon class as part of your mutator package you could also use the RenderOverlays function... :)

lofantasy
21st Oct 2001, 02:48 PM
thanks for that info. an right now hte mod just adds health to your pawn when u shoot someone. so its not a big one like a gun (im not that good).
an for the RegisterHUDMutator, do i just put that in teh function that adds the health, or above it. an the postRender, that just has to be in the script it self to be called?

Papapishu
21st Oct 2001, 06:02 PM
if you check in the mutator class you'll get it.
You call the RegisterHUDMutator function when the class is spawned like in postbeginplay:

function postbeginplay()
{
RegisterHUDMutator();
}

then you have the postrender function enabled:

simulated function PostRender( canvas Canvas )
{
(do your drawing here)
}

There are many ways to do this, check them out in canvas.uc

(Extracting code, if you havent done it yet (http://luna.vovoid.com/~zerda/ut/tuts/extracting_code.html))

ca
21st Oct 2001, 09:03 PM
What are you trying to do? If you just want to send a message to the client you can just use ClientMessage() instead of dealing with making your mutator a HUD mutator. You can also make a subclass of UT's message class (CriticalEventPlus, etc) to pop up a message similar to the kill and spree messages - "You killed Bob!". Could make your mutator a bit simpler if this is all you are looking ot do, of course if you wanted to draw some textures or have a permanent message on the HUD you'll have to hook in.

Hope I didn't confuse the matter too much. :)

lofantasy
21st Oct 2001, 09:10 PM
u didnt confuse me any (not yet that is). an i dont really want to make it msg the person. im just trying to add text to the hud right above the Rank ?/? part. im slowly getting there. but that is what im tryin to do right now =)

eXoR
22nd Oct 2001, 08:26 AM
Originally posted by papapishu
function postbeginplay()
{
RegisterHUDMutator();
}

In my experience that doesn't always do the job, so I always add this as well:

Function Tick (float Deltatime)
{
Super.Tick(DeltaTime);

if (!bHudMutator)
RegisterHUDMutator();
}

lofantasy
22nd Oct 2001, 08:59 PM
thanks for all the help. im slowly getting to where i wanted to be =)
an BTW chimeric, on your tutorials, it would be good to put what is needed in the .int for us newbies (not agian =\) for the script to work. im sure its in the normal UT code. but its hard to find it when ur not sure what ur looking for. aside from that. the tutorials are good =)