LuaAPI.wiki
changeset 890 74b9c19e4b50
parent 885 40aae8355e3e
child 891 d991247c5c05
equal deleted inserted replaced
889:43cb59d498ea 890:74b9c19e4b50
   136 
   136 
   137 === More constants ===
   137 === More constants ===
   138 More constants are at at [GearTypes Gear Types] , [AmmoTypes Ammo Types], [Sounds], [States], [Sprites], [VisualGearTypes Visual Gear Types].
   138 More constants are at at [GearTypes Gear Types] , [AmmoTypes Ammo Types], [Sounds], [States], [Sprites], [VisualGearTypes Visual Gear Types].
   139 
   139 
   140 == Event handlers ==
   140 == Event handlers ==
   141 Lua scripts are supposed to _define_ these functions to do something. The functions are then _called_ by Hedgewars when a certain even has occoured.
   141 Lua scripts are supposed to _define_ these functions to do something. The functions are then _called_ by Hedgewars when a certain event has occoured.
   142 
   142 
   143 === <tt>onGameInit()</tt> ===
   143 === <tt>onGameInit()</tt> ===
   144 This function is called before the game loads its resources. One can read and modify various game variables here. These variables will become globally available after `onGameInit` has been invoked, but changing them has only an effect in `onGameInit`.
   144 This function is called before the game loads its resources. One can read and modify various game variables here. These variables will become globally available after `onGameInit` has been invoked, but changing them has only an effect in `onGameInit`.
   145 Most variables are optional, but for missions, `Theme` must be set by the scripter if you want to use a random map, rather than an image map. All other variables do not need to be set by the scripter and have default values.
   145 Most variables are optional, but for missions, `Theme` must be set by the scripter if you want to use a random map, rather than an image map. All other variables do not need to be set by the scripter and have default values.
   146 
   146 
   170 || `SuddenDeathTurns` || `15` || Turns until Sudden Death begins ||
   170 || `SuddenDeathTurns` || `15` || Turns until Sudden Death begins ||
   171 || `WaterRise` || `47` || Height of water rise in pixels for each Sudden Death turn ||
   171 || `WaterRise` || `47` || Height of water rise in pixels for each Sudden Death turn ||
   172 || `HealthDecrease` || `5` || Amount of health decreased on each turn in Sudden Death ||
   172 || `HealthDecrease` || `5` || Amount of health decreased on each turn in Sudden Death ||
   173 || `Goals` || `""` || Use this to add additional text to the goal text popup shown at the beginning and when using the quit or pause keys. The text is added to the default text which usually explains the game modifiers and does not replace it. Use `|` for line breaks. Also, all text before and including a `:` in a line will be highlighted. See also `ShowMission`. ||
   173 || `Goals` || `""` || Use this to add additional text to the goal text popup shown at the beginning and when using the quit or pause keys. The text is added to the default text which usually explains the game modifiers and does not replace it. Use `|` for line breaks. Also, all text before and including a `:` in a line will be highlighted. See also `ShowMission`. ||
   174 || `ScreenWidth` || _N/A_ || Width of the Hedgewars window or screen ||
   174 || `ScreenWidth` || _N/A_ || Width of the Hedgewars window or screen ||
   175 || `ScreenHeigth` || _N/A_ || Heigth of the Hedgewars window or screen ||
   175 || `ScreenHeight` || _N/A_ || Height of the Hedgewars window or screen ||
   176 
   176 
   177 The proper way to disable Sudden Death is by setting both `WaterRise` and `HealthDecrease` to `0`.
   177 The proper way to disable Sudden Death is by setting both `WaterRise` and `HealthDecrease` to `0`.
   178 
   178 
   179 If you want to add teams or hogs manually, you have to do it here. If you want to draw your own map using `AddPoint` and `FlushPoints`, you have to do this within this function as well.
   179 If you want to add teams or hogs manually, you have to do it here. If you want to draw your own map using `AddPoint` and `FlushPoints`, you have to do this within this function as well.
   180 
   180