GetAirSupply
int GetAirSupply (int playernum)
Usage
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.
Parameters
- 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.
Examples
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()]++; print_air[PlayerNumber()] %= 2; while (print_air[PlayerNumber()]) { if (GetAirSupply(PlayerNumber()) > 0) print(i:GetAirSupply(PlayerNumber()) / 35); else print(s:"You'd better go up for air!"); delay(1); } }