Module AI_Cas

Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Air -- This module contains the AICASZONE class.

Banner Image

Examples can be found in the test missions.


1) #AICASZONE class, extends AI.AIPatrol#AIPATROLZONE

#AICASZONE derives from the AI.AIPatrol#AIPATROLZONE, inheriting its methods and behaviour.

The #AICASZONE class implements the core functions to provide Close Air Support in an Engage Zone by an AIR Controllable or Group. The AICASEZONE is assigned a @(Group) and this must be done before the AICASZONE process can be started through the Start event.

Upon started, The AI will Route itself towards the random 3D point within a patrol zone, using a random speed within the given altitude and speed limits. Upon arrival at the 3D point, a new random 3D point will be selected within the patrol zone using the given limits. This cycle will continue until a fuel or damage treshold has been reached by the AI, or when the AI is commanded to RTB.

When the AI is commanded to provide Close Air Support (through the event Engage), the AI will fly towards the Engage Zone. Any target that is detected in the Engage Zone will be reported and will be destroyed by the AI.

Note that the AI does not know when the Engage Zone is cleared, and therefore will keep circling in the zone until it is notified through the event Accomplish, which is to be triggered by an observing party:

  • a FAC
  • a timed event
  • a menu option selected by a human
  • a condition
  • others ...

When the AI has accomplished the CAS, it will fly back to the Patrol Zone. It will keep patrolling there, until it is notified to RTB or move to another CAS Zone. It can be notified to go RTB through the RTB event.

When the fuel treshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.

1.1) AICASZONE constructor

1.2) AICASZONE is a FSM

Process

1.2.1) AICASZONE States

  • None ( Group ): The process is not started yet.
  • Patrolling ( Group ): The AI is patrolling the Patrol Zone.
  • Engaging ( Group ): The AI is engaging the targets in the Engage Zone, executing CAS.
  • Returning ( Group ): The AI is returning to Base..

1.2.2) AICASZONE Events:

  • Start ( Group ): Start the process.
  • Route ( Group ): Route the AI to a new random 3D point within the Patrol Zone.
  • Engage ( Group ): Engage the AI to provide CAS in the Engage Zone, destroying any target it finds.
  • RTB ( Group ): Route the AI to the home base.
  • Detect ( Group ): The AI is detecting targets.
  • Detected ( Group ): The AI has detected new targets.
  • Status ( Group ): The AI is checking status (fuel and damage). When the tresholds have been reached, the AI will RTB.

API CHANGE HISTORY

The underlying change log documents the API changes. Please read this carefully. The following notation is used:

  • Added parts are expressed in bold type face.
  • Removed parts are expressed in italic type face.

Hereby the change log:

2017-01-15: Initial class and API.


AUTHORS and CONTRIBUTIONS

Contributions:

  • Quax: Concept, Advice & Testing.
  • Pikey: Concept, Advice & Testing.

Authors:

  • FlightControl: Concept, Design & Programming.

Global(s)

AI_CAS_ZONE
_NewEngageRoute(AIControllable)

Type AI_CAS_ZONE

AI_CAS_ZONE.AIControllable

The Controllable patrolling.

AI_CAS_ZONE:Abort()

Synchronous Event Trigger for Event Abort.

AI_CAS_ZONE:Accomplish()

Synchronous Event Trigger for Event Accomplish.

AI_CAS_ZONE.Accomplished
AI_CAS_ZONE.ClassName
AI_CAS_ZONE:Destroy()

Synchronous Event Trigger for Event Destroy.

AI_CAS_ZONE.DetectUnits
AI_CAS_ZONE:Engage()

Synchronous Event Trigger for Event Engage.

AI_CAS_ZONE.EngageZone
AI_CAS_ZONE:Fired()

Synchronous Event Trigger for Event Fired.

AI_CAS_ZONE:New(PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageZone)

Creates a new AICASZONE object

AI_CAS_ZONE:OnAfterAbort(Controllable, From, Event, To)

OnAfter Transition Handler for Event Abort.

AI_CAS_ZONE:OnAfterAccomplish(Controllable, From, Event, To)

OnAfter Transition Handler for Event Accomplish.

AI_CAS_ZONE:OnAfterDestroy(Controllable, From, Event, To)

OnAfter Transition Handler for Event Destroy.

AI_CAS_ZONE:OnAfterEngage(Controllable, From, Event, To)

OnAfter Transition Handler for Event Engage.

AI_CAS_ZONE:OnAfterFired(Controllable, From, Event, To)

OnAfter Transition Handler for Event Fired.

AI_CAS_ZONE:OnBeforeAbort(Controllable, From, Event, To)

OnBefore Transition Handler for Event Abort.

AI_CAS_ZONE:OnBeforeAccomplish(Controllable, From, Event, To)

OnBefore Transition Handler for Event Accomplish.

AI_CAS_ZONE:OnBeforeDestroy(Controllable, From, Event, To)

OnBefore Transition Handler for Event Destroy.

AI_CAS_ZONE:OnBeforeEngage(Controllable, From, Event, To)

OnBefore Transition Handler for Event Engage.

AI_CAS_ZONE:OnBeforeFired(Controllable, From, Event, To)

OnBefore Transition Handler for Event Fired.

AI_CAS_ZONE:OnDead(EventData)
AI_CAS_ZONE:OnEnterEngaging(Controllable, From, Event, To)

OnEnter Transition Handler for State Engaging.

AI_CAS_ZONE:OnLeaveEngaging(Controllable, From, Event, To)

OnLeave Transition Handler for State Engaging.

AI_CAS_ZONE.TargetZone

The Zone where the patrol needs to be executed.

AI_CAS_ZONE:__Abort(Delay)

Asynchronous Event Trigger for Event Abort.

AI_CAS_ZONE:__Accomplish(Delay)

Asynchronous Event Trigger for Event Accomplish.

AI_CAS_ZONE:__Destroy(Delay)

Asynchronous Event Trigger for Event Destroy.

AI_CAS_ZONE:__Engage(Delay)

Asynchronous Event Trigger for Event Engage.

AI_CAS_ZONE:__Fired(Delay)

Asynchronous Event Trigger for Event Fired.

AI_CAS_ZONE:onafterAccomplish(Controllable, From, Event, To)
AI_CAS_ZONE:onafterDestroy(Controllable, From, Event, To, EventData)
AI_CAS_ZONE:onafterEngage(Controllable, From, Event, To)
AI_CAS_ZONE:onafterStart(Controllable, From, Event, To)

onafter State Transition for Event Start.

AI_CAS_ZONE:onbeforeEngage(Controllable, From, Event, To)

Global(s)

#AI_CAS_ZONE AI_CAS_ZONE
_NewEngageRoute(AIControllable)

Parameter

Type AI_Cas

Type AI_CAS_ZONE

AICASZONE class

Field(s)

Wrapper.Controllable#CONTROLLABLE AI_CAS_ZONE.AIControllable

The Controllable patrolling.

AI_CAS_ZONE:Abort()

Synchronous Event Trigger for Event Abort.

AI_CAS_ZONE:Accomplish()

Synchronous Event Trigger for Event Accomplish.

#boolean AI_CAS_ZONE.Accomplished
#string AI_CAS_ZONE.ClassName
AI_CAS_ZONE:Destroy()

Synchronous Event Trigger for Event Destroy.

#boolean AI_CAS_ZONE.DetectUnits
AI_CAS_ZONE:Engage()

Synchronous Event Trigger for Event Engage.

AI_CAS_ZONE.EngageZone
AI_CAS_ZONE:Fired()

Synchronous Event Trigger for Event Fired.

AI_CAS_ZONE:New(PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageZone)

Creates a new AICASZONE object

Parameters

Return value

#AICASZONE: self

AI_CAS_ZONE:OnAfterAbort(Controllable, From, Event, To)

OnAfter Transition Handler for Event Abort.

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

AI_CAS_ZONE:OnAfterAccomplish(Controllable, From, Event, To)

OnAfter Transition Handler for Event Accomplish.

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

AI_CAS_ZONE:OnAfterDestroy(Controllable, From, Event, To)

OnAfter Transition Handler for Event Destroy.

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

AI_CAS_ZONE:OnAfterEngage(Controllable, From, Event, To)

OnAfter Transition Handler for Event Engage.

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

AI_CAS_ZONE:OnAfterFired(Controllable, From, Event, To)

OnAfter Transition Handler for Event Fired.

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

AI_CAS_ZONE:OnBeforeAbort(Controllable, From, Event, To)

OnBefore Transition Handler for Event Abort.

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

Return value

#boolean: Return false to cancel Transition.

AI_CAS_ZONE:OnBeforeAccomplish(Controllable, From, Event, To)

OnBefore Transition Handler for Event Accomplish.

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

Return value

#boolean: Return false to cancel Transition.

AI_CAS_ZONE:OnBeforeDestroy(Controllable, From, Event, To)

OnBefore Transition Handler for Event Destroy.

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

Return value

#boolean: Return false to cancel Transition.

AI_CAS_ZONE:OnBeforeEngage(Controllable, From, Event, To)

OnBefore Transition Handler for Event Engage.

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

Return value

#boolean: Return false to cancel Transition.

AI_CAS_ZONE:OnBeforeFired(Controllable, From, Event, To)

OnBefore Transition Handler for Event Fired.

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

Return value

#boolean: Return false to cancel Transition.

AI_CAS_ZONE:OnDead(EventData)

Parameter

AI_CAS_ZONE:OnEnterEngaging(Controllable, From, Event, To)

OnEnter Transition Handler for State Engaging.

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

AI_CAS_ZONE:OnLeaveEngaging(Controllable, From, Event, To)

OnLeave Transition Handler for State Engaging.

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

Return value

#boolean: Return false to cancel Transition.

Core.Zone#ZONE_BASE AI_CAS_ZONE.TargetZone

The Zone where the patrol needs to be executed.

AI_CAS_ZONE:__Abort(Delay)

Asynchronous Event Trigger for Event Abort.

Parameter

  • #number Delay : The delay in seconds.

AI_CAS_ZONE:__Accomplish(Delay)

Asynchronous Event Trigger for Event Accomplish.

Parameter

  • #number Delay : The delay in seconds.

AI_CAS_ZONE:__Destroy(Delay)

Asynchronous Event Trigger for Event Destroy.

Parameter

  • #number Delay : The delay in seconds.

AI_CAS_ZONE:__Engage(Delay)

Asynchronous Event Trigger for Event Engage.

Parameter

  • #number Delay : The delay in seconds.

AI_CAS_ZONE:__Fired(Delay)

Asynchronous Event Trigger for Event Fired.

Parameter

  • #number Delay : The delay in seconds.

AI_CAS_ZONE:onafterAccomplish(Controllable, From, Event, To)

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

AI_CAS_ZONE:onafterDestroy(Controllable, From, Event, To, EventData)

Parameters

AI_CAS_ZONE:onafterEngage(Controllable, From, Event, To)

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

AI_CAS_ZONE:onafterStart(Controllable, From, Event, To)

onafter State Transition for Event Start.

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

AI_CAS_ZONE:onbeforeEngage(Controllable, From, Event, To)

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.