LuaLibrarySimpleMission.wiki
author Wuzzy
Thu, 14 Nov 2019 16:02:49 +0000
changeset 2103 612f6f103787
parent 1933 458e9d8b4875
permissions -rw-r--r--
LuaLibraryAnimate: add newline
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1378
e03e8e186faa LuaLibrarySimpleMission: summary improvement
Wuzzy
parents: 1357
diff changeset
     1
#summary Lua library documentation of !SimpleMission; for creating simple missions
1354
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
     2
#labels !LuaLibrary
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
     3
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
     4
= Lua library: `SimpleMission` =
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
     5
This is a simple library intended to make setting up simple missions an easy task for Lua scripters. The entire game logic and coding is abstracted away in a single function which you just need to feed a large definition table in which you define gears, goals, etc.
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
     6
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
     7
This is ideal for missions in which you set up the entire scenario from the start and don't need any complex in-mission events. BUT! This is *not* suited for missions with scripted events, cut-scenes, branching story, etc.
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
     8
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
     9
This library has the following features:
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    10
 * Add teams, clans, hogs
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    11
 * Spawn gears
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    12
 * Sensible defaults for almost everything
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    13
 * Set custom goals or use the default one (kill all enemies)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    14
 * Add non-goals to fail the mission
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    15
 * Checks victory and failure automatically
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    16
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    17
To use this library, you first have to load it and to call `SimpleMission` once with the appropriate parameters.
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    18
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    19
== `SimpleMission(params)` ==
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    20
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    21
This function sets up the *entire* mission and needs one argument: params. The argument `params` is a table containing fields which describe the mission.
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    22
1357
7cdf5df9dfc1 LuaLibrarySimpleMission: table
Wuzzy
parents: 1356
diff changeset
    23
This is the definition of the `params` table:
1356
47ae63ffa3d5 LuaLibrarySimpleMission: Links
Wuzzy
parents: 1355
diff changeset
    24
1355
17fe62f4b3de LuaLibrarySimpleMission: formatting
Wuzzy
parents: 1354
diff changeset
    25
<code>
1933
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    26
Mandatory fields:
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    27
- teams:		Table of teams. There must be 1-8 teams.
1354
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    28
1933
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    29
Optional fields
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    30
- ammoConfig		Table containing basic ammo values (default: infinite skip only)
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    31
- initVars		Table where you set up environment parameters such as MinesNum.
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    32
- wind			If set, the wind will permanently set to this value (-100..100). Implies gfDisableWind
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    33
- gears:		Table of objects.
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    34
- girders		Table of girders
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    35
- rubbers		Table of rubbers
1354
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    36
1933
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    37
AMMO
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    38
- ammoType		ammo type
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    39
- delay			delay (default: 0)
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    40
- numberInCrate		ammo per crate (default: 1)
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    41
- count			default starter ammo for everyone, 9 for infinite (default: 0)
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    42
- probability		probability in crates (default: 0)
1354
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    43
1933
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    44
TEAM DATA
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    45
- isMissionTeam		if true, this is the player's chosen team for this mission (default: false)
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    46
- hogs			table of hedgehogs in this team (must contain at least 1 hog)
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    47
- clanID		ID of the clan to which this team belongs to. Counting starts at 0.
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    48
			By default, each team goes into its own clan.
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    49
			Important: The clan of the player and allies MUST be 0.
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    50
			Important: You MUST either set the clan ID explicitly for all teams or none of them.
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    51
These arguments will be ignored if this is a mission team:
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    52
- name			team name
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    53
- flag			flag name (default: hedgewars)
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    54
- grave			grave name (has default grave for each team)
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    55
- fort			fort name (default: Castle)
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    56
- voice			voicepack (default: Default_qau)
1354
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    57
1933
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    58
HEDGEHOG DATA:
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    59
- id			optional identifier for goals
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    60
- health		hog health (default: 100)
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    61
- ammo			table of ammo types
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    62
- x, y			hog position (default: spawns randomly on land)
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    63
- poisoned		if true, hedgehog starts poisoned with 5 poison damage. Set to a number for other poison damage (default: false)
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    64
- frozen		if true, hedgehogs starts frozen (default: false)
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    65
- faceLeft		initial facing direction. true=left, false=false (default: false)
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    66
These arguments will be ignored if the hog is in a mission team:
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    67
- name			hog name
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    68
- botLevel		1-5: Bot level (lower=stronger). 0=human player (default: 0)
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    69
- hat			hat name (default: NoHat)
1354
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    70
1933
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    71
GEAR TYPES:
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    72
- type			gear type
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    73
ALL types:
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    74
	id		optional identifier for goals
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    75
	x		x coordinate of starting position (default: 0)
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    76
	y		y coordinate of starting position (default: 0)
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    77
	dx		initial x speed (default: 0)
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    78
	dy		initial y speed (default: 0)
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    79
- type=gtMine		Mine
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    80
	timer 		Mine timer (only for non-duds). Default: MinesTime
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    81
	isDud		Whether the mine is a dud. default: false
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    82
	isFrozen	Whether the mine is frozen. If true, it implies being a dud as well. Default: false
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    83
	health 		Initial health of dud mines. Has no effect if isDud=false. Default: 36
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    84
- type=gtSMine		Sticky mine
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    85
	timer		Timer. Default: 500
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    86
- type=gtAirMine	Air mine
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    87
	timer		Timer. Default: (MinesTime/1000 * 250)
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    88
- type=gtExplosives	Barrel
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    89
	health		Initial health. Default: 60
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    90
	isFrozen	Whether the barrel is frozen. Default: true with health > 60, false otherwise
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    91
	isRolling	Whether the barrel starts in “rolling” state. Default: false
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    92
- type=gtCase		Crate
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    93
	crateType	"health": Health crate
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    94
			"supply": Ammo or utility crate (select crate type automatically)
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    95
			"supply_ammo_explicit": Ammo crate (not recommened)
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    96
			"supply_utility_explicit": Utility crate (not recommededn)
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    97
	ammoType	Contained ammo (only for ammo and utility crates).
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    98
	health		Contained health (only for health crates). Default: HealthCaseAmount
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
    99
	isFrozen	Whether the crate is frozen. Default: false
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   100
- type=gtKnife		Cleaver
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   101
- type=gtTarget		Target
1354
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   102
1933
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   103
GOALS:
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   104
Note: If there are at least two opposing teams, a default goal is used, which is to defeat all the enemies of the
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   105
player's team. If this is what you want, you can skip this section.
1354
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   106
1933
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   107
The default goal is overwritten as if customGoals has been set. Set customGoals and other related parameters for
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   108
defining your own special goals. In this case, the mission is won if all customGoals are completed.
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   109
Note the mission will always fail if the player's hedgehogs and all their allies have been defeated.
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   110
If there is only one team (for the player), there is no default goal and one must be set explicitly.
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   111
- customGoals		Table of custom goals (see below). All of them must be met to win. Some goal types might fail,
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   112
			rendering the mission unwinnable and leading to the loss of the mission. An example is
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   113
			blowing up a crate which you should have collected.ed.
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   114
- customNonGoals	Table of non-goals, the player loses if one of them is achieved
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   115
- customGoalCheck	When to check goals and non-goals. Values: "instant" (default), "turnStart", "turnEnd"
1932
15edba44c050 LuaLibrarySimpleMission: Update 1.0.0
Wuzzy
parents: 1824
diff changeset
   116
1933
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   117
- missionTitle:		The name of the mission (highly recommended)
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   118
- missionIcon:		Icon of the mission panel, see documentation of ShowMission in the Lua API
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   119
- goalText:		A short string explaining the goal of the mission (use this if you set custom goals).
1354
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   120
1933
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   121
GOAL TYPES:
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   122
- type			name of goal type
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   123
- failText		Optional. For non-goals, this text will be shown in the stats if mission fails due to this non-goal
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   124
			being completed. For goals which fail, this text will be displayed at failure. Note that
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   125
			all normal goals have sensible default fail texts.
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   126
- type="destroy"	Gear must be destroyed
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   127
	- id		Gear to destroy
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   128
- type="teamDefeat"	Team must be defeated
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   129
	- teamName	Name of team to defeat
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   130
- type="collect"	Crate must be collected
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   131
	FAIL CONDITION:	Crate taken by enemy, or destroyed
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   132
	- id		ID of crate gear to collect
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   133
	- collectors	Optional table of gear IDs, any one of which must collect the gear (but nobody else!).
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   134
			By default, this is for the player's teams and allies.
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   135
- type="turns"		Achieved when a number of turns has been played
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   136
	- turns 	Number of played turns 
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   137
- type="rounds"		Achieved when a number of rounds has been played
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   138
	- rounds	Number of played rounds
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   139
- type="suddenDeath"	Sudden Death has started
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   140
- type="inZone"		A gear is within given coordinate bounds. Each of xMin, xMax, yMin and yMax is a sub-goal.
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   141
			Each sub-goal is only checked if not nil.
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   142
			You can use this to check if a gear left, right, above or below a given coordinate.
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   143
			To check if the gear is within a rectangle, just set all 4 sub-goals.
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   144
	FAIL CONDITION:	Gear destroyed
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   145
	- id		Gear to watch
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   146
	- xMin		gear's X coordinate must be lower than this
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   147
	- xMax		gear's X coordinate must be higher than this
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   148
	- yMin		gear's Y coordinate must be lower than this
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   149
	- yMax		gear's Y coordinate must be higher than this
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   150
- type="distGearPos"	Distance between a gear and a fixed position
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   151
	FAIL CONDITION:	Gear destroyed
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   152
	- distance	goal distance to compare to
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   153
	- relationship	"greaterThan" or "smallerThan"
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   154
	- id		gear to watch
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   155
	- x		x coordinate to reach
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   156
	- y		y coordinate to reach
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   157
- type="distGearGear"	Distance between two gears
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   158
	FAIL CONDITION:	Any of both gears destroyed
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   159
	- distance	goal distance to compare to
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   160
	- relationship	"greaterThan" or "smallerThan"
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   161
	- id1		first gear to compare
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   162
	- id2		second gear to compare
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   163
- type="damage"		Gear took damage or was destroyed
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   164
	- id		Gear to watch
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   165
	- damage	Minimum amount of damage to take at a single blow. Default: 1
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   166
	- canDestroy	If false, this goal will fail if the gear was destroyed without taking the required damage
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   167
- type="drown"		Gear has drowned
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   168
	FAIL CONDITION:	Gear destroyed by other means
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   169
	- id		Gear to watch
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   170
- type="poison"		Gear must be poisoned
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   171
	FAIL CONDITION:	Gear destroyed
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   172
	- id		Gear to be poisoned
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   173
- type="cure"		Gear must exist and be free from poisoning
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   174
	FAIL CONDITION:	Gear destroyed
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   175
	- id		Gear to check
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   176
- type="freeze"		Gear must exist and be frozen
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   177
	FAIL CONDITION:	Gear destroyed
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   178
	- id		Gear to be frozen
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   179
- type="melt"		Gear must exist and be unfrozen
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   180
	FAIL CONDITION:	Gear destroyed
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   181
	- id		Gear to check
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   182
- type="waterSkip"	Gear must have skipped over water
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   183
	FAIL CONDITION:	Gear destroyed before it reached the required number of skips
458e9d8b4875 LuaLibrarySimpleMission: Indent
Wuzzy
parents: 1932
diff changeset
   184
	- id
1932
15edba44c050 LuaLibrarySimpleMission: Update 1.0.0
Wuzzy
parents: 1824
diff changeset
   185
		- skips		Total number of water skips required at least (default: 1)
1355
17fe62f4b3de LuaLibrarySimpleMission: formatting
Wuzzy
parents: 1354
diff changeset
   186
</code>
1354
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   187
1356
47ae63ffa3d5 LuaLibrarySimpleMission: Links
Wuzzy
parents: 1355
diff changeset
   188
Source: https://hg.hedgewars.org/hedgewars/raw-file/tip/share/hedgewars/Data/Scripts/SimpleMission.lua
47ae63ffa3d5 LuaLibrarySimpleMission: Links
Wuzzy
parents: 1355
diff changeset
   189
1354
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   190
=== Examples ===
1356
47ae63ffa3d5 LuaLibrarySimpleMission: Links
Wuzzy
parents: 1355
diff changeset
   191
A couple of scenarios are using `SimpleMission`. Look into `Data/Missions/Scenarios` of your Hedgewars installation. Check out the [https://hg.hedgewars.org/hedgewars/raw-file/tip/share/hedgewars/Data/Missions/Scenario/Bazooka_Battlefield.lua source code of the mission “Bazooka Battlefield”] for a typical mission created with this library.