PDA

View Full Version : Does Someone Know Where I Can Find This Code?



elgourmet
11-25-2007, 09:09 AM
hi again :)
i'm looking for the code that displays the nametags of your teammates in team death match, ctf, etc.
what i would like to do is to create a mutator that shows the nametags of your opponents. so i guess/hope this shouldnt be a great effort, since the nearly finished code has to exist somewhere. but where? does someone have a tip?
i've looked in

...ExportedScript\UTGame\Classes\UTHUD

which includes a lot of code for the ingame hud. but i couldnt find it in there.
maybe some experienced ut modders know where to find it. would be great! :)
thanks in advance! :)

Wormbo
11-25-2007, 09:45 AM
This part unfortunately resides in the UTPawn and UTVehicle classes (function PostRenderFor), so you can't change it without creating a subclass of the UTPawn and every vehicle class.

elgourmet
11-25-2007, 10:07 AM
oh ok thank you. but creating a subclass isnt that hard, is it?
i think i found the code which is responsible for rendering the nametags:


class'UTHUD'.Static.GetTeamColor( GetTeamNum(), TeamColor, TextColor);

Dist = VSize(CameraPosition - Location);
if ( Dist < TeamBeaconPlayerInfoMaxDist )
{
ScreenName = PlayerReplicationInfo.GetPlayerAlias();
Canvas.StrLen(ScreenName, TextXL, YL);
XL = Max( TextXL, 24 * Canvas.ClipX/1024 * (1 + 2*Square((TeamBeaconPlayerInfoMaxDist-Dist)/TeamBeaconPlayerInfoMaxDist)));
}
else
{
XL = Canvas.ClipX * 16 * TeamBeaconPlayerInfoMaxDist/(Dist * 1024);
YL = 0;
}

Class'UTHUD'.static.DrawBackground(ScreenLoc.X-0.7*XL,ScreenLoc.Y-1.8*YL,1.4*XL,1.9*YL, TeamColor, Canvas);

if ( (PRI != None) && (Dist < TeamBeaconPlayerInfoMaxDist) )
{
Canvas.DrawColor = TextColor;
Canvas.SetPos(ScreenLoc.X-0.5*TextXL,ScreenLoc.Y-1.2*YL);
Canvas.DrawTextClipped(ScreenName, true);
}

looks like if TeamBeaconPlayerMaxDist is the key?! maybe i gotta change this to something like opponentbeacon oder just playerbeacon....
wormbo: do you know if there is a similar mutator for ut2004? or were the playernames there by default?

elgourmet
11-25-2007, 10:28 AM
maybe someone could show me how to create the mutator for ONE vehicle or the utpawn file? i would gladly do the rest of the work if i know how... :-/

<RfdS>GAFFA
11-27-2007, 01:45 PM
i cant believe your questioning wormbo :D

Wormbo
11-28-2007, 08:08 AM
I hope you realize that your mod would be incompatible to any custom vehicle and any mod using custom pawn classes for various reasons.

BTW: The part that prevents opponent names from showing up is "if ( !WorldInfo.GRI.OnSameTeam(self, PC) )" and nothing else. In other words, the GameReplicationInfo (a gametype-specific actor you definitely should stay away from in a mutator) determines, whether the player name is supposed to be rendered at all.

Generally, if something is gametype-specific (this includes the GRI, as well as pawn classes), "mutator ethics" prohibit replacing these things. If you ignore this guideline, you risk breaking other gametypes than the ones you considered or other gametypes breaking your mutator. Either way is frowned upon by serveradmins and players.

elgourmet
12-02-2007, 02:49 PM
yes, i realize that.
so are you saying that removing this line
"if ( !WorldInfo.GRI.OnSameTeam(self, PC) )"
should do what i want? gonna try that out now :)

KewlAzMe
01-04-2008, 01:10 PM
Well I guess the main question then is ... is there a "Safe" way to do this? Or is it just not possible?

What's the best way to give additional "abilities" to pawns without subclassing them? For example, if I wanted to make a mutator that gave Pawns the ability to pickup a physics object and throw it.