# HG changeset patch # User Wuzzy # Date 1525691263 -3600 # Node ID a76bfb278ad92fea20a585b19b9f8a759a3ef654 # Parent 8832f69b198f2d0e00c292951444ab070d9cba3d LuaGuide: mission types diff -r 8832f69b198f -r a76bfb278ad9 LuaGuide.wiki --- a/LuaGuide.wiki Fri May 04 14:25:07 2018 +0100 +++ b/LuaGuide.wiki Mon May 07 12:07:43 2018 +0100 @@ -9,14 +9,30 @@ 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. 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. +== Lua in Hedgewars == +Version 0.9.13 of Hedgewars introduced the ability to use Lua scripts to modify Hedgewars behaviour for different maps. The use of Lua scripts has been extended since then. + +Now, Lua scripts are used for: + +* [Missions], one of three types: + * Training: Easy missions which explain the game, like a tutorial + * Challenge: Missions in which the goal is to reach a high score + * Scenario: Missions with a pre-set goal, like collecting a crate or killing all enemies +* Mission maps (e.g. TrophyRace) +* Styles (e.g. Highlander, Balanced Random Weapon) +* Campaigns + == The basic structure == 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. - * 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. - * 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/Campaign/`. - * If you want to make a custom game style like Highlander, create a new `.lua` file in `Data/Scripts/Multiplayer`. + * If you want to make a mission for multi player (also called a “mission map”) you create a map and create a new file `map.lua` in the map's folder. + * If you want to make a mission then you create a new `.lua` in one of three directories, depending on the type: + * Training: `Data/Missions/Training` + * Challenge: `Data/Missions/Challenge` + * Scenario: `Data/Missions/Scenario` + * If you want to make a custom game style, create a new `.lua` file in `Data/Scripts/Multiplayer`. + * Campaign missions go into `Data/Missions/Campaign/`. To get started, a `.lua` file should generally be structured like this: {{{