HUDMutators... Whose HUD is this?

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Shiit

Shiit
Dec 19, 2000
168
0
0
I have need to modify a HUD with a mutator, but I stumbled upon a problem. The only variable passed to the PostRender function is the canvas you get to draw on, and I need to know which player it belongs to. Is there any way to find out?
Also, I need to remove the weapons bar+ammo icon from the HUD for all players (even in a Net-game). Is this possible?
 

Shiit

Shiit
Dec 19, 2000
168
0
0
I hadn't even thought of that, but it doesn't work. Canvas is not a subclass of Actor, so it doesn't have an Owner variable. :(

BTW, I just realized that it probably won't be necessary to use the mutators Postrender() function, as I might be able to use the weapon's. I'll see into it.

(EDIT) Cool, it works! Thanks for your time anyway :)
 
Last edited:

Brood_of_Evil

Selene's martyr
Nov 3, 2001
147
0
0
45
Look outside your window!
Visit site
It's funny because until yesterday I had the same problem. I needed a reference to a Pawn object in the same function, to compare it with the instigator of a projectile..anyways, what I did was do an foreach AllActors iteration, the look for each pawn's inventory looking for the weapon that is supposed to spawn such projectile, if they had the weapon, then I would compare it the weapon instigator was the same as the owner of the weapon...it worked well for me, but until now I didn't knew there was a reference for an actor object in canvas...I do know there is such a variable in ChallengeHUD, but this was not the case. Anyways it's always good to learn new things.
 

Brood_of_Evil

Selene's martyr
Nov 3, 2001
147
0
0
45
Look outside your window!
Visit site
Btw, is it really possible to implement PostRender in anything other than a HUD class or a mutator, I'm using it inside a mutator, but I want to implement it in a projectile class. If it's possible, how can I receive post render calls within this class?
 

Shiit

Shiit
Dec 19, 2000
168
0
0
Lots of classes have a postrender function, but I don't know if you can just add one. It might be worth a try to just add a "simulated event PostRender(canvas C)" to the class, but I don't know if it'll work. If that doesn't work you'll have to make a workaround to have the weapon that fires the projectiles call it once for each projectile. (That's only a bit more complicated than what the Redeemer does with the red readouts to the left in remote-control-mode)
 

usaar33

Un1337
Mar 25, 2000
808
0
0
Unknown
www.UsAaR33.com
postrender is called on the playerpawn and console.
The playerpawn calls it on the HUD.
The HUD (if certain conditions are met) will call postrender() on the owner's weapon and any hudmutators.
The console will render uwindows if needed.
 

Shiit

Shiit
Dec 19, 2000
168
0
0
Check out this function:
native(466) final function DrawTile( texture Tex, float XL, float YL, float U, float V, float UL, float VL );
In here, Tex is the graphic that has the bar, XL and YL are the size on-screen, U and V are the top-left coördinates of the tile you want to draw (on Tex, that is) and UL and VL is the size of the tile on Tex.
So, if you made a 256*256 texture that has the vertical bar in the top left corner, you'd want to do this:

DrawTile( Texture'Somepackage.Sometexture', 8, 128*(Length of bar), 0,0, 8, 128 );

I hope that clears things up.
 

Shiit

Shiit
Dec 19, 2000
168
0
0
I found the function description in the Canvas class (<--subclass of Object). The example was just something logical I thought up, but you can find lots of similar code in the ChallengeHUD class. I'm currently using a PC that I don't use for Uscripting, so I can't really give you the exact location of good example code.
 

Lemoni

The Philosapher
Feb 17, 2001
628
0
0
members.lycos.co.uk
Originally posted by Shiit
I found the function description in the Canvas class (<--subclass of Object). The example was just something logical I thought up, but you can find lots of similar code in the ChallengeHUD class. I'm currently using a PC that I don't use for Uscripting, so I can't really give you the exact location of good example code.
cool if any one interested hears the bit in challange hud class
// Draw Ammo bar
Canvas.CurX = WeaponX;
Canvas.CurY = BaseY + 52 * WeapScale;
Canvas.DrawColor = BaseColor;
AmmoScale = FClamp(88.0 * WeapScale * WeaponSlot.AmmoType.AmmoAmount/WeaponSlot.AmmoType.MaxAmmo, 0, 88);
Canvas.DrawTile(Texture'BotPack.HudElements1', AmmoScale, 8 * WeapScale,64,64,128.0,8.0);
}
}
}
}
 

Silver_Ibex

Member
Feb 27, 2001
654
0
16
I need the code for a simple HUD mutator

Nothing fancy :D
Just code for two bar graphs, one on the right side of the screen and one on the left, nothing else.

Left hand side bar graph needs to be red, will represent characters health from 0 to 199.

Right side bar graph needs to be blue and will be set to a new character attribute “Energy” it also needs to be able to display a 0 to 199 value.

Thought I would ask here, as it seems similar to what you are talking about.
 

Shiit

Shiit
Dec 19, 2000
168
0
0
That's very easy. You should be able to figure it out yourself by looking at the ChallengeHUD (I did, and it took me only a few minutes). Create a subclass of the good ol' ChallengeHUD and put a new PostRender. Just don't forget to call Super.Postrender!
If you want I might be able to write a short tutorial on info bars (it'd be my first! yay!), but not today, it's getting kinda late.
 

Silver_Ibex

Member
Feb 27, 2001
654
0
16
Yes a tutorial is always a good thing :cool: especially for those like me who are not yet well versed in U-script.

I will try to get around to modifying the HUD for myself with the above info, though right now I’m unsuccessfully messing with the Relic mutator classes.