Page 1 of 1
Name of weapons in color
Posted: Sun Nov 02, 2003 12:38 am
by bebertc
Hello, i'm scripting for ut2k3 and I have a problem: I can't find the part of the code which tells to the game which color applying for the name of the weapons (when I play with hidden weapons), like "assault rifle" in pink, "rocket launcher" in red, "bio rifle" in blue...
Can someone help me, please?
Posted: Sun Nov 02, 2003 12:45 am
by Shuri
I do not know this for sure, but it looks like it. In the base weapon class (like AssaultRifle.uc in this example, in defaultproperties:
Code: Select all
HudColor=(r=255,g=128,b=192,a=255)
Hope this helps.
Posted: Sun Nov 02, 2003 8:47 am
by bebertc
Thanks Shuriken, that's what I was searching for.
Bye
Posted: Sun Nov 02, 2003 10:19 am
by bebertc
I tried to change Hudcolor, but it doesnt change the color of weapons' name, and hudcolor doesn't match with the color of each weapon3...

Posted: Sun Nov 02, 2003 3:17 pm
by jb
The HUDColor Is used by the base hud to change the weapon name:
Code: Select all
simulated function DrawWeaponName(Canvas C)
{
local string CurWeaponName;
local float XL,YL, Fade;
if (bHideWeaponName)
return;
if (WeaponDrawTimer>Level.TimeSeconds)
{
C.Font = GetMediumFontFor(C);
C.DrawColor = WeaponDrawColor;
Fade = WeaponDrawTimer - Level.TimeSeconds;
if (Fade<=1)
C.DrawColor.A = 255 * Fade;
C.Strlen(LastWeaponName,XL,YL);
C.SetPos( (C.ClipX/2) - (XL/2), C.ClipY*0.8-YL);
C.DrawText(LastWeaponName);
}
if ( PawnOwner==None || PawnOwner.PendingWeapon==None )
return;
CurWeaponName = PawnOwner.PendingWeapon.GetHumanReadableName();
if (CurWeaponName!=LastWeaponName)
{
WeaponDrawTimer = Level.TimeSeconds+1.5;
WeaponDrawColor = PawnOwner.PendingWeapon.HudColor;
}
LastWeaponName = CurWeaponName;
}
So changing the weapon's hudcolor should work...if its not post the code and we can try to see if we can help more.
Posted: Sun Nov 02, 2003 7:10 pm
by bebertc
it works when I change the value directly in the game code, but is it possible to change the hudcolor from the user.ini?
Posted: Sun Nov 02, 2003 7:26 pm
by jb
Dont think so...you can change the crosshair color but thats about it AFAIK
Posted: Sun Nov 02, 2003 8:52 pm
by bebertc
It's working with user.ini...but there another problem: how to execute a console command from user.ini?