Skip to main content

AI

Description:

  The singleton record to retrieve information when executing the decision tree.

getUnitsByRelation

Type: Function.

Description:

  Gets an array of units in detection range that have the specified relation to current AI agent.

Signature:

getUnitsByRelation: function(self: AI, relation: Relation): Array

Parameters:

ParameterTypeDescription
relationRelationThe relation to filter the units by.

Returns:

Return TypeDescription
ArrayAn array of units with the specified relation.

getDetectedUnits

Type: Function.

Description:

  Gets an array of units that the AI has detected.

Signature:

getDetectedUnits: function(self: AI): Array

Returns:

Return TypeDescription
ArrayAn array of detected units.

getDetectedBodies

Type: Function.

Description:

  Gets an array of bodies that the AI has detected.

Signature:

getDetectedBodies: function(self: AI): Array

Returns:

Return TypeDescription
ArrayAn array of detected bodies.

getNearestUnit

Type: Function.

Description:

  Gets the nearest unit that has the specified relation to the AI.

Signature:

getNearestUnit: function(self: AI, relation: Relation): Unit

Parameters:

ParameterTypeDescription
relationRelationThe relation to filter the units by.

Returns:

Return TypeDescription
UnitThe nearest unit with the specified relation.

getNearestUnitDistance

Type: Function.

Description:

  Gets the distance to the nearest unit that has the specified relation to the AI agent.

Signature:

getNearestUnitDistance: function(self: AI, relation: Relation): number

Parameters:

ParameterTypeDescription
relationRelationThe relation to filter the units by.

Returns:

Return TypeDescription
numberThe distance to the nearest unit with the specified relation.

getUnitsInAttackRange

Type: Function.

Description:

  Gets an array of units that are within attack range.

Signature:

getUnitsInAttackRange: function(self: AI): Array

Returns:

Return TypeDescription
ArrayAn array of units in attack range.

getBodiesInAttackRange

Type: Function.

Description:

  Gets an array of bodies that are within attack range.

Signature:

getBodiesInAttackRange: function(self: AI): Array

Returns:

Return TypeDescription
ArrayAn array of bodies in attack range.