LuaGameplay.wiki
changeset 1779 9cb32a3519ee
parent 1778 4d4a119f1340
child 1794 7b07726d12f3
equal deleted inserted replaced
1778:4d4a119f1340 1779:9cb32a3519ee
   338 
   338 
   339 Internally, this tries to spawn a `gtSwitcher` gear which, as long it exists, handles the hog switching. You can delete this gear to stop the hog switching prematurely. If there already is a `gtSwitcher` gear, no additional gear is spawned.
   339 Internally, this tries to spawn a `gtSwitcher` gear which, as long it exists, handles the hog switching. You can delete this gear to stop the hog switching prematurely. If there already is a `gtSwitcher` gear, no additional gear is spawned.
   340 
   340 
   341 On success, returns the `gtSwitcher` gear being spawned or, if hog switching mode is already active, returns the exsting gear. On failure, returns `nil`.
   341 On success, returns the `gtSwitcher` gear being spawned or, if hog switching mode is already active, returns the exsting gear. On failure, returns `nil`.
   342 
   342 
   343 == Randomness ==
       
   344 === <tt>!GetRandom(number)</tt> ===
       
   345 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`.
       
   346 
       
   347 == Clans and teams ==
   343 == Clans and teams ==
   348 === <tt>!AddTeam(teamname, color, grave, fort, voicepack, flag)</tt> ===
   344 === <tt>!AddTeam(teamname, color, grave, fort, voicepack, flag)</tt> ===
   349 
   345 
   350 Adds a new team.
   346 Adds a new team.
   351 
   347 
   444 Stores the value `value` (a string) into the mission variable `varname` (also a string). A mission variable is like a campaign variable, but it applies for singleplayer missions only (Training/Challenge/Scenario), excluding campaign missions.
   440 Stores the value `value` (a string) into the mission variable `varname` (also a string). A mission variable is like a campaign variable, but it applies for singleplayer missions only (Training/Challenge/Scenario), excluding campaign missions.
   445 
   441 
   446 === <tt>!GetMissionVar(varname)</tt> (0.9.25) ===
   442 === <tt>!GetMissionVar(varname)</tt> (0.9.25) ===
   447 Returns the value of the mission variable `varname` as a string. See also `SaveMissionVar`.
   443 Returns the value of the mission variable `varname` as a string. See also `SaveMissionVar`.
   448 
   444 
       
   445 == Randomness ==
       
   446 === <tt>!GetRandom(number)</tt> ===
       
   447 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`.