LuaAPI.wiki
changeset 1640 b91b4d97132d
parent 1639 cf681f30877d
child 1641 e3ba8cad19d5
equal deleted inserted replaced
1639:cf681f30877d 1640:b91b4d97132d
  1331 Returns a randomly generated number in the range of 0 to number - 1. This random number uses the game seed, so is synchronised, and thus safe for multiplayer and saved games. Use `GetRandom` for anything that could impact the engine state. For example, a visual gear could simply use Lua’s `math.random`, but adding a regular gear should use `GetRandom`.
  1331 Returns a randomly generated number in the range of 0 to number - 1. This random number uses the game seed, so is synchronised, and thus safe for multiplayer and saved games. Use `GetRandom` for anything that could impact the engine state. For example, a visual gear could simply use Lua’s `math.random`, but adding a regular gear should use `GetRandom`.
  1332 
  1332 
  1333 === Clans and teams ===
  1333 === Clans and teams ===
  1334 ==== <tt>!AddTeam(teamname, color, grave, fort, voicepack, flag)</tt> ====
  1334 ==== <tt>!AddTeam(teamname, color, grave, fort, voicepack, flag)</tt> ====
  1335 
  1335 
  1336 Adds a new team. Note that this can only be done in `onGameInit`, not at a later time.
  1336 Adds a new team.
       
  1337 
       
  1338 You *must* call it only in `onGameInit`.
  1337 You *must* add at least one hedgehog with `AddHog` after calling this. The engine does not support empty teams.
  1339 You *must* add at least one hedgehog with `AddHog` after calling this. The engine does not support empty teams.
  1338 `AddTeam` is only supported for singleplayer missions. You *must not* use this function in multiplayer.
  1340 `AddTeam` is only supported for singleplayer missions. You *must not* call this function in multiplayer.
  1339 
  1341 
  1340 Arguments:
  1342 Arguments:
  1341 
  1343 
  1342  * `teamname`: The name of the team.
  1344  * `teamname`: The name of the team.
  1343  * `color`: Team color, usually a number from -9 to -1 (see below)
  1345  * `color`: Team color, usually a number from -9 to -1 (see below)