diff -r a1ff7cf0f55c -r d3bebda2cdfd LuaAPI.wiki --- a/LuaAPI.wiki Tue Jan 01 21:18:45 2019 +0000 +++ b/LuaAPI.wiki Tue Jan 01 21:40:03 2019 +0000 @@ -487,12 +487,35 @@ `botlevel` ranges from `0` to `5`, where `0` denotes a human player and `1` to `5` denote the skill level of a bot, where `1` is strongest and `5` is the weakest. Note that this is the reverse order of how the bot level is displayed in the game. Note that mixing human-controlled and computer-controlled hedgehogs in the same team is not permitted, but it is permitted to use different computer difficulty levels in the same team. -*Warning*: This only works in singleplayer mode (e.g. missions). Also, Hedgewars only supports up to 48 hedgehogs in a game. If you add more hedgehogs or call this function in multiplayer mode, Hedgewars might fail. +Returns the gear ID. + +*Warning*: This only works in singleplayer mode (e.g. missions). Also, Hedgewars only supports up to 64 hedgehogs in a game. Example: local player = AddHog("HH 1", 0, 100, "NoHat") -- botlevel 0 means human player - SetGearPosition(player, 1500, 1000) + SetGearPosition(player, 1500, 1000) + -- hint: If you don't call `SetGearPosition`, the hog spawns randomly + +=== !AddMissionHog(health) (0.9.25) === +Add a hedgehog for the current team, using the player-chosen team identity when playing in singleplayer missions. The “current team” is the last team that was added with `AddMissionTeam` or `AddTeam`. + +The name and hat match the player's team definition. The hog is also always player-controlled. + +-- Add player team with 3 hogs +AddMissionTeam(-1) +AddMissionHog(100) +AddMissionHog(100) +AddMissionHog(100) + +-- You can also mix mission hogs with “hardcoded” hogs. +-- This adds a player team with 2 hogs taken from the player team and 1 hog with a hardcoded name, botlevel and hat. +AddMissionTeam(-2) +AddMissionHog(100) +AddMissionHog(100) +AddHog("My Hardcoded Hog", 0, 100, "NoHat") + + == Functions to get gear properties == === !GetGearType(gearUid) === @@ -1388,6 +1411,21 @@ --[[ 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”. ]] +=== !AddMissionTeam(color) (0.9.25) === +Adds a new team using the player-chosen team identity when playing a singleplayer mission. +Does not work in multiplayer. + +This function is very similar to `AddTeam`. Team settings like name or flag do not need to be specified, they will be taken from the player-chosen team. +You only need to specify the color, which works like in `AddTeam`. + +Use `AddMissionHog` or `AddHog` afterwards to add hedgehogs for this team. You can mix `AddMissionHog` and `AddHog` as you wish. + + * `color`: See `AddTeam`. + +Example: +-- Add mission team with default clan color +AddMissionTeam(-1) + ==== !GetTeamName(teamIdx) (0.9.24) ==== Returns the name of the team with the index `teamIdx`. `teamIdx` is a number between 0 and `TeamsCount-1`.