This AI is still in early stages of development.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

API for managing missions and objectives.

 

properties

.addObjective(objectDescriptorObj)

.enableObjective(objectiveID) // enable objective

.disableObective(objectiveID) // disable objective

.achieveObjective(objectiveID) // force an objective to be achieved

.isObjectiveAchieved(objectiveID) // true = 

.isComplete() // checks if all mandatory objectives are done. false = failed, undefined/null = in progress, true = completed

.onCompleted() // triggered when mission is completed

.onFailed() // triggered when mission failed

objective descriptor object

PropertyTypeMandatoryNotesAPI Ver
idString(tick)id of the task, used when updating task, etc. 
titleString(tick)used when displaying objectives to user via console 
tasksNumber(error)

number of tasks required to complete the objective

must be >= 1

default: 1

 
optionalBoolean(error)

is this objective optional?

  • true – it's optional
  • false – it's mandatory, you can't win the mission without completing it

default: false

 
hiddenBoolean(error)

is this objective hidden?

  • true – yes, it's hidden
  • false – no, it's visible to users

default: false

when hidden, it will only be listed in status reports if the game is in cheat mode

 
enabledBoolean(error)

is the objective enabled?

  • true – yes, it's enabled and can be achieved
  • false – no, it's disabled and cannot be achieved

default: if requires specified, defaults to false, if requires not specified defaults to true

note: to change value call Mission.enableObjective(id)

 
requires

Array of String

Null

(error)

optionally specify a list of other objectives (by their ids) that must be completed before this objective is enabled

default: null (don't require anything)

 
enables

Array of String

Null

(error)

optionally specify a list of objectives to enable when this objective is achieved

default: null (don't enable anything)

 
onUpdateFunction(error)

a function to call whenever the objective progress is updated, except when the object is achieved in which case onDone() gets called (see below)

parameters: id, config (the objective descriptor object), data (passed in from updating script)

 
onDoneFunction(error)

a function to call when the objective is achieved (all tasks done)

same params as onUpdate

 
onEnableFunction(error)

a function to call when the objective is enabled or disabled

params: id, config, enabled (true or false), data

 
  • No labels