A_CheckSight

From ZDoom Wiki

Jump to: navigation, search

A_CheckSight (int offset)
A_CheckSight (str state)


Warning: Using state labels as arguments without quotation marks has been deprecated and will no longer work. Make sure to enclose all your string arguments with quotation marks to ensure full compatibility with future ZDoom versions. Refer to the available example(s) for proper usage


Jumps if there is no possible line of sight between the calling actor and any player.

This function does not account for wether or not a player is actually looking at the calling actor or not; as long as there is a possible line of sight (ie 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.

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

Examples

The following actor fades out and disappears from the map once killed, but will not do so until out of sight of all players. Useful for open maps with a high body count, to reduce possible lag.

 actor FadingZombie : Zombieman
 {
   States
   {
   Death:
     POSS H 5
     POSS I 5 A_Scream
     POSS J 5 A_NoBlocking
     POSS K 5
     // intentional fallthrough
   DeathWait:
     POSS L 1 A_CheckSight("DeathFade")
     loop
   DeathFade:
     POSS L 1 A_FadeOut(0.02)
     loop
   XDeath:
     POSS M 5
     POSS N 5 A_XScream
     POSS O 5 A_NoBlocking
     POSS PQRST 5
     // intentional fallthrough
   XDeathWait:
     POSS U 1 A_CheckSight("XDeathFade")
     loop
   XDeathFade:
     POSS U 1 A_FadeOut(0.02)
     loop
   Raise:
     stop    // not fair to have the monster revivable just because it's in LOS
   }
 }
Personal tools