![]() |
|
|
#1 |
|
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) ![]() Thx
Last edited by Mychaeel; 19th Jul 2004 at 09:50 AM. Reason: use [code] instead of [color] |
|
|
|
|
|
#2 |
|
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.
|
|
|
|
|
|
#3 |
|
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
|
|
|
|
|
|
#4 |
|
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
}
}
Last edited by Darknigh+; 19th Jul 2004 at 11:04 AM. |
|
|
|
|
|
#5 |
|
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);
}
}
}
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;
}
}
Error, Unrecognized type 'NavigationtPoint' And i think it s not the only error :'( If someone can help me ...
|
|
|
|
|
|
#6 | |
|
Join Date: Oct. 3rd, 2001
Location: Frankfurt/Main, Germany
Posts: 3,829
|
Quote:
|
|
|
|
|
|
|
#7 | |
|
Quote:
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); |
||
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|