bot Info code Question

  • 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.

barnEbiss

Member
Jul 8, 2001
781
0
16
uskaarj.beyondunreal.com
class PUTLHUD extends ChallengeHUD;



simulated function PostRender(canvas Canvas)
{

PUTLSight = PUTLSight (POwner.FindInventoryType(class'PUTLSight'));


simulated function bool TraceIdentify(canvas Canvas)
{
local actor Other;
local vector HitLocation, HitNormal, StartTrace, EndTrace;

StartTrace = PawnOwner.Location;
StartTrace.Z += PawnOwner.BaseEyeHeight;
EndTrace = StartTrace + vector(PawnOwner.ViewRotation) * 1000.0;
Other = Trace(HitLocation, HitNormal, EndTrace, StartTrace, true);

if ( Pawn(Other) != None )
{
if ( Pawn(Other).bIsPlayer && !Other.bHidden )
{
IdentifyTarget = Pawn(Other).PlayerReplicationInfo;
IdentifyFadeTime = 3.0;
}
}
else if ( (Other != None) && SpecialIdentify(Canvas, Other) )
return false;

if ( (IdentifyFadeTime == 0.0) || (IdentifyTarget == None) || IdentifyTarget.bFeigningDeath )
return false;

return true;
}

simulated function bool SpecialIdentify(Canvas Canvas, Actor Other )
{
return false;
}

simulated function SetIDColor( Canvas Canvas, int type )
{
Canvas.DrawColor = GreenColor;
if ( type == 0 )
Canvas.DrawColor.G = 160 * (IdentifyFadeTime / 3.0);
else
Canvas.DrawColor.G = 255 * (IdentifyFadeTime / 3.0);
}

simulated function DrawTwoColorID( canvas Canvas, string TitleString, string ValueString, int YStart )
{
local float XL, YL, XOffset, X1;

Canvas.Style = Style;
Canvas.StrLen(TitleString$": ", XL, YL);
X1 = XL;
Canvas.StrLen(ValueString, XL, YL);
XOffset = Canvas.ClipX/2 - (X1+XL)/2;
Canvas.SetPos(XOffset, YStart);
SetIDColor(Canvas,0);
XOffset += X1;
Canvas.DrawText(TitleString);
Canvas.SetPos(XOffset, YStart);
SetIDColor(Canvas,1);
Canvas.DrawText(ValueString);
Canvas.DrawColor = WhiteColor;
Canvas.Font = MyFonts.GetSmallFont( Canvas.ClipX );
}

simulated function bool DrawIdentifyInfo(canvas Canvas)
{
if ( !TraceIdentify(Canvas))
return false;

if( IdentifyTarget.PlayerName != "" )
{
Canvas.Font = MyFonts.GetBigFont(Canvas.ClipX);
DrawTwoColorID(Canvas,IdentifyName, IdentifyTarget.PlayerName, Canvas.ClipY - 256 * Scale);
}
return true;
}








Ok I found the TraceIdentify code and cut and pasted it into my code and I take it I have to alter it so that it uses the PUTLSight
would it be something like this


TraceIdentify PUTLSight
 

Blödsinn machen

cannon fodder
Dec 4, 2001
68
0
0
Switzerland
dwmade.stormpages.com
Code:
class PUTLHUD extends ChallengeHUD; 

var int LaserSightRange;

simulated function bool TraceIdentify(canvas Canvas)
{
	local actor Other;
	local vector HitLocation, HitNormal, StartTrace, EndTrace;
	local PUTLSight PSight;
	
	PSight = PUTLSight(PlayerOwner.FindInventoryType(class'PUTLSight'));

	StartTrace = PawnOwner.Location;
	StartTrace.Z += PawnOwner.BaseEyeHeight;
	EndTrace = StartTrace + vector(PawnOwner.ViewRotation) * 1000.0;
	Other = Trace(HitLocation, HitNormal, EndTrace, StartTrace, true);

	if ( PSight != None )
	{
		EndTrace = StartTrace + vector(PawnOwner.ViewRotation) * LaserSightRange;
		Other = Trace(HitLocation, HitNormal, EndTrace, StartTrace, True);

		PSight.LD.SetLocation(HitLocation);
		if ( Other.IsA('Pawn') )
		{
			PSight.LD.DrawScale = 0.5;
			PSight.LD.SetDisplayProperties(STY_Translucent, Texture'LaserLock', False, False);
		}
		else
		{
			PSight.LD.DrawScale = PSight.LD.Default.DrawScale;
			PSight.LD.SetDefaultDisplayProperties();
		}
	}
	else
	{
		EndTrace = StartTrace + vector(PawnOwner.ViewRotation) * 1000.0;
		Other = Trace(HitLocation, HitNormal, EndTrace, StartTrace, true);
	}

	if ( Pawn(Other) != None )
	{
		if ( Pawn(Other).bIsPlayer && !Other.bHidden )
		{
			IdentifyTarget = Pawn(Other).PlayerReplicationInfo;
			IdentifyFadeTime = 3.0;
		}
	}
	else if ( (Other != None) && SpecialIdentify(Canvas, Other) )
		return false;

	if ( (IdentifyFadeTime == 0.0) || (IdentifyTarget == None) || IdentifyTarget.bFeigningDeath )
		return false;

	return true;
}

well you can't just copy the code like that. and you should only have to override TraceIdentify. i guess something like above is a basic outline, where LaserSightRange is the distance that your laser sight should "see"... i'm guessing you'd want something like that (though probably that should be defined in the PUTLSight class)

well, i'm still not exactly sure what you're trying to achieve with the trace and being able to use the "Order this Bot" menu item, because anyway the trace in the above code for the PUTLSight is exactly the same trace that the default ChallengeHUD performs.
well, let me know if that wasn't right...