equal
deleted
inserted
replaced
65 === <tt>onGameInit()</tt> === |
65 === <tt>onGameInit()</tt> === |
66 |
66 |
67 <blockquote>This function is called before the game loads its resources. One can modify various game variables here: |
67 <blockquote>This function is called before the game loads its resources. One can modify various game variables here: |
68 </blockquote> |
68 </blockquote> |
69 * <tt>Seed = 0</tt> - sets the seed of the random number generator |
69 * <tt>Seed = 0</tt> - sets the seed of the random number generator |
70 * <tt>!EnableGameFlags(gfSolidLand, gfArtillery)</tt> - sets the !GameFlags (just 2 of them in this example), see above for the available flags |
70 * <tt>!EnableGameFlags(gfSolidLand, gfArtillery)</tt> - sets the !GameFlags (just 2 of them in this example), see above for the available flags/ |
71 * <tt>!TurnTime = 60000</tt> - set the turntime in ms |
71 * <tt>!TurnTime = 60000</tt> - set the turntime in ms |
72 * <tt>!CaseFreq = 0</tt> - frequency of crate drops |
72 * <tt>!CaseFreq = 0</tt> - frequency of crate drops |
73 * <tt>!HealthCaseProb = 35</tt> - chance of receiving a health crate |
73 * <tt>!HealthCaseProb = 35</tt> - chance of receiving a health crate |
74 * <tt>!HealthCaseAmount = 25</tt> - amount of health in a health crate |
74 * <tt>!HealthCaseAmount = 25</tt> - amount of health in a health crate |
75 * <tt>!DamagePercent = 100</tt> - percent of damage to inforce |
75 * <tt>!DamagePercent = 100</tt> - percent of damage to inforce |
636 <code lang="lua"> |
636 <code lang="lua"> |
637 AddAmmo(CurrentHedgehog, amBazooka, 1) -- give the CurrentHedgehog a bazooka |
637 AddAmmo(CurrentHedgehog, amBazooka, 1) -- give the CurrentHedgehog a bazooka |
638 SetWeapon(amBazooka) -- select the Bazooka.</code> |
638 SetWeapon(amBazooka) -- select the Bazooka.</code> |
639 </blockquote> |
639 </blockquote> |
640 |
640 |
641 ==== <tt>!SetNextWeapon()</tt> (0.9.21) ==== |
641 === <tt>!SetNextWeapon()</tt> (0.9.21) === |
642 This function makes the current hedgehog switch to the next weapon in list of available weapons. It can be used for example in trainings to pre-select a weapon. |
642 This function makes the current hedgehog switch to the next weapon in list of available weapons. It can be used for example in trainings to pre-select a weapon. |
643 |
643 |
644 |
644 |
645 === <tt>!SetHogHat(gearUid, hat)</tt> === |
645 === <tt>!SetHogHat(gearUid, hat)</tt> === |
646 |
646 |
781 |
781 |
782 ==== <tt>!GetInputMask()</tt> ==== |
782 ==== <tt>!GetInputMask()</tt> ==== |
783 |
783 |
784 Returns the current input mask of the player. |
784 Returns the current input mask of the player. |
785 |
785 |
786 ==== |
|
787 |
|
788 === Randomness === |
786 === Randomness === |
789 ==== <tt>!GetRandom(number)</tt> ==== |
787 ==== <tt>!GetRandom(number)</tt> ==== |
790 |
788 |
791 <blockquote>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 can use the Lua random, but adding a regular gear should use GetRandom. |
789 <blockquote>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 can use the Lua random, but adding a regular gear should use GetRandom. |
792 </blockquote> |
790 </blockquote> |
844 |
842 |
845 <blockquote>Plays the specified sound. |
843 <blockquote>Plays the specified sound. |
846 </blockquote> |
844 </blockquote> |
847 |
845 |
848 === <tt>!PlaySound(soundId, gearUid)</tt> === |
846 === <tt>!PlaySound(soundId, gearUid)</tt> === |
849 |
847 / |
850 <blockquote>Plays the specified sound for the chosen hedgehog's team. |
848 <blockquote>Plays the specified sound for the chosen hedgehog's team. |
851 </blockquote> |
849 </blockquote> |
852 |
850 |
853 |
851 |
854 == File system functions == |
852 == File system functions == |
855 === <tt>HedgewarsScriptLoad(scriptPath)</tt> === |
853 === <tt>!HedgewarsScriptLoad(scriptPath)</tt> === |
856 Loads a script (i.e. a [LuaLibraries library]) from the specified `scriptPath`. The root directory is here Hedgewars’ data directory. |
854 Loads a script (i.e. a [LuaLibraries library]) from the specified `scriptPath`. The root directory is here Hedgewars’ data directory. |
857 |
855 |
858 Example: |
856 Example: |
859 {{{ |
857 {{{ |
860 HedgewarsScriptLoad("/Scripts/Locale.lua") -- loads locale library |
858 HedgewarsScriptLoad("/Scripts/Locale.lua") -- loads locale library |