(info) This AI is still in early stages of development.

Mission

The global Mission namespace contains all properties, methods and events relating to the current mission...

 

Properties

Getting and setting mission properties...
var value = Mission.<property>;
 
Mission.<property> = value;

Note: A mission cannot start until all mandatory properties are specified.

PropertyTypeMandatoryPersistsNotesAPI Version
idString(tick)(tick)The mission ID, for example "cam1a"1.0
nameString(tick)(error)The mission name (title), for example "Scavenger Uprising"1.0
dateDate(tick)(error)

The mission start date and time.

Tip: You can use month constants to make code more readable.

1.0
labelsArray of String(tick)(error)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
statusConstant(error)(tick)

The current status of the mission:

  • Mission.IN_PROGRESS – mission has not yet been won or lost
  • Mission.SUCCESSFUL – mission won
  • Mission.FAILED – mission failed

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

(error)(tick)

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 0, or is set to 0, Mission.onTimeout() will be triggered.

Set to false or -1 to remove the time limit.

Default: false

1.0
countdownCountdown Notification Scheme(error)(error)

Notifications for the Mission.timeLimit countdown.

Tip: Several ready-made notification schemes are available – see "Constants" section below for more information.

Default: Mission.COUNTDOWN_MISSION_TIMER

1.0
timeReinforce

Number

Boolean

(error)(tick)

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 0, or is set to 0, Mission.onReinforce() will be triggered.

Set to false or -1 to remove the timer.

Default: false

1.0
transportCountdown Notification Scheme(error)(error)

Notifications for the Mission.timeReinforce countdown.

Tip: Several ready-made notification schemes are available – see "Constants" section below for more information.

Default: Mission.COUNTDOWN_TRANSPORT_LAND

1.0
objectivesList of Objectives(error)

(tick)
see notes

A list of objects defined for the mission.

Most data relating to objectives is persisted. See Mission.objectives for more information.

1.0
progressNumber


read-only

(tick)

The percentage of mandatory objectives that have been completed.

Range: 0 → 100

If no objectives are defined, defaults to 100.

1.0

Methods

Calling methods...
var returnValue = Mission.<method>( <parameters> );
MethodNotesAPI 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

Adding event handlers...
Mission.<event> = function( <paramters> ) {
	// do stuff
}
EventNotesAPI 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:

  • New objective added
  • Existing objective enabled
  • Existing objective becomes required

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

Accessing Mission 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
ConstantUsed byNotesAPI 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>.statusSame 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>.statusSame 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>.statusSame as Mission.FAILED.1.0
PRIMARY_OBJECTIVE<objective>.typeIndicates an objective is the primary mission objective.1.0
SECONDARY_OBJECTIVE<objective>.typeIndicates an objective is a secondary mission objective.1.0
TERTIARY_OBJECTIVE<objective>.typeIndicates an objective is an optional tertiary mission objective.1.0
SECRET_OBJECTIVE<objective>.typeIndicates an objective is a hidden bonus mission objective.1.0
Availability DEV

Requires:

Contents

Jump to:

Mission API

Topics:

  • Mission — The global Mission namespace contains all properties, methods and events relating to the current mission...

Â