Bitfighter  021
The Bitfighter Lua Documentation - Robots, Levelgens, and Plugins
Team Class Reference

Get information about a team in the current game.

Member Functions

getColor()
 Get the team color.
 
getIndex()
 Get the numerical index of this Team. [details]
 
getName()
 Get the name of the Team. [details]
 
getPlayerCount()
 Get the number of players currently on this team. [details]
 
getPlayers()
 Get a table containing all players on a team. [details]
 
getScore()
 Get the team's current score. [details]
 

Detailed Description

Get information about a team in the current game.

The Team object contains data about each team in a game. You can get a team object from several places, including the GameInfo class.

gameInfo = bf:getGameInfo() -- for a bot; use levelgen:getGameInfo() in a levelgen script
team = gameInfo:getLeadingTeam()

Member Function Documentation

◆ getColor()

returns table

Get the team color.

The team color is a table with 3 values: red, green, blue. These are returned as integers in the range of 0-255

local color = team:getColor()
local red = color[0]
local green = color[1]
local blue = color[2]
table getColor()
Get the team color.
Definition: teamInfo__cpp.h:19
Returns
A table of RGB values for this team's color.

◆ getIndex()

returns int

Get the numerical index of this Team.

Returns
The numerical index of this Team. Note that the first team has an index of 1, and neutral and hostile "teams" will have the index of Team.Neutral and Team.Hostile, respectively.

◆ getName()

returns string

Get the name of the Team.

Returns
The name of the Team

◆ getPlayerCount()

returns int

Get the number of players currently on this team.

Returns
The number of players currently on this team.

◆ getPlayers()

returns table

Get a table containing all players on a team.

local players = team:getPlayers()
for i, v in ipairs(players) do
print(v:getName())
end
table getPlayers()
Get a table containing all players on a team.
Definition: teamInfo__cpp.h:17
string getName()
Get the name of the Team.
Definition: teamInfo__cpp.h:11
Returns
A table of PlayerInfos currently on this team.

◆ getScore()

returns int

Get the team's current score.

Returns
The team's current score.