So, I've been exploring multiple options for this but the main idea is that any potential targets nearby meeting certain criteria will be marked with an icon from the perspective of the player. I got the criteria part down, and I'm using RadiusActors. The actual problem is drawing the icons.
Never seen many examples of this in games, and the one that does similar (Klingon Honor Guard) has a rather awkward implementation.
Any ideas?
For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com
Markers on targets
-
Martin Vole
- OldUnreal Member
- Posts: 23
- Joined: Thu Dec 07, 2017 3:45 am
Markers on targets
Last edited by Martin Vole on Sun Mar 31, 2019 11:07 pm, edited 1 time in total.
-
gopostal
- OldUnreal Member
- Posts: 1007
- Joined: Thu Jul 31, 2008 9:29 pm
Re: Markers on targets
This is an old video but the code works really well. Other HUD overlays tend to slide around when you view from a high/low Z angle but this stays very stuck to the tagged actor:
If you want the code let me know. It's pretty easy to add it to your mod and replace the health script with an icon or whatever. The original code was wormbo's mod for team icons (used with permission). I've seen a lot of attempts at icons attached to actors via the HUD but this method is by far the most solid.
I hope it's what you need.
If you want the code let me know. It's pretty easy to add it to your mod and replace the health script with an icon or whatever. The original code was wormbo's mod for team icons (used with permission). I've seen a lot of attempts at icons attached to actors via the HUD but this method is by far the most solid.
I hope it's what you need.
I don't want to give the end away
but we're all going to die one day
but we're all going to die one day
-
[]KAOS[]Casey
- OldUnreal Member
- Posts: 4497
- Joined: Sun Aug 07, 2011 4:22 am
- Location: over there
Re: Markers on targets
This code is easily untouched and older than a decade, but gets the job done. Note this is meant to display other (real) players locations in a coop server.
this is a section from an UnrealHUD subclass
this is a section from an UnrealHUD subclass
Code: Select all
simulated function PostRender( canvas Canvas )
{
Super.PostRender(Canvas);
if ( PlayerPawn(Owner)!=None && !PlayerPawn(Owner).bShowMenu && !PlayerPawn(Owner).bShowScores )
drawindicator(canvas);
}
function drawindicator(canvas canvas)
{
local Pawn P;
local float X, Y,XL,YL;
local bool bOnScreen;
local vector worldPosition;
local Actor A;
local pawn pawnowner;
Canvas.Font = Font'SmallFont';
Canvas.ClipX+=500;
Canvas.DrawColor.R = 255;
Canvas.DrawColor.B = 255;
Canvas.DrawColor.G = 255;
Canvas.Style = 3;
ForEach VisibleCollidingActors(class'Pawn',P,5000,ViewPos)
{
if( P==Owner || P.PlayerReplicationInfo==None ) Continue;
worldPosition = P.Location;
worldPosition.Z += P.CollisionHeight;
bOnScreen = WorldToScreen(worldPosition, Pawn(Owner),ViewPos,ViewRot, Canvas.ClipX-500, Canvas.ClipY, X, Y);
if (bOnScreen && X > 0 && X < (Canvas.ClipX-500) && Y > 0 && Y < Canvas.ClipY)
{
Canvas.DrawColor.B = 255;
Canvas.DrawColor.R = 255;
Canvas.DrawColor.G = 255;
Canvas.SetPos(X - 32, Y - 32);
Canvas.DrawIcon(Texture'Indicator',0.5);
if( P.PlayerReplicationInfo!=None && P.PlayerReplicationInfo.IsA('kPlayerReplicationInfo') )
{
Canvas.Font = Font'medFont';
if( kPlayerReplicationInfo(P.PlayerReplicationInfo).bIsAdmin )
Canvas.DrawColor = kPlayerReplicationInfo(P.PlayerReplicationInfo).AdminColor;
else
{
Canvas.DrawColor.B = 200;
Canvas.DrawColor.R = 200;
}
Canvas.TextSize(P.PlayerReplicationInfo.PlayerName,XL,YL);
Canvas.SetPos(X - XL/2, Y - 32 - YL);
Canvas.DrawText(P.PlayerReplicationInfo.PlayerName,False);
}
}
}
Canvas.DrawColor.B = 255;
Canvas.DrawColor.R = 255;
Canvas.DrawColor.G = 255;
Canvas.ClipX-=500;
}
simulated static function bool WorldToScreen(Vector WorldLocation, Pawn ThePlayer, vector EyePos, rotator ScreenRot,
float ScreenWidth, float ScreenHeight, out float X, out float Y)
{
local vector RelativeToPlayer;
local float Scale;
RelativeToPlayer = (WorldLocation - EyePos)
Last edited by []KAOS[]Casey on Mon Apr 01, 2019 7:05 am, edited 1 time in total.
-
Bleeder91[NL]
- OldUnreal Member
- Posts: 1062
- Joined: Sun Oct 04, 2009 7:22 pm
-
Martin Vole
- OldUnreal Member
- Posts: 23
- Joined: Thu Dec 07, 2017 3:45 am
Re: Markers on targets
Using 227 here, but I do got a bit of something simple working now:
This is before the target scrutinizing code.
Code: Select all
simulated event PostRender(Canvas C)
{
local Pawn P;
local bool bOnScreen;
local vector worldPosition;
local vector HudLoc;
local float Dummy;
C.Style = ERenderStyle.STY_Translucent;
ForEach VisibleCollidingActors(class'Pawn',P,2000,, true)
{
worldPosition = P.Location;
HudLoc = C.WorldToScreen(worldPosition,Dummy);
if( HudLoc.Z>0 )
{
C.SetPos(HudLoc.X - 8, HudLoc.Y - 16);
C.DrawIcon(Texture'hudteeth',1);
}
}
}
Last edited by Martin Vole on Mon Apr 01, 2019 10:20 am, edited 1 time in total.