This AI is still in early stages of development.
Mission
- Aubergine
Properties
var value = Mission.<property>; Mission.<property> = value;
Note: A mission cannot start until all mandatory properties are specified.
Property | Type | Mandatory | Persists | Notes | API Version |
---|---|---|---|---|---|
id | String | The mission ID, for example "cam1a" | 1.0 | ||
name | String | The mission name (title), for example "Scavenger Uprising" | 1.0 | ||
date | Date | The mission start date and time. Tip: You can use month constants to make code more readable. | 1.0 | ||
labels | Array of String | An array of labels that the mission requires. Each label will be checked to ensure it exists in labels.ini and an error thrown if the label is missing. | 1.0 | ||
status | Constant | The current status of the mission:
You can set the status directly by setting an appropriate value, or by using the Mission.finish() method. When the mission is won or lost, Mission.onFinish() is triggered. | 1.0 | ||
timeLimit | Number Boolean | Optionally specify a time limit for the mission, in seconds. When set to a positive number, the mission timer will be displayed and the countdown will start. Tip: You can use SECS and MINS constants to make code more readable. When the countdown reaches Set to Default: | 1.0 | ||
countdown | Countdown Notification Scheme | Notifications for the Mission.timeLimit countdown. Tip: Several ready-made notification schemes are available – see "Constants" section below for more information. Default: | 1.0 | ||
timeReinforce | Number Boolean | Optionally specify a reinforcements timer, in seconds. When set to a positive number, the reinforcements timer will be displayed and the countdown will start. Tip: You can use SECS and MINS constants to make code more readable. When the countdown reaches Set to Default: | 1.0 | ||
transport | Countdown Notification Scheme | Notifications for the Mission.timeReinforce countdown. Tip: Several ready-made notification schemes are available – see "Constants" section below for more information. Default: | 1.0 | ||
objectives | List of Objectives |
| A list of objects defined for the mission. Most data relating to objectives is persisted. See Mission.objectives for more information. | 1.0 | |
progress | Number |
| The percentage of mandatory objectives that have been completed. Range: 0 → 100 If no objectives are defined, defaults to 100. | 1.0 |
Methods
var returnValue = Mission.<method>( <parameters> );
Method | Notes | API Version |
---|---|---|
objective(obj) | Adds a new mission objective to the Mission.objectives list. See Mission.objective() and Mission.objectives for more information. | 1.0 |
start() | Start the mission. Will throw an error if mandatory Mission properties are not defined. See Mission.start() for more information. | 1.0 |
finish(success) | Finish the mission. Note: You can also finish a mission by setting Mission.status to an appropriate value. See Mission.finish() for more information. | 1.0 |
Events
Mission.<event> = function( <paramters> ) { // do stuff }
Event | Notes | API Version |
---|---|---|
onStart | Triggered when the mission starts. See Mission.onStart() for more information. | 1.0 |
onFinish | Triggered when the mission finishes. See Mission.onFinish() for more information. | 1.0 |
onTimeout | Triggered when the Mission.timeLimit countdown reaches 0. See Mission.onTimeout() for more information. | 1.0 |
onReinforce | Triggered when the Mission.timeReinforce timer reaches 0. See Mission.onReinforce for more information. | 1.0 |
onUpdate | Triggered when mission objectives change:
See Mission.onUpdate for more information. | 1.0 |
onProgress | Triggered when progress is made on one or more objectives. See Mission.onProgress for more information. | 1.0 |
Constants
Mission.<constant> // a few constants are duplicated to the Mission.objective property // to make them more semantic when used in relation to objectives... // for example, "objective.IN_PROGRESS" would be accessed as: Mission.objective.IN_PROGRESS
Constant | Used by | Notes | API Version |
---|---|---|---|
COUNTDOWN_SILENT | Mission.countdown Mission.transport | Empty Countdown Notification Scheme (no audio or console notifications). | 1.0 |
COUNTDOWN_MISSION_TIMER | Mission.countdown Mission.transport | Female computer voice states mission timer is enabled, then provides occasional updates throughout the countdown. | 1.0 |
COUNTDOWN_TRANSPORT_ABORT | Mission.countdown Mission.transport | Female computer voice states reinforcements are in transit, then provides occasional updates throughout the countdown. Near the end of the countdown the transport pilot states he is approaching LZ. The female computer voice then states that the drop has been aborted. | 1.0 |
COUNTDOWN_TRANSPORT_LAND | Mission.countdown Mission.transport | Similar to above but ends with the transporter pilot counting down from 10 to 1, then the female computer voice states that reinforcements are landing. | 1.0 |
IN_PROGRESS | Mission.status <objective>.status | Indicates the mission or objective is still in progress. The value is falsey. | 1.0 |
objective.IN_PROGRESS | <objective>.status | Same as Mission.IN_PROGRESS . | 1.0 |
SUCCESSFUL | Mission.status <objective>.status | Indicates the mission or objective was completed successfully. The value is truthy. | 1.0 |
objective.SUCCESSFUL | <objective>.status | Same as Mission.SUCCESSFUL . | 1.0 |
FAILED | Mission.status <objective>.status | Indicates the mission or objective was failed. The value is falsey. | 1.0 |
objective.FAILED | <objective>.status | Same as Mission.FAILED . | 1.0 |
PRIMARY_OBJECTIVE | <objective>.type | Indicates an objective is the primary mission objective. | 1.0 |
SECONDARY_OBJECTIVE | <objective>.type | Indicates an objective is a secondary mission objective. | 1.0 |
TERTIARY_OBJECTIVE | <objective>.type | Indicates an objective is an optional tertiary mission objective. | 1.0 |
SECRET_OBJECTIVE | <objective>.type | Indicates an objective is a hidden bonus mission objective. | 1.0 |
Contents
Jump to:
Mission API
Topics:
- Mission — The global Mission namespace contains all properties, methods and events relating to the current mission...
- Mission.finish() — Mark a mission as finished, either as successful or failed...
- Mission.onFinish() — Triggered when a mission finishes...