LuaLibrarySimpleMission: Update 1.0.0
authorWuzzy
Fri, 21 Jun 2019 23:14:40 +0100
changeset 1932 15edba44c050
parent 1931 d6ef1025d96f
child 1933 458e9d8b4875
LuaLibrarySimpleMission: Update 1.0.0
LuaLibrarySimpleMission.wiki
--- a/LuaLibrarySimpleMission.wiki	Fri Jun 21 23:11:24 2019 +0100
+++ b/LuaLibrarySimpleMission.wiki	Fri Jun 21 23:14:40 2019 +0100
@@ -23,162 +23,166 @@
 This is the definition of the `params` table:
 
 <code>
-Mandatory fields:
-- teams:		Table of teams. There must be 1-8 teams.
+	Mandatory fields:
+	- teams:		Table of teams. There must be 1-8 teams.
 
-Optional fields
-- ammoConfig		Table containing basic ammo values (default: infinite skip only)
-- initVars		Table where you set up environment parameters such as MinesNum.
-- wind			If set, the wind will permanently set to this value (-100..100). Implies gfDisableWind
-- gears:		Table of objects.
-- girders		Table of girders
-- rubbers		Table of rubbers
+	Optional fields
+	- ammoConfig		Table containing basic ammo values (default: infinite skip only)
+	- initVars		Table where you set up environment parameters such as MinesNum.
+	- wind			If set, the wind will permanently set to this value (-100..100). Implies gfDisableWind
+	- gears:		Table of objects.
+	- girders		Table of girders
+	- rubbers		Table of rubbers
 
-AMMO
-- ammoType		ammo type
-- delay			delay (default: 0)
-- numberInCrate		ammo per crate (default: 1)
-- count			default starter ammo for everyone, 9 for infinite (default: 0)
-- probability		probability in crates (default: 0)
+	AMMO
+	- ammoType		ammo type
+	- delay			delay (default: 0)
+	- numberInCrate		ammo per crate (default: 1)
+	- count			default starter ammo for everyone, 9 for infinite (default: 0)
+	- probability		probability in crates (default: 0)
 
-TEAM DATA
-- hogs			table of hedgehogs in this team (must contain at least 1 hog)
-- name			team name
-- clanID		ID of the clan to which this team belongs to. Counting starts at 0.
-			By default, each team goes into its own clan.
-			Important: The clan of the player and allies MUST be 0.
-			Important: You MUST either set the clan ID explicitly for all teams or none of them.
-- flag			flag name (default: hedgewars)
-- grave			grave name (has default grave for each team)
-- fort			fort name (default: Castle)
+	TEAM DATA
+	- isMissionTeam		if true, this is the player's chosen team for this mission (default: false)
+	- hogs			table of hedgehogs in this team (must contain at least 1 hog)
+	- clanID		ID of the clan to which this team belongs to. Counting starts at 0.
+				By default, each team goes into its own clan.
+				Important: The clan of the player and allies MUST be 0.
+				Important: You MUST either set the clan ID explicitly for all teams or none of them.
+	These arguments will be ignored if this is a mission team:
+	- name			team name
+	- flag			flag name (default: hedgewars)
+	- grave			grave name (has default grave for each team)
+	- fort			fort name (default: Castle)
+	- voice			voicepack (default: Default_qau)
 
-HEDGEHOG DATA:
-- id			optional identifier for goals
-- name			hog name
-- x, y			hog position (default: spawns randomly on land)
-- botLevel		1-5: Bot level (lower=stronger). 0=human player (default: 0)
-- hat			hat name (default: NoHat)
-- health		hog health (default: 100)
-- poisoned		if true, hedgehog starts poisoned with 5 poison damage. Set to a number for other poison damage (default: false)
-- frozen		if true, hedgehogs starts frozen (default: false)
-- faceLeft		initial facing direction. true=left, false=false (default: false)
-- ammo			table of ammo types
+	HEDGEHOG DATA:
+	- id			optional identifier for goals
+	- health		hog health (default: 100)
+	- ammo			table of ammo types
+	- x, y			hog position (default: spawns randomly on land)
+	- poisoned		if true, hedgehog starts poisoned with 5 poison damage. Set to a number for other poison damage (default: false)
+	- frozen		if true, hedgehogs starts frozen (default: false)
+	- faceLeft		initial facing direction. true=left, false=false (default: false)
+	These arguments will be ignored if the hog is in a mission team:
+	- name			hog name
+	- botLevel		1-5: Bot level (lower=stronger). 0=human player (default: 0)
+	- hat			hat name (default: NoHat)
 
-GEAR TYPES:
-- type			gear type
-ALL types:
-	id		optional identifier for goals
-	x		x coordinate of starting position (default: 0)
-	y		y coordinate of starting position (default: 0)
-	dx		initial x speed (default: 0)
-	dy		initial y speed (default: 0)
-- type=gtMine		Mine
-	timer 		Mine timer (only for non-duds). Default: MinesTime
-	isDud		Whether the mine is a dud. default: false
-	isFrozen	Whether the mine is frozen. If true, it implies being a dud as well. Default: false
-	health 		Initial health of dud mines. Has no effect if isDud=false. Default: 36
-- type=gtSMine		Sticky mine
-	timer		Timer. Default: 500
-- type=gtAirMine	Air mine
-	timer		Timer. Default: (MinesTime/1000 * 250)
-- type=gtExplosives	Barrel
-	health		Initial health. Default: 60
-	isFrozen	Whether the barrel is frozen. Default: true with health > 60, false otherwise
-	isRolling	Whether the barrel starts in “rolling” state. Default: false
-- type=gtCase		Crate
-	crateType	"health": Health crate
-			"supply": Ammo or utility crate (select crate type automatically)
-			"supply_ammo_explicit": Ammo crate (not recommened)
-			"supply_utility_explicit": Utility crate (not recommededn)
-	ammoType	Contained ammo (only for ammo and utility crates).
-	health		Contained health (only for health crates). Default: HealthCaseAmount
-	isFrozen	Whether the crate is frozen. Default: false
-- type=gtKnife		Cleaver
-- type=gtTarget		Target
-
-GOALS:
-Note: If there are at least two opposing teams, a default goal is used, which is to defeat all the enemies of the
-player's team. If this is what you want, you can skip this section.
+	GEAR TYPES:
+	- type			gear type
+	ALL types:
+		id		optional identifier for goals
+		x		x coordinate of starting position (default: 0)
+		y		y coordinate of starting position (default: 0)
+		dx		initial x speed (default: 0)
+		dy		initial y speed (default: 0)
+	- type=gtMine		Mine
+		timer 		Mine timer (only for non-duds). Default: MinesTime
+		isDud		Whether the mine is a dud. default: false
+		isFrozen	Whether the mine is frozen. If true, it implies being a dud as well. Default: false
+		health 		Initial health of dud mines. Has no effect if isDud=false. Default: 36
+	- type=gtSMine		Sticky mine
+		timer		Timer. Default: 500
+	- type=gtAirMine	Air mine
+		timer		Timer. Default: (MinesTime/1000 * 250)
+	- type=gtExplosives	Barrel
+		health		Initial health. Default: 60
+		isFrozen	Whether the barrel is frozen. Default: true with health > 60, false otherwise
+		isRolling	Whether the barrel starts in “rolling” state. Default: false
+	- type=gtCase		Crate
+		crateType	"health": Health crate
+				"supply": Ammo or utility crate (select crate type automatically)
+				"supply_ammo_explicit": Ammo crate (not recommened)
+				"supply_utility_explicit": Utility crate (not recommededn)
+		ammoType	Contained ammo (only for ammo and utility crates).
+		health		Contained health (only for health crates). Default: HealthCaseAmount
+		isFrozen	Whether the crate is frozen. Default: false
+	- type=gtKnife		Cleaver
+	- type=gtTarget		Target
 
-The default goal is overwritten as if customGoals has been set. Set customGoals and other related parameters for
-defining your own special goals. In this case, the mission is won if all customGoals are completed.
-Note the mission will always fail if the player's hedgehogs and all their allies have been defeated.
-If there is only one team (for the player), there is no default goal and one must be set explicitly.
-- customGoals		Table of custom goals (see below). All of them must be met to win. Some goal types might fail,
-			rendering the mission unwinnable and leading to the loss of the mission. An example is
-			blowing up a crate which you should have collected.ed.
-- customNonGoals	Table of non-goals, the player loses if one of them is achieved
-- customGoalCheck	When to check goals and non-goals. Values: "instant" (default), "turnStart", "turnEnd"
+	GOALS:
+	Note: If there are at least two opposing teams, a default goal is used, which is to defeat all the enemies of the
+	player's team. If this is what you want, you can skip this section.
 
-- missionTitle:		The name of the mission (highly recommended)
-- missionIcon:		Icon of the mission panel, see documentation of ShowMission in the Lua API
-- goalText:		A short string explaining the goal of the mission (use this if you set custom goals).
+	The default goal is overwritten as if customGoals has been set. Set customGoals and other related parameters for
+	defining your own special goals. In this case, the mission is won if all customGoals are completed.
+	Note the mission will always fail if the player's hedgehogs and all their allies have been defeated.
+	If there is only one team (for the player), there is no default goal and one must be set explicitly.
+	- customGoals		Table of custom goals (see below). All of them must be met to win. Some goal types might fail,
+				rendering the mission unwinnable and leading to the loss of the mission. An example is
+				blowing up a crate which you should have collected.ed.
+	- customNonGoals	Table of non-goals, the player loses if one of them is achieved
+	- customGoalCheck	When to check goals and non-goals. Values: "instant" (default), "turnStart", "turnEnd"
+
+	- missionTitle:		The name of the mission (highly recommended)
+	- missionIcon:		Icon of the mission panel, see documentation of ShowMission in the Lua API
+	- goalText:		A short string explaining the goal of the mission (use this if you set custom goals).
 
-GOAL TYPES:
-- type			name of goal type
-- failText		Optional. For non-goals, this text will be shown in the stats if mission fails due to this non-goal
-			being completed. For goals which fail, this text will be displayed at failure. Note that
-			all normal goals have sensible default fail texts.
-- type="destroy"	Gear must be destroyed
-	- id		Gear to destroy
-- type="teamDefeat"	Team must be defeated
-	- teamName	Name of team to defeat
-- type="collect"	Crate must be collected
-	FAIL CONDITION:	Crate taken by enemy, or destroyed
-	- id		ID of crate gear to collect
-	- collectors	Optional table of gear IDs, any one of which must collect the gear (but nobody else!).
-			By default, this is for the player's teams and allies.
-- type="turns"		Achieved when a number of turns has been played
-	- turns 	Number of played turns 
-- type="rounds"		Achieved when a number of rounds has been played
-	- rounds	Number of played rounds
-- type="suddenDeath"	Sudden Death has started
-- type="inZone"		A gear is within given coordinate bounds. Each of xMin, xMax, yMin and yMax is a sub-goal.
-			Each sub-goal is only checked if not nil.
-			You can use this to check if a gear left, right, above or below a given coordinate.
-			To check if the gear is within a rectangle, just set all 4 sub-goals.
-	FAIL CONDITION:	Gear destroyed
-	- id		Gear to watch
-	- xMin		gear's X coordinate must be lower than this
-	- xMax		gear's X coordinate must be higher than this
-	- yMin		gear's Y coordinate must be lower than this
-	- yMax		gear's Y coordinate must be higher than this
-- type="distGearPos"	Distance between a gear and a fixed position
-	FAIL CONDITION:	Gear destroyed
-	- distance	goal distance to compare to
-	- relationship	"greaterThan" or "smallerThan"
-	- id		gear to watch
-	- x		x coordinate to reach
-	- y		y coordinate to reach
-- type="distGearGear"	Distance between two gears
-	FAIL CONDITION:	Any of both gears destroyed
-	- distance	goal distance to compare to
-	- relationship	"greaterThan" or "smallerThan"
-	- id1		first gear to compare
-	- id2		second gear to compare
-- type="damage"		Gear took damage or was destroyed
-	- id		Gear to watch
-	- damage	Minimum amount of damage to take at a single blow. Default: 1
-	- canDestroy	If false, this goal will fail if the gear was destroyed without taking the required damage
-- type="drown"		Gear has drowned
-	FAIL CONDITION:	Gear destroyed by other means
-	- id		Gear to watch
-- type="poison"		Gear must be poisoned
-	FAIL CONDITION:	Gear destroyed
-	- id		Gear to be poisoned
-- type="cure"		Gear must exist and be free from poisoning
-	FAIL CONDITION:	Gear destroyed
-	- id		Gear to check
-- type="freeze"		Gear must exist and be frozen
-	FAIL CONDITION:	Gear destroyed
-	- id		Gear to be frozen
-- type="melt"		Gear must exist and be unfrozen
-	FAIL CONDITION:	Gear destroyed
-	- id		Gear to check
-- type="waterSkip"	Gear must have skipped over water
-	FAIL CONDITION:	Gear destroyed before it reached the required number of skips
-	- id
-	- skips		Total number of water skips required at least (default: 1)
+	GOAL TYPES:
+	- type			name of goal type
+	- failText		Optional. For non-goals, this text will be shown in the stats if mission fails due to this non-goal
+				being completed. For goals which fail, this text will be displayed at failure. Note that
+				all normal goals have sensible default fail texts.
+	- type="destroy"	Gear must be destroyed
+		- id		Gear to destroy
+	- type="teamDefeat"	Team must be defeated
+		- teamName	Name of team to defeat
+	- type="collect"	Crate must be collected
+		FAIL CONDITION:	Crate taken by enemy, or destroyed
+		- id		ID of crate gear to collect
+		- collectors	Optional table of gear IDs, any one of which must collect the gear (but nobody else!).
+				By default, this is for the player's teams and allies.
+	- type="turns"		Achieved when a number of turns has been played
+		- turns 	Number of played turns 
+	- type="rounds"		Achieved when a number of rounds has been played
+		- rounds	Number of played rounds
+	- type="suddenDeath"	Sudden Death has started
+	- type="inZone"		A gear is within given coordinate bounds. Each of xMin, xMax, yMin and yMax is a sub-goal.
+				Each sub-goal is only checked if not nil.
+				You can use this to check if a gear left, right, above or below a given coordinate.
+				To check if the gear is within a rectangle, just set all 4 sub-goals.
+		FAIL CONDITION:	Gear destroyed
+		- id		Gear to watch
+		- xMin		gear's X coordinate must be lower than this
+		- xMax		gear's X coordinate must be higher than this
+		- yMin		gear's Y coordinate must be lower than this
+		- yMax		gear's Y coordinate must be higher than this
+	- type="distGearPos"	Distance between a gear and a fixed position
+		FAIL CONDITION:	Gear destroyed
+		- distance	goal distance to compare to
+		- relationship	"greaterThan" or "smallerThan"
+		- id		gear to watch
+		- x		x coordinate to reach
+		- y		y coordinate to reach
+	- type="distGearGear"	Distance between two gears
+		FAIL CONDITION:	Any of both gears destroyed
+		- distance	goal distance to compare to
+		- relationship	"greaterThan" or "smallerThan"
+		- id1		first gear to compare
+		- id2		second gear to compare
+	- type="damage"		Gear took damage or was destroyed
+		- id		Gear to watch
+		- damage	Minimum amount of damage to take at a single blow. Default: 1
+		- canDestroy	If false, this goal will fail if the gear was destroyed without taking the required damage
+	- type="drown"		Gear has drowned
+		FAIL CONDITION:	Gear destroyed by other means
+		- id		Gear to watch
+	- type="poison"		Gear must be poisoned
+		FAIL CONDITION:	Gear destroyed
+		- id		Gear to be poisoned
+	- type="cure"		Gear must exist and be free from poisoning
+		FAIL CONDITION:	Gear destroyed
+		- id		Gear to check
+	- type="freeze"		Gear must exist and be frozen
+		FAIL CONDITION:	Gear destroyed
+		- id		Gear to be frozen
+	- type="melt"		Gear must exist and be unfrozen
+		FAIL CONDITION:	Gear destroyed
+		- id		Gear to check
+	- type="waterSkip"	Gear must have skipped over water
+		FAIL CONDITION:	Gear destroyed before it reached the required number of skips
+		- id
+		- skips		Total number of water skips required at least (default: 1)
 </code>
 
 Source: https://hg.hedgewars.org/hedgewars/raw-file/tip/share/hedgewars/Data/Scripts/SimpleMission.lua