From ZDoom Wiki
Jump to navigation Jump to search

state A_CheckSightOrRange (float distance, int offset [, bool 2d_check])
state A_CheckSightOrRange (float distance, str "state" [, bool 2d_check])

Jumps if the calling actor is beyond distance range from all player pawns and there is no possible line of sight between the center of the calling actor and that of any player pawn. In other words, this function continues to the next state in the sequence if either the sight check or the range check were true; and jumps otherwise.

If 2d_check is true, the z-coordinates are not taken into account when calculating the distance, making the distance check 2D-based instead of being 3D-based. Default is false.

This function does not account for whether or not a player is actually looking at the calling actor or not; as long as there is a possible line of sight (i.e. at least one player is in a position where they could see the calling actor if they faced the right direction), no jump will occur. And on the other hand, the jump might happen even though the actor is partially seen by a player.

Note that like A_CheckSight, A_CheckSightOrRange also counts for actors being viewed through cameras and co-op spy. It does not, however, check if the actor is being viewed through a camera texture.


Nuvolachalk.png Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contributions are greatly appreciated.

See also