LuaGameplay.wiki
changeset 1919 d9cd57b53b6e
parent 1918 6ba186f18a73
child 1937 55255a1feba7
equal deleted inserted replaced
1918:6ba186f18a73 1919:d9cd57b53b6e
   354 
   354 
   355  * `teamname`: The name of the team (might be force-changed)
   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). Since version 1.0.0, you can append “_qau” so Hedgewars will automatically pick the appropriate language version of the voicepack (e.g. instead of “Default”, use “Default_qau”). This is preferred.
   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 
   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>`.
   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>`.
   363 
   363 
   364 ==== Clan color ====
   364 ==== Clan color ====
   376  * `-8`: brown
   376  * `-8`: brown
   377  * `-9`: yellow
   377  * `-9`: yellow
   378 
   378 
   379 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. 
   379 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. 
   380 
   380 
       
   381 ==== Voicepack language ====
       
   382 [Voicepacks] can be localized. A localized voicepack has the language code in its name after an underscore, e.g. “Default_pl” is the Polish version of “Default”. If you specify the exact name in `voicepack`, Hedgewars uses this exact language version. But if you replace the language suffix with `_qau`, Hedgewars will try to pick the appropriate localized version of that voicepack, depending on the user's language, if a localized version exists. If not, Hedgewars will pick the version of the voicepack without a language suffix (which is English, normally).
       
   383 
       
   384 For example, if `voicepack` is set to “Default_qau”, Hedgewars will pick “Default_pl” if the user language is Polish. If the user language is set to a language for which there is no localize version of the Default voicepack, Hedgewars will pick the “Default” voicepack (which is in English).
       
   385 
       
   386 We strongly recommend to always use the “_qau” suffix from version 1.0.0 on, unless you really want to force a particular language.
       
   387 
   381 ==== Example ====
   388 ==== Example ====
   382 
   389 
   383 <code language="lua">AddTeam("team 1", -1, "Simple", "Tank", "Default", "hedgewars")
   390 <code language="lua">AddTeam("team 1", -1, "Simple", "Tank", "Default_qau", "hedgewars")
   384 --[[ Adds a new team with name “team 1”, the first default color (usually red), the grave “Simple”,
   391 --[[ Adds a new team with name “team 1”, the first default color (usually red), the grave “Simple”,
   385 the fort “Tank” the voicepack “Default” and the flag “hedgewars”. ]]</code>
   392 the fort “Tank” the voicepack “Default” (in the appropriate language version) and the flag “hedgewars”. ]]</code>
   386 
   393 
   387 === <tt>!AddMissionTeam(color)</tt> (1.0.0) ===
   394 === <tt>!AddMissionTeam(color)</tt> (1.0.0) ===
   388 Adds a new team using the player-chosen team identity when playing a singleplayer mission. Does not work in multiplayer.
   395 Adds a new team using the player-chosen team identity when playing a singleplayer mission. Does not work in multiplayer.
   389 
   396 
   390 This function is very similar to `AddTeam`. Team settings like team name and flag will be taken from the player-chosen team.
   397 This function is very similar to `AddTeam`. Team settings like team name and flag will be taken from the player-chosen team.