Module TrackHits

(SP) (MP) (FSM) Detect, count and report successful hits to DCS objects.


#ACCOUNT FSM class, extends Process#PROCESS

The #ACCOUNT_DEADS class detects, counts and reports successful hits to DCS objects. The process is given a Set of units that will be tracked upon successful destruction. The process will end after each target has been successfully destroyed. Each successful destruction will trigger a status change.

1.1) ACCOUNT_DEADS constructor:

1.2) ACCOUNT state machine:

The ACCOUNT is a state machine: it manages the different events and states of the Controllable it is controlling.

1.2.1) ACCOUNT Events:

Event methods are available (dynamically allocated by the state machine), that accomodate for state transitions to occur in the process. There are two types of event methods:

  • Immediate: The event method has exactly the name of the event.
  • Delayed: The event method starts with a __ + the name of the event. The first parameter of the event method is a number value, expressing the delay in seconds when the event will be executed.

These are the events defined in this class:

  • Start: The process is started. The process will go into the Waiting state.
  • Event: A relevant event has occured that needs to be accounted for. The process will go into the Account state.
  • More: There are more DCS events that need to be accounted for. The process will go back into the Waiting state.
  • NoMore: There are no more DCS events that need to be accounted for. The process will go into the Success state.

1.2.2) ACCOUNT States:

  • Assigned: The player is assigned to the task. This is the initialization state for the process.
  • Waiting: The process is awaiting an DCS event to occur within the simulator. This event is called automatically every 1 second.
  • Account: The relevant DCS event has occurred, and is accounted for.
  • Success (*): All DCS events were accounted for.
  • Failed (*): The process has failed.

(*) End states of the process.

1.2.3) ACCOUNT_DEADS state transition functions:

State transition functions can be set by the mission designer customizing or improving the behaviour of the state. There are 2 moments when state transition functions will be called by the state machine:

  • Before the state transition. The state transition function needs to start with the name OnBefore + the name of the state. If the state transition function returns false, then the processing of the state transition will not be done! If you want to change the behaviour of the AIControllable at this event, return false, but then you'll need to specify your own logic using the AIControllable!

  • After the state transition. The state transition function needs to start with the name OnAfter + the name of the state. These state transition functions need to provide a return value, which is specified at the function description.

1.3) Manage the ACCOUNT_DEADS parameters:

The following methods are available to modify the parameters of a ACCOUNT_DEADS object:

Global(s)

ACCOUNT_DEADS

Type ACCOUNT_DEADS

ACCOUNT_DEADS.ClassName
ACCOUNT_DEADS.DisplayCategory
ACCOUNT_DEADS.DisplayCount
ACCOUNT_DEADS.DisplayInterval
ACCOUNT_DEADS.DisplayMessage
ACCOUNT_DEADS.DisplayTime
ACCOUNT_DEADS:EventDead(Event)
ACCOUNT_DEADS.Fsm
ACCOUNT_DEADS:New(ProcessUnit, TargetSetUnit, TaskName)

Creates a new DESTROY process.

ACCOUNT_DEADS:OnDestroyed(ProcessUnit, Event, From, To)

StateMachine callback function

ACCOUNT_DEADS:OnHitTarget(ProcessUnit, Event, From, To)

StateMachine callback function

ACCOUNT_DEADS:OnKilled(ProcessUnit, Event, From, To)

StateMachine callback function

ACCOUNT_DEADS:OnMoreTargets(ProcessUnit, Event, From, To)

StateMachine callback function

ACCOUNT_DEADS:OnRestart(ProcessUnit, Event, From, To)

StateMachine callback function

ACCOUNT_DEADS:OnStart(ProcessUnit, Event, From, To)

StateMachine callback function

ACCOUNT_DEADS:OnWaiting(ProcessUnit, Event, From, To)

StateMachine callback function

ACCOUNT_DEADS.TargetSetUnit
ACCOUNT_DEADS.TaskName

Type ASSIGN_MENU_ACCEPT

ASSIGN_MENU_ACCEPT.DisplayCount

Global(s)

#ACCOUNT_DEADS ACCOUNT_DEADS

Type TrackHits

Type ACCOUNT_DEADS

ACCOUNT_DEADS class

Field(s)

#string ACCOUNT_DEADS.ClassName
#string ACCOUNT_DEADS.DisplayCategory

Targets is the default display category

#number ACCOUNT_DEADS.DisplayCount
#number ACCOUNT_DEADS.DisplayInterval
#boolean ACCOUNT_DEADS.DisplayMessage
#number ACCOUNT_DEADS.DisplayTime

10 seconds is the default

ACCOUNT_DEADS:EventDead(Event)

Parameter

ACCOUNT_DEADS.Fsm
ACCOUNT_DEADS:New(ProcessUnit, TargetSetUnit, TaskName)

Creates a new DESTROY process.

Parameters

Return value

#ACCOUNT_DEADS: self

ACCOUNT_DEADS:OnDestroyed(ProcessUnit, Event, From, To)

StateMachine callback function

Parameters

ACCOUNT_DEADS:OnHitTarget(ProcessUnit, Event, From, To)

StateMachine callback function

Parameters

ACCOUNT_DEADS:OnKilled(ProcessUnit, Event, From, To)

StateMachine callback function

Parameters

ACCOUNT_DEADS:OnMoreTargets(ProcessUnit, Event, From, To)

StateMachine callback function

Parameters

ACCOUNT_DEADS:OnRestart(ProcessUnit, Event, From, To)

StateMachine callback function

Parameters

ACCOUNT_DEADS:OnStart(ProcessUnit, Event, From, To)

StateMachine callback function

Parameters

ACCOUNT_DEADS:OnWaiting(ProcessUnit, Event, From, To)

StateMachine callback function

Parameters

Set#SET_UNIT ACCOUNT_DEADS.TargetSetUnit
ACCOUNT_DEADS.TaskName

Type ASSIGN_MENU_ACCEPT

Field(s)

#number ASSIGN_MENU_ACCEPT.DisplayCount