Module AI_Cap
Single-Player:Yes / Multi-Player:Yes / AI:Yes / Human:No / Types:Air -- Execute Combat Air Patrol (CAP).
1) #AICAPZONE class, extends AICAP#AIPATROL_ZONE
The #AICAPZONE class implements the core functions to patrol a Zone by an AI Controllable or Group and automatically engage any airborne enemies that are within a certain range or within a certain zone.
The AICAPZONE is assigned a Group and this must be done before the AICAPZONE process can be started using the Start event.
The AI will fly towards the random 3D point within the 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.
During the patrol, the AI will detect enemy targets, which are reported through the Detected event.
When enemies are detected, the AI will automatically engage the enemy.
Until a fuel or damage treshold has been reached by the AI, or when the AI is commanded to RTB. When the fuel treshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.
1.1) AICAPZONE constructor
- AICAPZONE.New(): Creates a new AICAPZONE object.
1.2) AICAPZONE is a FSM
1.2.1) AICAPZONE 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 bogeys.
- Returning ( Group ): The AI is returning to Base..
1.2.2) AICAPZONE Events
- **AIPatrol#AIPATROL_ZONE.Start**: Start the process.
- **AIPatrol#AIPATROL_ZONE.Route**: Route the AI to a new random 3D point within the Patrol Zone.
- **AICAPZONE.Engage**: Let the AI engage the bogeys.
- **AICAPZONE.Abort**: Aborts the engagement and return patrolling in the patrol zone.
- **AIPatrol#AIPATROL_ZONE.RTB**: Route the AI to the home base.
- **AIPatrol#AIPATROL_ZONE.Detect**: The AI is detecting targets.
- **AIPatrol#AIPATROL_ZONE.Detected**: The AI has detected new targets.
- **AICAPZONE.Destroy**: The AI has destroyed a bogey Unit.
- **AICAPZONE.Destroyed**: The AI has destroyed all bogeys Units assigned in the CAS task.
- Status ( Group ): The AI is checking status (fuel and damage). When the tresholds have been reached, the AI will RTB.
1.3) Set the Range of Engagement
An optional range can be set in meters, that will define when the AI will engage with the detected airborne enemy targets. The range can be beyond or smaller than the range of the Patrol Zone. The range is applied at the position of the AI. Use the method AICAP#AICAP_ZONE.SetEngageRange() to define that range.
1.4) Set the Zone of Engagement
An optional Zone can be set, that will define when the AI will engage with the detected airborne enemy targets. Use the method AICap#AICAP_ZONE.SetEngageZone() to define that Zone.
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.
- Gunterlund: Test case revision.
- **Whisper: Testing.
- **Delta99: Testing.
Authors:
- FlightControl: Concept, Design & Programming.
Global(s)
| AI_CAP_ZONE | |
| _NewEngageCapRoute(AIControllable) |
Type AI_CAP_ZONE
Global(s)
- _NewEngageCapRoute(AIControllable)
-
Parameter
-
Wrapper.Controllable#CONTROLLABLE AIControllable:
-
Type AI_Cap
Type AI_CAP_ZONE
AICAPZONE class
Field(s)
- Wrapper.Controllable#CONTROLLABLE AI_CAP_ZONE.AIControllable
-
The Controllable patrolling.
- AI_CAP_ZONE:Abort()
-
Synchronous Event Trigger for Event Abort.
- AI_CAP_ZONE:Accomplish()
-
Synchronous Event Trigger for Event Accomplish.
- #boolean AI_CAP_ZONE.Accomplished
- #string AI_CAP_ZONE.ClassName
- AI_CAP_ZONE:Destroy()
-
Synchronous Event Trigger for Event Destroy.
- AI_CAP_ZONE:Engage()
-
Synchronous Event Trigger for Event Engage.
- #boolean AI_CAP_ZONE.Engaging
- AI_CAP_ZONE:Fired()
-
Synchronous Event Trigger for Event Fired.
- AI_CAP_ZONE:New(PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType)
-
Creates a new AICAPZONE object
Parameters
-
Core.Zone#ZONE_BASE PatrolZone: The Zone where the patrol needs to be executed. -
Dcs.DCSTypes#Altitude PatrolFloorAltitude: The lowest altitude in meters where to execute the patrol. -
Dcs.DCSTypes#Altitude PatrolCeilingAltitude: The highest altitude in meters where to execute the patrol. -
Dcs.DCSTypes#Speed PatrolMinSpeed: The minimum speed of the Controllable in km/h. -
Dcs.DCSTypes#Speed PatrolMaxSpeed: The maximum speed of the Controllable in km/h. -
Dcs.DCSTypes#AltitudeType PatrolAltType: The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to RADIO
Return value
#AICAPZONE: self
-
- AI_CAP_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_CAP_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_CAP_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_CAP_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_CAP_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_CAP_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_CAP_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_CAP_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_CAP_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_CAP_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_CAP_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_CAP_ZONE:OnEventDead(EventData)
-
Parameter
-
Core.Event#EVENTDATA EventData:
-
- AI_CAP_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.
-
- AI_CAP_ZONE:SetEngageRange(EngageRange)
-
Set the Engage Range when the AI will engage with airborne enemies.
Parameter
-
#number EngageRange: The Engage Range.
Return value
#AICAPZONE: self
-
- AI_CAP_ZONE:SetEngageZone(EngageZone)
-
Set the Engage Zone which defines where the AI will engage bogies.
Parameter
-
Core.Zone#ZONE EngageZone: The zone where the AI is performing CAP.
Return value
#AICAPZONE: self
-
- Core.Zone#ZONE_BASE AI_CAP_ZONE.TargetZone
-
The Zone where the patrol needs to be executed.
- AI_CAP_ZONE:__Abort(Delay)
-
Asynchronous Event Trigger for Event Abort.
Parameter
-
#number Delay: The delay in seconds.
-
- AI_CAP_ZONE:__Accomplish(Delay)
-
Asynchronous Event Trigger for Event Accomplish.
Parameter
-
#number Delay: The delay in seconds.
-
- AI_CAP_ZONE:__Destroy(Delay)
-
Asynchronous Event Trigger for Event Destroy.
Parameter
-
#number Delay: The delay in seconds.
-
- AI_CAP_ZONE:__Engage(Delay)
-
Asynchronous Event Trigger for Event Engage.
Parameter
-
#number Delay: The delay in seconds.
-
- AI_CAP_ZONE:__Fired(Delay)
-
Asynchronous Event Trigger for Event Fired.
Parameter
-
#number Delay: The delay in seconds.
-
- AI_CAP_ZONE:onafterAbort(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_CAP_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_CAP_ZONE:onafterDestroy(Controllable, From, Event, To, EventData)
-
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. -
Core.Event#EVENTDATA EventData:
-
- AI_CAP_ZONE:onafterDetected(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_CAP_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_CAP_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_CAP_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.
-