News UnrealEd Files Mods FragBU Liandri Archives
BeyondUnreal Forums

Go Back   BeyondUnreal Forums > Unreal Development > Coding

Reply
 
Thread Tools Display Modes
Old 19th Jul 2004, 09:32 AM   #1
Bustakheops
Registered User
 
Join Date: Dec. 30th, 2002
Posts: 3
Radar & health.

hello !
I have make a radar which see the players and i don't know how i can to do for see items (for exemple Minihealth or adrenaline).
For players the line is :
Code:
foreach DynamicActors(class'Pawn',P)
but i don't know for item....
Thx

Last edited by Mychaeel; 19th Jul 2004 at 09:50 AM. Reason: use [code] instead of [color]
Bustakheops is offline   Reply With Quote
Old 19th Jul 2004, 09:52 AM   #2
Mychaeel
 
Join Date: Oct. 3rd, 2001
Location: Frankfurt/Main, Germany
Posts: 3,829
Go to Unreal Wiki: UnrealScript Source, download the UT2004 UnrealScript sources and a class browser (linked from there too) and have a look at the class tree -- the pickup items are all listed below the Pickup class.
Mychaeel is offline   Reply With Quote
Old 19th Jul 2004, 10:52 AM   #3
Bustakheops
Registered User
 
Join Date: Dec. 30th, 2002
Posts: 3
i have already unreal 2k4 Source , but the problem i don't know what i have to write for an item ....I now for a player it's Foreach but i don't know for an item . plz help me :s
Bustakheops is offline   Reply With Quote
Old 19th Jul 2004, 11:01 AM   #4
Darknigh+
Registered User
 
Join Date: Oct. 19th, 2003
Posts: 113
You could loop though all the NavigationPoints and see if which ones are inventoryspots and which ones are PathNodes.

It would be something like this:

Code:
local NavigaiontPoint N;

for(N = Level.NavigationPointList; N != None; N= N.NextNavigationPoint)
{
    /*
    if the nav point is an invetory item
    You would also want to check the distance or something else as well   
    here, because this is going to give you every InventorySpot on the map.
    */
   
    if(N.IsA('InventorySpot'))
  {
       //do whatever

  }

}
Also just an FYI: You may want to look at the NavigationPoint class and its subclasses,also the InventorySpot class which is a subclass of SmallNavigationPoint.

Last edited by Darknigh+; 19th Jul 2004 at 11:04 AM.
Darknigh+ is offline   Reply With Quote
Old 19th Jul 2004, 11:37 AM   #5
Bustakheops
Registered User
 
Join Date: Dec. 30th, 2002
Posts: 3
Thx for you answer but i have pb ... that's my code before (from Hudinvasion) :
Code:
simulated function ShowTeamScorePassC(Canvas C)
{
	local Pawn P;
	local float Dist, MaxDist, RadarWidth, PulseBrightness,Angle,DotSize,OffsetY,OffsetScale;
	local rotator Dir;
	local vector Start;
	
	LastDrawRadar = Level.TimeSeconds;
	RadarWidth = 0.5 * RadarScale * C.ClipX;
	DotSize = 24*C.ClipX*HUDScale/1600;
	if ( PawnOwner == None )
		Start = PlayerOwner.Location;
	else
		Start = PawnOwner.Location;
	
	MaxDist = 3000 * RadarPulse;
	C.Style = ERenderStyle.STY_Translucent;
	OffsetY = RadarPosY + RadarWidth/C.ClipY;
	MinEnemyDist = 3000;
	ForEach DynamicActors(class'Pawn',P)
		if ( P.Health > 0 )
		{
			Dist = VSize(Start - P.Location);
			if ( Dist < 3000 )
			{
				if ( Dist < MaxDist )
					PulseBrightness = 255 - 255*Abs(Dist*0.00033 - RadarPulse);
				else
					PulseBrightness = 255 - 255*Abs(Dist*0.00033 - RadarPulse - 1);
				if ( Monster(P) != None )
				{
					MinEnemyDist = FMin(MinEnemyDist, Dist);
					C.DrawColor.R = PulseBrightness;
					C.DrawColor.G = PulseBrightness;
					C.DrawColor.B = 0;
				}
				else
				{
					C.DrawColor.R = 0;
					C.DrawColor.G = 0;
					C.DrawColor.B = PulseBrightness;
				}
				Dir = rotator(P.Location - Start);
				OffsetScale = RadarScale*Dist*0.000167;
				Angle = ((Dir.Yaw - PlayerOwner.Rotation.Yaw) & 65535) * 6.2832/65536;
				C.SetPos(RadarPosX * C.ClipX + OffsetScale * C.ClipX * sin(Angle) - 0.5*DotSize,
						OffsetY * C.ClipY - OffsetScale * C.ClipX * cos(Angle) - 0.5*DotSize);
				C.DrawTile(Material'InterfaceContent.Hud.SkinA',DotSize,DotSize,838,238,144,144);
			}
		}			
}
and after you post :
Code:
simulated function ShowTeamScorePassC(Canvas C)
{
	local Pawn P;
	local float Dist, MaxDist, RadarWidth, PulseBrightness,Angle,DotSize,OffsetY,OffsetScale;
	local rotator Dir;
	local vector Start;
	local NavigationtPoint N; //

	LastDrawRadar = Level.TimeSeconds;
	RadarWidth = 0.5 * RadarScale * C.ClipX;
	DotSize = 24*C.ClipX*HUDScale/1600;
	if ( PawnOwner == None )
		Start = PlayerOwner.Location;
	else
		Start = PawnOwner.Location;

	MaxDist = 3000 * RadarPulse;
	C.Style = ERenderStyle.STY_Translucent;
	OffsetY = RadarPosY + RadarWidth/C.ClipY;
	MinEnemyDist = 3000;
	for(N = Level.NavigationPointList; N != None; N= N.NextNavigationPoint)
{
    /*
    if the nav point is an invetory item
    You would also want to check the distance or something else as well
    here, because this is going to give you every InventorySpot on the map.
    */

    if(N.IsA('InventorySpot'))
  {
  	if ( Dist < MaxDist )
					PulseBrightness = 255 - 255*Abs(Dist*0.00033 - RadarPulse);
				else
					PulseBrightness = 255 - 255*Abs(Dist*0.00033 - RadarPulse - 1);
				if ( Adrenaline(A) != None )   // if ( Monster(P) != None )
				{
//					MinEnemyDist = FMin(MinEnemyDist, Dist);
					C.DrawColor.R = PulseBrightness;
					C.DrawColor.G = PulseBrightness;
					C.DrawColor.B = 0;
				}

  }
but there is an error :
Error, Unrecognized type 'NavigationtPoint'

And i think it s not the only error :'(
If someone can help me ...
Bustakheops is offline   Reply With Quote
Old 19th Jul 2004, 11:49 AM   #6
Mychaeel
 
Join Date: Oct. 3rd, 2001
Location: Frankfurt/Main, Germany
Posts: 3,829
Quote:
Originally Posted by Bustakheops
but there is an error :
Error, Unrecognized type 'NavigationtPoint'
Typo.
Mychaeel is offline   Reply With Quote
Old 19th Jul 2004, 10:20 PM   #7
[SAS]Solid Snake
Registered User
 
[SAS]Solid Snake's Avatar
 
Join Date: Jun. 7th, 2002
Location: New Zealand
Posts: 2,633
Quote:
For players the line is : foreach DynamicActors(class'Pawn',P)
but i don't know for item....
What Mychaeel was saying in the post after this, is probably indicating that you don't actually understand what the foreach dynamicactors is actually doing, in which case you should have read up on it. To make life a little easier, I'll post what it does syntax wise.

Basically foreach will iterate through every actor within the level, and dynamicactors makes the list if valid actors shorter (You ideally do not want to sort through the entire list of actors at any given time, unless for initialization reasons). The syntax then follows as class and then variable. The class variable will then seed out the list of actors who class match the class you have given, and then references it into the variable you have put in. Thus to do it for inventory items you could do,
Code:
local Inventory I;
foreach dynamicactors(class'Inventory',I);
__________________
I make the impossible possible ... ... ... to some extent.

Digital Confectioners
[SAS]Solid Snake is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 11:30 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.

Copyright ©1998 - 2012, BeyondUnreal, Inc.
Privacy Policy | Terms of Use
Bandwidth provided by AtomicGamer