PDA

View Full Version : Ok easy one...


Brood_of_Evil
3rd Nov 2001, 01:57 AM
...for you guys anyways.

Well my question is simple:
I want to search for actors with "foreach blah blah blah" and verify which ones of these actors are closer to me. That's all, thanks in adavce.

Wormbo
3rd Nov 2001, 03:07 AM
Please be more specific.
What kind of actors? (pawns, projectiles, anything)
Is there a certain maximum distance or do you want to search on the whole map?
Should the actors be visible to your reference point?

There are several ForEach iterators and for pawns you could even use a For loop.

Brood_of_Evil
3rd Nov 2001, 03:11 AM
I will use forach AllActors, there's not minimum or maximum distance, the actor is a projectile. I am familiar with how the forach iterators work, I just want to figure out which one of the actors I'm looping thorough is closer to me, which I am owner off.

Wormbo
3rd Nov 2001, 03:28 AM
In this case you should compare VSize(Your.Location - theProjectile.Location):
foreach allactors(<you know whats in here>) {
if ( minDist > VSize(Your.Location - theProjectile.Location) ) {
minDist = VSize(Your.Location - theProjectile.Location);
minDistProjectile = theProjectile;
}
}
(Or something like that.:) )

Brood_of_Evil
3rd Nov 2001, 03:32 AM
Thanks I will try that :)