From ZDoom Wiki
Jump to navigation Jump to search

int GetAirSupply (int playernum)


Gives the amount of tics remaining in a player's air supply. This function targets only players since monsters do not have an air supply — drowning is not implemented for them.


  • playernum: Player number. This information can be obtained through PlayerNumber.

Return value

The duration in tics before the player will start to drown. A negative value tells the player is already drowning. Note that a negative value of 0 is possible by coincidence if the script is run at just the right tic, but is also used to mean there are no player for the given number.


This example prints the number of seconds the player has until his or her air supply runs out. It then prints a message warning the player to return for air. Set this script to be executed by Eyes Go Below Surface and Eyes Go Above Surface actors placed in your 'deep water' sectors.

int print_air[8];

script 1 (void)
  print_air[PlayerNumber()] %= 2;
  while (print_air[PlayerNumber()])
    if (GetAirSupply(PlayerNumber()) > 0)
      print(i:GetAirSupply(PlayerNumber()) / 35);
      print(s:"You'd better go up for air!");