LuaAPI.wiki
changeset 1638 0322ae59b027
parent 1637 e747c0c6bf26
child 1639 cf681f30877d
equal deleted inserted replaced
1637:e747c0c6bf26 1638:0322ae59b027
  1337 You *must* add at least one hedgehog with `AddHog` after calling this. The engine does not support empty teams.
  1337 You *must* add at least one hedgehog with `AddHog` after calling this. The engine does not support empty teams.
  1338 
  1338 
  1339 Arguments:
  1339 Arguments:
  1340 
  1340 
  1341  * `teamname`: The name of the team.
  1341  * `teamname`: The name of the team.
  1342  * `color`: The RGB color of the team as defined in [LuaAPI#Color]
  1342  * `color`: Team color, usually a number from -9 to -1 (see below)
  1343  * `grave`: The name of the team’s grave (equals file name without the suffix)
  1343  * `grave`: The name of the team’s grave (equals file name without the suffix)
  1344  * `fort`: The name of the team’s fort (equals file name without the suffix and without the letter “L” or “R” before that suffix)
  1344  * `fort`: The name of the team’s fort (equals file name without the suffix and without the letter “L” or “R” before that suffix)
  1345  * `voicepack`: The name of the team’s voice pack (equals the directory name)
  1345  * `voicepack`: The name of the team’s voice pack (equals the directory name)
  1346  * `flag`: Optional argument for the name of the team’s flag (equals file name without the suffix). If set to `nil`, the flag “hedgewars” is used.
  1346  * `flag`: Optional argument for the name of the team’s flag (equals file name without the suffix). If set to `nil`, the flag “hedgewars” is used.
  1347 
  1347 
  1348 *Note*: This works only for singleplayer training missions for now and will desync multiplayer games.
  1348 *Note*: This works only for singleplayer training missions for now and will desync multiplayer games.
  1349 
  1349 
  1350 Example:
  1350 ===== Clan color =====
  1351 
  1351 Each team must have a color. The color also determines clan membership: Teams with equal color are in the same clan.
  1352 <code language="lua">AddTeam("team 1", 0xDD0000, "Simple", "Tank", "Default", "hedgewars")
  1352 
  1353 --[[ Adds a new team with name “team 1”, red color (hexadecimal notation), the grave “Simple”,
  1353 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:
       
  1354 
       
  1355  * `-1`: red
       
  1356  * `-2`: blue
       
  1357  * `-3`: cyan
       
  1358  * `-4`: purple
       
  1359  * `-5`: magenta
       
  1360  * `-6`: green
       
  1361  * `-7`: orange
       
  1362  * `-8`: brown
       
  1363  * `-9`: yellow
       
  1364 
       
  1365 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. 
       
  1366 
       
  1367 ===== Example =====
       
  1368 
       
  1369 <code language="lua">AddTeam("team 1", -1, "Simple", "Tank", "Default", "hedgewars")
       
  1370 --[[ Adds a new team with name “team 1”, the first default color (usually red), the grave “Simple”,
  1354 the fort “Tank” the voicepack “Default” and the flag “hedgewars”. ]]</code>
  1371 the fort “Tank” the voicepack “Default” and the flag “hedgewars”. ]]</code>
  1355 
  1372 
  1356 ==== <tt>!GetTeamName(teamIdx)</tt> (0.9.24) ====
  1373 ==== <tt>!GetTeamName(teamIdx)</tt> (0.9.24) ====
  1357 Returns the name of the team with the index `teamIdx`. `teamIdx` is a number between 0 and `TeamsCount-1`.
  1374 Returns the name of the team with the index `teamIdx`. `teamIdx` is a number between 0 and `TeamsCount-1`.
  1358 
  1375