1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. 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.

Radar & health.

Discussion in 'Programming' started by Bustakheops, Jul 19, 2004.

  1. Bustakheops

    Bustakheops New Member

    Joined:
    Dec 30, 2002
    Messages:
    3
    Likes Received:
    0
    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 :D
     
    Last edited by a moderator: Jul 19, 2004
  2. Mychaeel

    Mychaeel New Member

    Joined:
    Oct 3, 2001
    Messages:
    3,830
    Likes Received:
    0
    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.
     
  3. Bustakheops

    Bustakheops New Member

    Joined:
    Dec 30, 2002
    Messages:
    3
    Likes Received:
    0
    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
     
  4. Darknigh+

    Darknigh+ New Member

    Joined:
    Oct 19, 2003
    Messages:
    113
    Likes Received:
    0
    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: Jul 19, 2004
  5. Bustakheops

    Bustakheops New Member

    Joined:
    Dec 30, 2002
    Messages:
    3
    Likes Received:
    0
    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 ... :)
     
  6. Mychaeel

    Mychaeel New Member

    Joined:
    Oct 3, 2001
    Messages:
    3,830
    Likes Received:
    0
    Typo.
     
  7. [SAS]Solid Snake

    [SAS]Solid Snake New Member

    Joined:
    Jun 7, 2002
    Messages:
    2,633
    Likes Received:
    0
    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);
     

Share This Page