# HG changeset patch # User almikes@aol.com # Date 1418484080 0 # Node ID dd4470df66adbcc4f5d4320899228f89f2ce1db4 # Parent 0dd8a7078412cf6f44254b4627aabc933044d3ce Restructure information about AddTeam, add info that Hedgewars does not support empty teams. diff -r 0dd8a7078412 -r dd4470df66ad LuaAPI.wiki --- a/LuaAPI.wiki Fri Dec 12 00:06:20 2014 +0000 +++ b/LuaAPI.wiki Sat Dec 13 15:21:20 2014 +0000 @@ -6,7 +6,7 @@ Version 0.9.13 of Hedgewars introduced the ability to use Lua scripts to modify Hedgewars behaviour for different maps without having to recompile the whole game. The till then used triggers (only appeared in training maps) were removed. -Lua is an easy to learn scripting language that's implemented using open source libraries. If you'd like to learn more about Lua, have a look at [http://www.lua.org Lua's official homepage]. Even though its easy to learn syntax this wiki page won't explain all basics of using Lua, e.g. declaring variables or using control structures. There are tons of step-by-step tutorials and documentation available on the internet. Just throw "Lua" into your favourite search engine and give it a try. +Lua is an easy to learn scripting language that's implemented using open/v source libraries. If you'd like to learn more about Lua, have a look at [http://www.lua.org Lua's official homepage]. Even though its easy to learn syntax this wiki page won't explain all basics of using Lua, e.g. declaring variables or using control structures. There are tons of step-by-step tutorials and documentation available on the internet. Just throw "Lua" into your favourite search engine and give it a try. How Hedgewars handles Lua scripts As of Version 0.9.13 Hedgewars supports Lua scripts for two similar tasks: Define tutorial missions or provide special map behaviour for precreated maps. @@ -881,13 +881,25 @@ === Clans and teams === ==== !AddTeam(teamname, color, grave, fort, voicepack, flag) ==== -
Adds a new team. Note that this can only be done in `onGameInit`, not at a later time. First argument is the team name followed by color, grave, fort, voicepack and flag settings. -
-Notice: This works only for singleplayer's training missions for now and will desync multiplayer games. Flag setting is dev only. +Adds a new team. Note that this can only be done in `onGameInit`, not at a later time. +You *must* add at least one hedgehog with `AddHog` after calling this. The engine does not support empty teams. + +Arguments: + + * `teamname`: The name of the team. + * `color`: The color of the team, provided as a 3-byte number + * `grave`: The name of the team’s grave (equals file name without the suffix) + * `fort`: The name of the team’s fort + * `voicepack`: The name of the team’s voice pack (equals the directory name) + * `flag`: Optional argument (only in development version at the moment) for the name of the team’s flag (equals file name without the suffix) + +Note: This works only for singleplayer's training missions for now and will desync multiplayer games. Example: - AddTeam("team 1", 0xDD0000, "Simple", "Island", "Default", "hedgewars") +AddTeam("team 1", 0xDD0000, "Simple", "Tank", "Default", "hedgewars") +--[[ Adds a new team with name “team 1”, red color (hexadecimal notation), the grave “Simple”, +the fort “Tank” the voicepack “Default” and the flag “hedgewars”. ]] ==== !DismissTeam(teamname) ==== Removes the team with the given team name from the game.