Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!

checkclient

From Quake Wiki

Revision as of 14:21, 31 July 2023 by Boondorl (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

entity checkclient()

Usage

When a monster is searching for a valid enemy, this function will handle grabbing a potential target. This uses the PVS to check visible players meaning an actual line of sight won't be guaranteed and should be tested against.

Warning: The function assumes that self is the current entity that's looking for a valid enemy.

Return

A potentially visible player.

Example

// This function tries to find a new enemy for the monster
void FindNewEnemy()
{
    entity newEnemy = checkclient();

    // Check to make sure it's a valid enemy
    if (!newEnemy || newEnemy == self.enemy)
        return;
    if (!visible(newEnemy))
        return;

    // ...
}