LuaLibrarySimpleMission.wiki
author nemo
Fri, 14 Dec 2018 09:22:41 -0500
changeset 1687 425eb8f784a9
parent 1378 e03e8e186faa
child 1824 a5a87fba78fa
permissions -rw-r--r--
Drop 0.9.22 reference to tidy up. - not much point in building anything that old anymore - if anyone wants ancient builds of server, eh, the wiki is versioned. Remove SDL 1.2 from dep list for similar reason.
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>
1354
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    26
Mandatory fields:
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    27
- teams:		Table of teams. There must be 1-8 teams.
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    28
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    29
Optional fields
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    30
- ammoConfig		Table containing basic ammo values (default: infinite skip only)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    31
- initVars		Table where you set up environment parameters such as MinesNum.
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    32
- wind			If set, the wind will permanently set to this value (-100..100). Implies gfDisableWind
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    33
- gears:		Table of objects.
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    34
- girders		Table of girders
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    35
- rubbers		Table of rubbers
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    36
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    37
AMMO
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    38
- ammoType		ammo type
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    39
- delay			delay (default: 0)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    40
- numberInCrate		ammo per crate (default: 1)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    41
- count			default starter ammo for everyone, 9 for infinite (default: 0)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    42
- probability		probability in crates (default: 0)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    43
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    44
TEAM DATA
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    45
- hogs			table of hedgehogs in this team (must contain at least 1 hog)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    46
- name			team name
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    47
- clanID		ID of the clan to which this team belongs to. Counting starts at 0.
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    48
			By default, each team goes into its own clan.
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    49
			Important: The clan of the player and allies MUST be 0.
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    50
			Important: You MUST either set the clan ID explicitly for all teams or none of them.
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    51
- flag			flag name (default: hedgewars)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    52
- grave			grave name (has default grave for each team)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    53
- fort			fort name (default: Castle)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    54
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    55
HEDGEHOG DATA:
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    56
- id			optional identifier for goals
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    57
- name			hog name
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    58
- x, y			hog position (default: spawns randomly on land)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    59
- botLevel		1-5: Bot level (lower=stronger). 0=human player (default: 0)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    60
- hat			hat name (default: NoHat)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    61
- health		hog health (default: 100)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    62
- poisoned		if true, hedgehog starts poisoned with 5 poison damage. Set to a number for other poison damage (default: false)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    63
- frozen		if true, hedgehogs starts frozen (default: false)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    64
- faceLeft		initial facing direction. true=left, false=false (default: false)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    65
- ammo			table of ammo types
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    66
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    67
GEAR TYPES:
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    68
- type			gear type
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    69
ALL types:
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    70
	id		optional identifier for goals
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    71
	x		x coordinate of starting position (default: 0)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    72
	y		y coordinate of starting position (default: 0)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    73
	dx		initial x speed (default: 0)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    74
	dy		initial y speed (default: 0)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    75
- type=gtMine		Mine
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    76
	timer 		Mine timer (only for non-duds). Default: MinesTime
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    77
	isDud		Whether the mine is a dud. default: false
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    78
	isFrozen	Whether the mine is frozen. If true, it implies being a dud as well. Default: false
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    79
	health 		Initial health of dud mines. Has no effect if isDud=false. Default: 36
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    80
- type=gtSMine		Sticky mine
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    81
	timer		Timer. Default: 500
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    82
- type=gtAirMine	Air mine
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    83
	timer		Timer. Default: (MinesTime/1000 * 250)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    84
- type=gtExplosives	Barrel
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    85
	health		Initial health. Default: 60
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    86
	isFrozen	Whether the barrel is frozen. Default: true with health > 60, false otherwise
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    87
	isRolling	Whether the barrel starts in “rolling” state. Default: false
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    88
- type=gtCase		Crate
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    89
	crateType	"health": Health crate
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    90
			"supply": Ammo or utility crate (select crate type automatically)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    91
			"supply_ammo_explicit": Ammo crate (not recommened)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    92
			"supply_utility_explicit": Utility crate (not recommededn)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    93
	ammoType	Contained ammo (only for ammo and utility crates).
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    94
	health		Contained health (only for health crates). Default: HealthCaseAmount
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    95
	isFrozen	Whether the crate is frozen. Default: false
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    96
- type=gtKnife		Cleaver
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    97
- type=gtTarget		Target
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    98
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
    99
GOALS:
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   100
Note: If there are at least two opposing teams, a default goal is used, which is to defeat all the enemies of the
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   101
player's team. If this is what you want, you can skip this section.
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   102
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   103
The default goal is overwritten as if customGoals has been set. Set customGoals and other related parameters for
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   104
defining your own special goals. In this case, the mission is won if all customGoals are completed.
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   105
Note the mission will always fail if the player's hedgehogs and all their allies have been defeated.
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   106
If there is only one team (for the player), there is no default goal and one must be set explicitly.
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   107
- customGoals		Table of custom goals (see below). All of them must be met to win. Some goal types might fail,
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   108
			rendering the mission unwinnable and leading to the loss of the mission. An example is
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   109
			blowing up a crate which you should have collected.ed.
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   110
- customNonGoals	Table of non-goals, the player loses if one of them is achieved
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   111
- customGoalCheck	When to check goals and non-goals. Values: "instant" (default), "turnStart", "turnEnd"
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   112
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   113
- missionTitle:		The name of the mission (highly recommended)
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   114
- missionIcon:		Icon of the mission panel, see documentation of ShowMission in the Lua API
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   115
- goalText:		A short string explaining the goal of the mission (use this if you set custom goals).
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   116
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   117
GOAL TYPES:
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   118
- type			name of goal type
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   119
- failText		Optional. For non-goals, this text will be shown in the stats if mission fails due to this non-goal
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   120
			being completed. For goals which fail, this text will be displayed at failure. Note that
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   121
			all normal goals have sensible default fail texts.
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   122
- type="destroy"	Gear must be destroyed
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   123
	- id		Gear to destroy
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   124
- type="teamDefeat"	Team must be defeated
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   125
	- teamName	Name of team to defeat
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   126
- type="collect"	Crate must be collected
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   127
	FAIL CONDITION:	Crate taken by enemy, or destroyed
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   128
	- id		ID of crate gear to collect
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   129
	- collectors	Optional table of gear IDs, any one of which must collect the gear (but nobody else!).
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   130
			By default, this is for the player's teams and allies.
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   131
- type="turns"		Achieved when a number of turns has been played
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   132
	- turns 	Number of played turns 
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   133
- type="rounds"		Achieved when a number of rounds has been played
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   134
	- rounds	Number of played rounds
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   135
- type="suddenDeath"	Sudden Death has started
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   136
- type="inZone"		A gear is within given coordinate bounds. Each of xMin, xMax, yMin and yMax is a sub-goal.
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   137
			Each sub-goal is only checked if not nil.
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   138
			You can use this to check if a gear left, right, above or below a given coordinate.
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   139
			To check if the gear is within a rectangle, just set all 4 sub-goals.
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   140
	FAIL CONDITION:	Gear destroyed
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   141
	- id		Gear to watch
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   142
	- xMin		gear's X coordinate must be lower than this
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   143
	- xMax		gear's X coordinate must be higher than this
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   144
	- yMin		gear's Y coordinate must be lower than this
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   145
	- yMax		gear's Y coordinate must be higher than this
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   146
- type="distGearPos"	Distance between a gear and a fixed position
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   147
	FAIL CONDITION:	Gear destroyed
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   148
	- distance	goal distance to compare to
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   149
	- relationship	"greaterThan" or "lowerThan"
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   150
	- id		gear to watch
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   151
	- x		x coordinate to reach
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   152
	- y		y coordinate to reach
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   153
- type="distGearGear"	Distance between two gears
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   154
	FAIL CONDITION:	Any of both gears destroyed
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   155
	- distance	goal distance to compare to
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   156
	- relationship	"greaterThan" or "lowerThan"
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   157
	- id1		first gear to compare
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   158
	- id2		second gear to compare
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   159
- type="damage"		Gear took damage or was destroyed
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   160
	- id		Gear to watch
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   161
	- damage	Minimum amount of damage to take at a single blow. Default: 1
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   162
	- canDestroy	If false, this goal will fail if the gear was destroyed without taking the required damage
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   163
- type="drown"		Gear has drowned
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   164
	FAIL CONDITION:	Gear destroyed by other means
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   165
	- id		Gear to watch
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   166
- type="poison"		Gear must be poisoned
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   167
	FAIL CONDITION:	Gear destroyed
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   168
	- id		Gear to be poisoned
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   169
- type="cure"		Gear must exist and be free from poisoning
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   170
	FAIL CONDITION:	Gear destroyed
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   171
	- id		Gear to check
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   172
- type="freeze"		Gear must exist and be frozen
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   173
	FAIL CONDITION:	Gear destroyed
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   174
	- id		Gear to be frozen
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   175
- type="melt"		Gear must exist and be unfrozen
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   176
	FAIL CONDITION:	Gear destroyed
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   177
	- id		Gear to check
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   178
- type="waterSkip"	Gear must have skipped over water
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   179
	FAIL CONDITION:	Gear destroyed before it reached the required number of skips
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   180
	- id
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   181
	- skips		Total number of water skips required at least (default: 1)
1355
17fe62f4b3de LuaLibrarySimpleMission: formatting
Wuzzy
parents: 1354
diff changeset
   182
</code>
1354
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   183
1356
47ae63ffa3d5 LuaLibrarySimpleMission: Links
Wuzzy
parents: 1355
diff changeset
   184
Source: https://hg.hedgewars.org/hedgewars/raw-file/tip/share/hedgewars/Data/Scripts/SimpleMission.lua
47ae63ffa3d5 LuaLibrarySimpleMission: Links
Wuzzy
parents: 1355
diff changeset
   185
1354
7cfa7d94d014 Add Lua library: SimpleMission
Wuzzy <almikes@aol.com>
parents:
diff changeset
   186
=== Examples ===
1356
47ae63ffa3d5 LuaLibrarySimpleMission: Links
Wuzzy
parents: 1355
diff changeset
   187
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.