Numplayers: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
Fox (talk | contribs)
No edit summary
Fox (talk | contribs)
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
numplayers is a gamevar that represents the number of players in the game.
Returns the number of non-bot players in the game.


initially player indexes will go from 0 to numplayers-1 however this no longer holds once a player quits.
In singleplayer, it is set to 1.


This store the number of players in the game.
The non-bot player IDs range from zero to '''numplayers''' minus 1. Meaning bots will always hold the highest IDs.
In singleplayer, it is set to 1.
 
In the original Duke Nukem 3D, once a player quit, '''numplayers''' would decrease permanently, meaning it was impossible for a new player to join mid-game.
 
It can also be used for when making a loop through all non-players. Example:
 
for My_Player range numplayers
{
  [...]
}


[[multimode]] stores the total of player in the game, while '''numplayers''' stores only non-bot players.
While [[MULTIMODE]] stores the total of player in the game, '''numplayers''' stores only non-bot players.


[[Category:Constantly updated gamevars]]
[[Category:Constantly updated gamevars]]

Latest revision as of 05:22, 19 February 2020

Returns the number of non-bot players in the game.

In singleplayer, it is set to 1.

The non-bot player IDs range from zero to numplayers minus 1. Meaning bots will always hold the highest IDs.

In the original Duke Nukem 3D, once a player quit, numplayers would decrease permanently, meaning it was impossible for a new player to join mid-game.

It can also be used for when making a loop through all non-players. Example:

for My_Player range numplayers
{
  [...]
}

While MULTIMODE stores the total of player in the game, numplayers stores only non-bot players.