LuaGuide.wiki
changeset 896 ff2bb096e079
parent 895 9db173fcf26e
child 897 c3ce54152c05
equal deleted inserted replaced
895:9db173fcf26e 896:ff2bb096e079
     9 A Lua script is used to make the game behave different by giving the Hedgewars engine different commands. The script gets called by the engine on different events and the script tells the engine what to do.
     9 A Lua script is used to make the game behave different by giving the Hedgewars engine different commands. The script gets called by the engine on different events and the script tells the engine what to do.
    10 Lua is a programming language, and you must first learn some basics about the Lua programming language to get started. See [http://www.lua.org/] to learn more.
    10 Lua is a programming language, and you must first learn some basics about the Lua programming language to get started. See [http://www.lua.org/] to learn more.
    11 
    11 
    12 == The basic structure ==
    12 == The basic structure ==
    13 
    13 
    14 Dependent on what type of script you want to write the requirements are a bit different, but before we go into that we must first create the `.lua` file.
    14 Dependent on what type of script you want to write the requirements are a bit different, but before we go into that we must first create the `.lua` file. The location of the file depends on the script type.
    15 
    15 
    16 If you want to make a mission for multi player you create a map and create a new file `map.lua` in the map's folder.
    16 * If you want to make a mission for multi player you create a map and create a new file `map.lua` in the map's folder.
       
    17 * If you want to make a training mission then you create a new `.lua` file under `Data/Missions/Training` folder.
       
    18 * Campaign missions go into `Data/Missions/Campaign/<CAMPAIGN NAME>`.
       
    19 * If you want to make a custom game style like Highlander, create a new `.lua` file in `Data/Scripts/Multiplayer`.
    17 
    20 
    18 If you want to make a training mission then you create a new `.lua` file under `Data/Missions/Training` folder. Campaign missions go into `Data/Missions/Training`.
    21 To get started, a `.lua` file should generally be structured like this:
    19 
       
    20 If you want to make a custom game style like Highlander, create a new `.lua` file in `Data/Scripts/Multiplayer`.
       
    21 
       
    22 To get started, the `.lua` file should be structured like this:
       
    23 {{{
    22 {{{
    24 function onGameInit()
    23 function onGameInit()
    25 end
    24 end
    26 
    25 
    27 function onAmmoStoreInit()
    26 function onAmmoStoreInit()