# HG changeset patch # User Wuzzy # Date 1543881155 0 # Node ID 0322ae59b02760467666d50d5510c6328856a285 # Parent e747c0c6bf2655517b4a43c3d8eed184b61d324b LuaAPI: Update AddTeam diff -r e747c0c6bf26 -r 0322ae59b027 LuaAPI.wiki --- a/LuaAPI.wiki Mon Dec 03 23:09:07 2018 +0000 +++ b/LuaAPI.wiki Mon Dec 03 23:52:35 2018 +0000 @@ -1339,7 +1339,7 @@ Arguments: * `teamname`: The name of the team. - * `color`: The RGB color of the team as defined in [LuaAPI#Color] + * `color`: Team color, usually a number from -9 to -1 (see below) * `grave`: The name of the team’s grave (equals file name without the suffix) * `fort`: The name of the team’s fort (equals file name without the suffix and without the letter “L” or “R” before that suffix) * `voicepack`: The name of the team’s voice pack (equals the directory name) @@ -1347,10 +1347,27 @@ *Note*: This works only for singleplayer training missions for now and will desync multiplayer games. -Example: +===== Clan color ===== +Each team must have a color. The color also determines clan membership: Teams with equal color are in the same clan. + +The team color is specified as a number from -9 to -1. This will select one of the 9 possible team colors as specified in the player's settings. As the actual colors are set by the player, you can't predict them, but you can usually trust these defaults: -AddTeam("team 1", 0xDD0000, "Simple", "Tank", "Default", "hedgewars") ---[[ Adds a new team with name “team 1”, red color (hexadecimal notation), the grave “Simple”, + * `-1`: red + * `-2`: blue + * `-3`: cyan + * `-4`: purple + * `-5`: magenta + * `-6`: green + * `-7`: orange + * `-8`: brown + * `-9`: yellow + +An older (and now discouraged) method of specifying the color is by hardcoding it as an RGB color (i.e. `0xDD0000`). This practice is now strongly discouraged because it will ignore the player-chosen color (which is *bad* for players with color blindness) and in 99% of cases you don't need it anyway. It should be only used for testing and debugging. + +===== Example ===== + +AddTeam("team 1", -1, "Simple", "Tank", "Default", "hedgewars") +--[[ Adds a new team with name “team 1”, the first default color (usually red), the grave “Simple”, the fort “Tank” the voicepack “Default” and the flag “hedgewars”. ]] ==== !GetTeamName(teamIdx) (0.9.24) ====