LuaAPI.wiki
changeset 1159 ed6441e7ff84
parent 1158 8d62ba66e7b0
child 1165 7438c7dfeff6
equal deleted inserted replaced
1158:8d62ba66e7b0 1159:ed6441e7ff84
   434 
   434 
   435 === <tt>!AddHog(hogname, botlevel, health, hat)</tt> ===
   435 === <tt>!AddHog(hogname, botlevel, health, hat)</tt> ===
   436 Adds a new hedgehog for current team (last created one with the `AddTeam` function), with bot level and specified health, also hat.
   436 Adds a new hedgehog for current team (last created one with the `AddTeam` function), with bot level and specified health, also hat.
   437 `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.
   437 `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.
   438 
   438 
   439 *Warning*: This works only for singleplayers training missions for now and will desync multiplayer games.
   439 *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.
   440 
   440 
   441 Example:
   441 Example:
   442 
   442 
   443 <code language="lua">    local player = AddHog("HH 1", 0, 100, "NoHat") -- botlevel 0 means human player
   443 <code language="lua">    local player = AddHog("HH 1", 0, 100, "NoHat") -- botlevel 0 means human player
   444     SetGearPosition(player, 1500, 1000)</code>
   444     SetGearPosition(player, 1500, 1000)</code>