>> Of course you can, but the method I used seems cleaner, faster, and less
>> error-prone to me. BTW I forgot to mention in my previous email that if
>> you want to affect only the players in a 600-unit radius, you need to
>> add a distance check just before you do the traceline, so you don't
>> waste time doing tracelines for players that are too far away.
>>
>> ---Reedbeta
> And how in pray tell would that be accomplished? Could you lend an
> example in the SDK for me to haggle over?
If you are using UTIL_FindEntityByClassname() for "player" then you can
subtract the origin of the player and the origin of the entity (grenade)
then use the Length() function on that vector to find the distance...
float distance = (pPlayer->pev->origin - pev->origin).Length();
if (distance < 600.0) // is this player close enough to be effected?
{
// do UTIL_Traceline() to see if they are behind a wall or not...
UTIL_Traceline(...stuff...)
if (tr.flFraction >= 1.0) // did traceline complete?
{
// do damage here
}
}
Jeffrey "botman" Broome
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders