LuaGameplay.wiki
changeset 1917 962f362690be
parent 1907 806491e9ef60
child 1918 6ba186f18a73
equal deleted inserted replaced
1916:a604b1f25dad 1917:962f362690be
   350 You *must* add at least one hedgehog with `AddHog` after calling this. The engine does not support empty teams.
   350 You *must* add at least one hedgehog with `AddHog` after calling this. The engine does not support empty teams.
   351 `AddTeam` is only supported for singleplayer missions. You *must not* call this function in multiplayer.
   351 `AddTeam` is only supported for singleplayer missions. You *must not* call this function in multiplayer.
   352 
   352 
   353 Arguments:
   353 Arguments:
   354 
   354 
   355  * `teamname`: The name of the team.
   355  * `teamname`: The name of the team (might be force-changed)
   356  * `color`: Team color, usually a number from -9 to -1 (see below)
   356  * `color`: Team color, usually a number from -9 to -1 (see below)
   357  * `grave`: The name of the team’s grave (equals file name without the suffix)
   357  * `grave`: The name of the team’s grave (equals file name without the suffix)
   358  * `fort`: The name of the team’s fort (equals file name without the suffix and without the letter “L” or “R” before that suffix)
   358  * `fort`: The name of the team’s fort (equals file name without the suffix and without the letter “L” or “R” before that suffix)
   359  * `voicepack`: The name of the team’s voice pack (equals the directory name)
   359  * `voicepack`: The name of the team’s voice pack (equals the directory name)
   360  * `flag`: Optional argument for the name of the team’s flag (equals the file name case-sensitively without the suffix). If set to `nil` or the flag can not be found on the local computer, the flag “hedgewars” is used.
   360  * `flag`: Optional argument for the name of the team’s flag (equals the file name case-sensitively without the suffix). If set to `nil` or the flag can not be found on the local computer, the flag “hedgewars” is used.
       
   361 
       
   362 Since version 1.0.0, the team name might be force-changed in case of a naming collision. Since version 1.0.0, this function returns two values: `<real team name>, <team index>`. For functions that need the team name as input (lke `DismissTeam`), you must use this returned `<real team name>`.
   361 
   363 
   362 ==== Clan color ====
   364 ==== Clan color ====
   363 Each team must have a color. The color also determines clan membership: Teams with equal color are in the same clan.
   365 Each team must have a color. The color also determines clan membership: Teams with equal color are in the same clan.
   364 
   366 
   365 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:
   367 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:
   380 
   382 
   381 <code language="lua">AddTeam("team 1", -1, "Simple", "Tank", "Default", "hedgewars")
   383 <code language="lua">AddTeam("team 1", -1, "Simple", "Tank", "Default", "hedgewars")
   382 --[[ Adds a new team with name “team 1”, the first default color (usually red), the grave “Simple”,
   384 --[[ Adds a new team with name “team 1”, the first default color (usually red), the grave “Simple”,
   383 the fort “Tank” the voicepack “Default” and the flag “hedgewars”. ]]</code>
   385 the fort “Tank” the voicepack “Default” and the flag “hedgewars”. ]]</code>
   384 
   386 
   385 === <tt>!AddMissionTeam(color)</tt> (0.9.25) ===
   387 === <tt>!AddMissionTeam(color)</tt> (1.0.0) ===
   386 Adds a new team using the player-chosen team identity when playing a singleplayer mission. Does not work in multiplayer.
   388 Adds a new team using the player-chosen team identity when playing a singleplayer mission. Does not work in multiplayer.
   387 
   389 
   388 This function is very similar to `AddTeam`. Team settings like team name and flag will be taken from the player-chosen team.
   390 This function is very similar to `AddTeam`. Team settings like team name and flag will be taken from the player-chosen team.
   389 You only need to specify the clan color, which has the same meaning as in `AddTeam`.
   391 You only need to specify the clan color, which has the same meaning as in `AddTeam`.
       
   392 
       
   393 This function returns two values: `<real team name>, <team index>`. For functions that need the team name as input (lke `DismissTeam`), you must use this returned `<real team name>`.
   390 
   394 
   391 Use `AddMissionHog` or `AddHog` afterwards to add hedgehogs for this team. You can mix `AddMissionHog` and `AddHog` as you wish.
   395 Use `AddMissionHog` or `AddHog` afterwards to add hedgehogs for this team. You can mix `AddMissionHog` and `AddHog` as you wish.
   392 
   396 
   393 Example:
   397 Example:
   394 <code language="lua">-- Add mission team with default clan color
   398 <code language="lua">-- Add mission team with default clan color