Banner Image

Module Tasking.Task_Cargo_CSAR

Tasking -- Orchestrates the task for players to execute CSAR for downed pilots.

Specific features:

  • Creates a task to retrieve a pilot Cargo.Cargo from behind enemy lines.
  • Derived from the TASK_CARGO class, which is derived from the TASK class.
  • Orchestrate the task flow, so go from Planned to Assigned to Success, Failed or Cancelled.
  • Co-operation tasking, so a player joins a group of players executing the same task.

A complete task menu system to allow players to:

  • Join the task, abort the task.
  • Mark the task location on the map.
  • Provide details of the target.
  • Route to the cargo.
  • Route to the deploy zones.
  • Load/Unload cargo.
  • Board/Unboard cargo.
  • Slingload cargo.
  • Display the task briefing.

A complete mission menu system to allow players to:

  • Join a task, abort the task.
  • Display task reports.
  • Display mission statistics.
  • Mark the task locations on the map.
  • Provide details of the targets.
  • Display the mission briefing.
  • Provide status updates as retrieved from the command center.
  • Automatically assign a random task as part of a mission.
  • Manually assign a specific task as part of a mission.

A settings system, using the settings menu:

  • Tweak the duration of the display of messages.
  • Switch between metric and imperial measurement system.
  • Switch between coordinate formats used in messages: BR, BRA, LL DMS, LL DDM, MGRS.
  • Different settings modes for A2G and A2A operations.
  • Various other options.

Please read through the Tasking.Task_Cargo process to understand the mechanisms of tasking and cargo tasking and handling.

The cargo will be a downed pilot, which is located somwhere on the battlefield. Use the menus system and facilities to join the CSAR task, and retrieve the pilot from behind enemy lines. The menu system is generic, there is nothing specific on a CSAR task that requires further explanation, than reading the generic TASK_CARGO explanations.

Enjoy! FC


Author: FlightControl

Contributions:


Global(s)

Global TASK_CARGO_CSAR

Orchestrates the task for players to execute CSAR for downed pilots.

#TASK_CARGO_CSAR TASK_CARGO_CSAR

Orchestrates the task for players to execute CSAR for downed pilots.

CSAR tasks are suited to govern the process of return downed pilots behind enemy lines back to safetly. Typically, this task is executed by helicopter pilots, but it can also be executed by ground forces!


A CSAR task can be created manually, but actually, it is better to GENERATE these tasks using the Tasking.Task_Cargo_Dispatcher module.

Using the dispatcher, CSAR tasks will be created automatically when a pilot ejects from a damaged AI aircraft. When this happens, the pilot actually will survive, but needs to be retrieved from behind enemy lines.

1) Create a CSAR task manually (code it).

Although it is recommended to use the dispatcher, you can create a CSAR task yourself as a mission designer. It is easy, as it works just like any other task setup.

1.1) Create a command center.

First you need to create a command center using the Tasking.CommandCenter#COMMANDCENTER.New() constructor.

local CommandCenter = COMMANDCENTER
   :New( HQ, "Lima" ) -- Create the CommandCenter.

1.2) Create a mission.

Tasks work in a mission, which groups these tasks to achieve a joint mission goal. A command center can govern multiple missions. Create a new mission, using the Tasking.Mission#MISSION.New() constructor.

-- Declare the Mission for the Command Center.
local Mission = MISSION
  :New( CommandCenter, 
        "Overlord", 
        "High", 
        "Retrieve the downed pilots.", 
        coalition.side.RED 
      ) 

1.3) Create the CSAR cargo task.

So, now that we have a command center and a mission, we now create the CSAR task. We create the CSAR task using the TASK_CARGO_CSAR.New() constructor.

Because a CSAR task will not generate the cargo itself, you'll need to create it first. The cargo in this case will be the downed pilot!

-- Here we define the "cargo set", which is a collection of cargo objects.
-- The cargo set will be the input for the cargo transportation task.
-- So a transportation object is handling a cargo set, which is automatically refreshed when new cargo is added/deleted.
local CargoSet = SET_CARGO:New():FilterTypes( "Pilots" ):FilterStart()

-- Now we add cargo into the battle scene.
local PilotGroup = GROUP:FindByName( "Pilot" )

-- CARGO_GROUP can be used to setup cargo with a GROUP object underneath.
-- We name this group Engineers.
-- Note that the name of the cargo is "Engineers".
-- The cargoset "CargoSet" will embed all defined cargo of type "Pilots" (prefix) into its set.
local CargoGroup = CARGO_GROUP:New( PilotGroup, "Pilots", "Downed Pilot", 500 )

What is also needed, is to have a set of Core.Groups defined that contains the clients of the players.

-- Allocate the Transport, which are the helicopter to retrieve the pilot, that can be manned by players.
local GroupSet = SET_GROUP:New():FilterPrefixes( "Transport" ):FilterStart()

Now that we have a CargoSet and a GroupSet, we can now create the CSARTask manually.

-- Declare the CSAR task.
local CSARTask = TASK_CARGO_CSAR
  :New( Mission, 
        GroupSet, 
        "CSAR Pilot", 
        CargoSet, 
        "Fly behind enemy lines, and retrieve the downed pilot." 
      )

So you can see, setting up a CSAR task manually is a lot of work. It is better you use the cargo dispatcher to generate CSAR tasks and it will work as it is intended. By doing this, CSAR tasking will become a dynamic experience.

2) Create a task using the Tasking.Task_Cargo_Dispatcher module.

Actually, it is better to GENERATE these tasks using the Tasking.Task_Cargo_Dispatcher module. Using the dispatcher module, transport tasks can be created much more easy.

Find below an example how to use the TASK_CARGO_DISPATCHER class:

 -- Find the HQ group.
 HQ = GROUP:FindByName( "HQ", "Bravo" )

 -- Create the command center with the name "Lima".
 CommandCenter = COMMANDCENTER
   :New( HQ, "Lima" )

 -- Create the mission, for the command center, with the name "CSAR Mission", a "Tactical" mission, with the mission briefing "Rescue downed pilots.", for the RED coalition.
 Mission = MISSION
   :New( CommandCenter, "CSAR Mission", "Tactical", "Rescue downed pilots.", coalition.side.RED )

 -- Create the SET of GROUPs containing clients (players) that will transport the cargo.
 -- These are have a name that start with "Rescue" and are of the "red" coalition.
 AttackGroups = SET_GROUP:New():FilterCoalitions( "red" ):FilterPrefixes( "Rescue" ):FilterStart()


 -- Here we create the TASK_CARGO_DISPATCHER object! This is where we assign the dispatcher to generate tasks in the Mission for the AttackGroups.
 TaskDispatcher = TASK_CARGO_DISPATCHER:New( Mission, AttackGroups )


 -- Here the task dispatcher will generate automatically CSAR tasks once a pilot ejects.
 TaskDispatcher:StartCSARTasks( 
   "CSAR", 
   { ZONE_UNIT:New( "Hospital", STATIC:FindByName( "Hospital" ), 100 ) }, 
   "One of our pilots has ejected. Go out to Search and Rescue our pilot!\n" .. 
   "Use the radio menu to let the command center assist you with the CSAR tasking."
 )

3) Handle cargo task events.

When a player is picking up and deploying cargo using his carrier, events are generated by the tasks. These events can be captured and tailored with your own code.

In order to properly capture the events and avoid mistakes using the documentation, it is advised that you execute the following actions:

  • Copy / Paste the code section into your script.
  • Change the CLASS literal to the task object name you have in your script.
  • Within the function, you can now write your own code!
  • IntelliSense will recognize the type of the variables provided by the function. Note: the From, Event and To variables can be safely ignored, but you need to declare them as they are automatically provided by the event handling system of MOOSE.

You can send messages or fire off any other events within the code section. The sky is the limit!

NOTE: CSAR tasks are actually automatically created by the TASK_CARGO_DISPATCHER. So the underlying is not really applicable for mission designers as they will use the dispatcher instead of capturing these events from manually created CSAR tasks!

3.1) Handle the CargoPickedUp event.

Find below an example how to tailor the CargoPickedUp event, generated by the CSARTask:

 function CSARTask:OnAfterCargoPickedUp( From, Event, To, TaskUnit, Cargo )

   MESSAGE:NewType( "Unit " .. TaskUnit:GetName().. " has picked up cargo.", MESSAGE.Type.Information ):ToAll()

 end

If you want to code your own event handler, use this code fragment to tailor the event when a player carrier has picked up a cargo object in the CarrierGroup. You can use this event handler to post messages to players, or provide status updates etc.

 --- CargoPickedUp event handler OnAfter for CLASS.
 -- @param #CLASS self
 -- @param #string From A string that contains the "*from state name*" when the event was triggered.
 -- @param #string Event A string that contains the "*event name*" when the event was triggered.
 -- @param #string To A string that contains the "*to state name*" when the event was triggered.
 -- @param Wrapper.Unit#UNIT TaskUnit The unit (client) of the player that has picked up the cargo.
 -- @param Cargo.Cargo#CARGO Cargo The cargo object that has been picked up. Note that this can be a CARGO_GROUP, CARGO_CRATE or CARGO_SLINGLOAD object!
 function CLASS:OnAfterCargoPickedUp( From, Event, To, TaskUnit, Cargo )

   -- Write here your own code.

 end

3.2) Handle the CargoDeployed event.

Find below an example how to tailor the CargoDeployed event, generated by the CSARTask:

 function CSARTask:OnAfterCargoDeployed( From, Event, To, TaskUnit, Cargo, DeployZone )

   MESSAGE:NewType( "Unit " .. TaskUnit:GetName().. " has deployed cargo at zone " .. DeployZone:GetName(), MESSAGE.Type.Information ):ToAll()

 end

If you want to code your own event handler, use this code fragment to tailor the event when a player carrier has deployed a cargo object from the CarrierGroup. You can use this event handler to post messages to players, or provide status updates etc.

 --- CargoDeployed event handler OnAfter for CLASS.
 -- @param #CLASS self
 -- @param #string From A string that contains the "*from state name*" when the event was triggered.
 -- @param #string Event A string that contains the "*event name*" when the event was triggered.
 -- @param #string To A string that contains the "*to state name*" when the event was triggered.
 -- @param Wrapper.Unit#UNIT TaskUnit The unit (client) of the player that has deployed the cargo.
 -- @param Cargo.Cargo#CARGO Cargo The cargo object that has been deployed. Note that this can be a CARGO_GROUP, CARGO_CRATE or CARGO_SLINGLOAD object!
 -- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE.
 function CLASS:OnAfterCargoDeployed( From, Event, To, TaskUnit, Cargo, DeployZone )

   -- Write here your own code.

 end

Type(s)

Fields and Methods inherited from TASK_CARGO Description

TASK_CARGO_CSAR:AddDeployZone(DeployZone, TaskUnit)

TASK_CARGO_CSAR.CargoItemCount

TASK_CARGO_CSAR.CargoLimit

TASK_CARGO_CSAR.DeployZones

TASK_CARGO_CSAR:GetAutoAssignPriority(AutoAssignMethod, TaskGroup)

This function is called from the Tasking.CommandCenter#COMMANDCENTER to determine the method of automatic task selection.

TASK_CARGO_CSAR:GetCargoSet()

TASK_CARGO_CSAR:GetDeployZones()

TASK_CARGO_CSAR:GetGoalTotal()

TASK_CARGO_CSAR:GetPlannedMenuText()

TASK_CARGO_CSAR:GetSmokeColor()

TASK_CARGO_CSAR:GetTargetZone(TaskUnit)

TASK_CARGO_CSAR:New(Mission, SetGroup, TaskName, SetCargo, TaskType, TaskBriefing)

Instantiates a new TASK_CARGO.

TASK_CARGO_CSAR:OnAfterCargoDeployed(From, Event, To, TaskUnit, Cargo, DeployZone)

CargoDeployed Handler OnAfter for TASK_CARGO

TASK_CARGO_CSAR:OnAfterCargoPickedUp(From, Event, To, TaskUnit, Cargo)

CargoPickedUp Handler OnAfter for TASK_CARGO

TASK_CARGO_CSAR:OnBeforeCargoDeployed(From, Event, To, TaskUnit, Cargo, DeployZone)

CargoDeployed Handler OnBefore for TASK_CARGO

TASK_CARGO_CSAR:OnBeforeCargoPickedUp(From, Event, To, TaskUnit, Cargo)

CargoPickedUp Handler OnBefore for TASK_CARGO

TASK_CARGO_CSAR:RemoveDeployZone(DeployZone, TaskUnit)

TASK_CARGO_CSAR:ReportOrder(ReportGroup)

TASK_CARGO_CSAR.SetCargo

TASK_CARGO_CSAR:SetCargoLimit(CargoLimit)

Set a limit on the amount of cargo items that can be loaded into the Carriers.

TASK_CARGO_CSAR:SetCargoPickup(Cargo, TaskUnit)

TASK_CARGO_CSAR:SetDeployZone(DeployZone, TaskUnit)

TASK_CARGO_CSAR:SetDeployZones(DeployZones, TaskUnit)

TASK_CARGO_CSAR:SetGoalTotal()

TASK_CARGO_CSAR:SetScoreOnFail(Text, Penalty, TaskUnit)

Set a penalty when the task goals have failed..

TASK_CARGO_CSAR:SetScoreOnProgress(Text, Score, TaskUnit)

Set a score when progress is made.

TASK_CARGO_CSAR:SetScoreOnSuccess(Text, Score, TaskUnit)

Set a score when success is achieved.

TASK_CARGO_CSAR.SetSmokeColor(Color, self, SmokeColor)

TASK_CARGO_CSAR.SmokeColor

TASK_CARGO_CSAR.TaskType

TASK_CARGO_CSAR:UpdateTaskInfo()

Fields and Methods inherited from TASK Description

TASK_CARGO_CSAR:Abort()

FSM Abort synchronous event function for TASK.

TASK_CARGO_CSAR:AbortGroup(PlayerGroup)

A group aborting the task.

TASK_CARGO_CSAR:AddGroups(GroupSet)

Gets the SET_GROUP assigned to the TASK.

TASK_CARGO_CSAR:AddProgress(PlayerName, ProgressText, ProgressTime, ProgressPoints)

Add Task Progress for a Player Name

TASK_CARGO_CSAR:AssignToGroup(TaskGroup)

Assign the Task to a Wrapper.Group.

TASK_CARGO_CSAR:AssignToUnit(TaskUnit)

Assign the Task to an alive Wrapper.Unit.

TASK_CARGO_CSAR:Cancel()

FSM Cancel synchronous event function for TASK.

TASK_CARGO_CSAR:ClearGroupAssignment(TaskGroup)

Clear the Wrapper.Group assignment from the Task.

TASK_CARGO_CSAR.CommandCenter

TASK_CARGO_CSAR:CrashGroup(PlayerGroup)

A group crashing and thus aborting from the task.

TASK_CARGO_CSAR.DetectedItem

TASK_CARGO_CSAR.Detection

TASK_CARGO_CSAR.Dispatcher

TASK_CARGO_CSAR:Fail()

FSM Fail synchronous event function for TASK.

TASK_CARGO_CSAR:FailProcesses(TaskUnitName)

TASK_CARGO_CSAR.FlashTaskScheduleID

TASK_CARGO_CSAR.FlashTaskScheduler

TASK_CARGO_CSAR.FlashTaskStatus

TASK_CARGO_CSAR.FsmTemplate

TASK_CARGO_CSAR:GetBriefing()

Gets the Task briefing.

TASK_CARGO_CSAR:GetGoal()

Get goal of a task

TASK_CARGO_CSAR:GetGroups()

Gets the SET_GROUP assigned to the TASK.

TASK_CARGO_CSAR:GetID()

Gets the ID of the Task

TASK_CARGO_CSAR:GetMission()

Gets the Mission to where the TASK belongs.

TASK_CARGO_CSAR:GetName()

Gets the Name of the Task

TASK_CARGO_CSAR:GetPlayerCount()

Create a count of the players in the Task.

TASK_CARGO_CSAR:GetPlayerNames()

Create a list of the players in the Task.

TASK_CARGO_CSAR:GetPlayerProgress(PlayerName)

TASK_CARGO_CSAR:GetProcessTemplate(ProcessName)

Get the default or currently assigned Process template with key ProcessName.

TASK_CARGO_CSAR:GetScoring()

Gets the Scoring of the task

TASK_CARGO_CSAR:GetStateMachine(TaskUnit)

Gets the FiniteStateMachine of Task with key TaskWrapper.Unit

TASK_CARGO_CSAR:GetStateString()

Gets the Task status.

TASK_CARGO_CSAR:GetTaskBriefing()

Returns the Task briefing.

TASK_CARGO_CSAR:GetTaskControlMenu(TaskUnit, TaskName)

Get Task Control Menu

TASK_CARGO_CSAR:GetTaskIndex()

Gets the Task Index, which is a combination of the Task type, the Task name.

TASK_CARGO_CSAR:GetTaskName()

Returns the Task name.

TASK_CARGO_CSAR:GetType()

Gets the Type of the Task

TASK_CARGO_CSAR:GetUnitProcess(TaskUnit)

Get the Task FSM Process Template

TASK_CARGO_CSAR:Goal(PlayerUnit, PlayerName)

Goal Trigger for TASK

TASK_CARGO_CSAR:HasAliveUnits()

Returns if the Task has still alive and assigned Units.

TASK_CARGO_CSAR:HasGroup(FindGroup)

TASK_CARGO_CSAR:HasStateMachine(TaskUnit)

Checks if there is a FiniteStateMachine assigned to TaskWrapper.Unit for Task

TASK_CARGO_CSAR:InitTaskControlMenu(TaskUnit)

Init Task Control Menu

TASK_CARGO_CSAR:IsGroupAssigned(TaskGroup)

Returns if the Task is assigned to the Group.

TASK_CARGO_CSAR:IsStateAborted()

Is the Task status Aborted.

TASK_CARGO_CSAR:IsStateAssigned()

Is the Task status Assigned.

TASK_CARGO_CSAR:IsStateCancelled()

Is the Task status Cancelled.

TASK_CARGO_CSAR:IsStateFailed()

Is the Task status Failed.

TASK_CARGO_CSAR:IsStateHold()

Is the Task status Hold.

TASK_CARGO_CSAR:IsStatePlanned()

Is the Task status Planned.

TASK_CARGO_CSAR:IsStateReplanned()

Is the Task status Replanned.

TASK_CARGO_CSAR:IsStateSuccess()

Is the Task status Success.

TASK_CARGO_CSAR:JoinUnit(PlayerUnit, PlayerGroup)

Add a PlayerUnit to join the Task.

TASK_CARGO_CSAR:MenuAssignToGroup(TaskGroup)

TASK_CARGO_CSAR.MenuAssigned

TASK_CARGO_CSAR:MenuFlashTaskStatus(TaskGroup, Flash)

Report the task status.

TASK_CARGO_CSAR:MenuMarkToGroup(TaskGroup)

TASK_CARGO_CSAR.MenuPlanned

TASK_CARGO_CSAR:MenuTaskAbort(TaskGroup)

Report the task status.

TASK_CARGO_CSAR:MenuTaskStatus(TaskGroup)

Report the task status.

TASK_CARGO_CSAR:MessageToGroups(Message)

Send a message of the Task to the assigned Wrapper.Groups.

TASK_CARGO_CSAR.Mission

TASK_CARGO_CSAR:New(Mission, SetGroupAssign, TaskName, TaskType, TaskBriefing)

Instantiates a new TASK.

TASK_CARGO_CSAR:OnAfterGoal(From, Event, To, PlayerUnit, PlayerName)

Goal Handler OnAfter for TASK

TASK_CARGO_CSAR:OnAfterPlayerAborted(PlayerUnit, PlayerName)

FSM PlayerAborted event handler prototype for TASK.

TASK_CARGO_CSAR:OnAfterPlayerCrashed(PlayerUnit, PlayerName)

FSM PlayerCrashed event handler prototype for TASK.

TASK_CARGO_CSAR:OnAfterPlayerDead(PlayerUnit, PlayerName)

FSM PlayerDead event handler prototype for TASK.

TASK_CARGO_CSAR:OnBeforeGoal(From, Event, To, PlayerUnit, PlayerName)

Goal Handler OnBefore for TASK

TASK_CARGO_CSAR:RefreshMenus(TaskGroup, MenuTime)

Remove the menu option of the Task for a Wrapper.Group.

TASK_CARGO_CSAR:RefreshTaskControlMenu(TaskUnit, MenuTime, MenuTag)

Refresh Task Control Menu

TASK_CARGO_CSAR:RejectGroup(PlayerGroup)

A group rejecting a planned task.

TASK_CARGO_CSAR:RemoveAssignedMenuForGroup(TaskGroup, MenuTime)

Remove the assigned menu option of the Task for a Wrapper.Group.

TASK_CARGO_CSAR:RemoveMenu(MenuTime)

Remove the menu options of the Task to all the groups in the SetGroup.

TASK_CARGO_CSAR:RemoveStateMachine(TaskUnit)

Remove FiniteStateMachines from Task with key TaskWrapper.Unit

TASK_CARGO_CSAR:RemoveTaskControlMenu(TaskUnit)

Remove Task Control Menu

TASK_CARGO_CSAR:Replan()

FSM Replan synchronous event function for TASK.

TASK_CARGO_CSAR:ReportDetails(TaskGroup, ReportGroup)

Create a detailed report of the Task.

TASK_CARGO_CSAR:ReportOverview(ReportGroup)

Create an overiew report of the Task.

TASK_CARGO_CSAR:ReportSummary(ReportGroup)

Create a summary report of the Task.

TASK_CARGO_CSAR:SendBriefingToAssignedGroups()

Send the briefng message of the Task to the assigned Wrapper.Groups.

TASK_CARGO_CSAR:SetAssignMethod(AcceptClass)

TASK_CARGO_CSAR:SetAssignedMenuForGroup(TaskGroup, MenuTime)

Set the assigned menu options of the Task.

TASK_CARGO_CSAR:SetBriefing(TaskBriefing)

Sets a Task briefing.

TASK_CARGO_CSAR:SetDetection(Detection, DetectedItem)

Set detection of a task

TASK_CARGO_CSAR:SetDispatcher(Dispatcher)

Set dispatcher of a task

TASK_CARGO_CSAR:SetGoal(Goal)

Set goal of a task

TASK_CARGO_CSAR.SetGroup

The Set of Groups assigned to the Task

TASK_CARGO_CSAR:SetGroupAssigned(TaskGroup)

Set Wrapper.Group assigned to the Task.

TASK_CARGO_CSAR:SetID(TaskID)

Sets the ID of the Task

TASK_CARGO_CSAR:SetMenu(MenuTime)

Set the menu options of the Task to all the groups in the SetGroup.

TASK_CARGO_CSAR:SetMenuForGroup(MenuTime, TaskGroup)

Set the Menu for a Group

TASK_CARGO_CSAR:SetName(TaskName)

Sets the Name of the Task

TASK_CARGO_CSAR:SetPlannedMenuForGroup(TaskGroup, MenuText, MenuTime)

Set the planned menu option of the Task.

TASK_CARGO_CSAR:SetScoreOnFail(PlayerName, Penalty, TaskUnit)

Set a penalty when the A2A attack has failed.

TASK_CARGO_CSAR:SetScoreOnProgress(PlayerName, Score, TaskUnit)

Set a score when progress has been made by the player.

TASK_CARGO_CSAR:SetScoreOnSuccess(PlayerName, Score, TaskUnit)

Set a score when all the targets in scope of the A2A attack, have been destroyed.

TASK_CARGO_CSAR:SetStateMachine(TaskUnit, Fsm)

Add a FiniteStateMachine to Task with key TaskWrapper.Unit

TASK_CARGO_CSAR:SetTimeOut(Timer)

Sets the TimeOut for the Task.

TASK_CARGO_CSAR:SetType(TaskType)

Sets the Type of the Task

TASK_CARGO_CSAR:SetUnitProcess(Core, FsmTemplate)

Sets the Task FSM Process Template

TASK_CARGO_CSAR:StateAborted()

Sets a Task to status Aborted.

TASK_CARGO_CSAR:StateAssigned()

Sets a Task to status Assigned.

TASK_CARGO_CSAR:StateCancelled()

Sets a Task to status Cancelled.

TASK_CARGO_CSAR:StateFailed()

Sets a Task to status Failed.

TASK_CARGO_CSAR:StateHold()

Sets a Task to status Hold.

TASK_CARGO_CSAR:StatePlanned()

Sets a Task to status Planned.

TASK_CARGO_CSAR:StateReplanned()

Sets a Task to status Replanned.

TASK_CARGO_CSAR:StateSuccess()

Sets a Task to status Success.

TASK_CARGO_CSAR:Success()

FSM Success synchronous event function for TASK.

TASK_CARGO_CSAR.TaskBriefing

TASK_CARGO_CSAR.TaskControlMenu

TASK_CARGO_CSAR.TaskControlMenuTime

TASK_CARGO_CSAR.TaskID

TASK_CARGO_CSAR.TaskInfo

TASK_CARGO_CSAR.TaskName

TASK_CARGO_CSAR.TaskProgress

TASK_CARGO_CSAR.TaskScheduler

TASK_CARGO_CSAR.TaskType

TASK_CARGO_CSAR.TimeOut

TASK_CARGO_CSAR:UnAssignFromGroup(TaskGroup)

UnAssign the Task from a Wrapper.Group.

TASK_CARGO_CSAR:UnAssignFromGroups()

UnAssign the Task from the Wrapper.Groups.

TASK_CARGO_CSAR:UnAssignFromUnit(TaskUnit)

UnAssign the Task from an alive Wrapper.Unit.

TASK_CARGO_CSAR:__Abort()

FSM Abort asynchronous event function for TASK.

TASK_CARGO_CSAR:__Cancel()

FSM Cancel asynchronous event function for TASK.

TASK_CARGO_CSAR:__Fail()

FSM Fail asynchronous event function for TASK.

TASK_CARGO_CSAR:__Goal(Delay, PlayerUnit, PlayerName)

Goal Asynchronous Trigger for TASK

TASK_CARGO_CSAR:__Replan()

FSM Replan asynchronous event function for TASK.

TASK_CARGO_CSAR:__Success()

FSM Success asynchronous event function for TASK.

TASK_CARGO_CSAR:onafterReplan(From, Event, To)

FSM function for a TASK

TASK_CARGO_CSAR:onbeforeTimeOut(Event, From, To)

FSM function for a TASK

TASK_CARGO_CSAR:onenterAborted(From, Event, To)

FSM function for a TASK

TASK_CARGO_CSAR:onenterAssigned(Event, From, To, PlayerUnit, PlayerName)

FSM function for a TASK

TASK_CARGO_CSAR:onenterCancelled(From, Event, To)

FSM function for a TASK

TASK_CARGO_CSAR:onenterFailed(From, Event, To)

FSM function for a TASK

TASK_CARGO_CSAR:onenterPlanned(Event, From, To)

FSM function for a TASK

TASK_CARGO_CSAR:onenterSuccess(Event, From, To)

FSM function for a TASK

TASK_CARGO_CSAR:onstatechange(Event, From, To)

FSM function for a TASK

Fields and Methods inherited from FSM_TASK Description

TASK_CARGO_CSAR:New(TaskName)

Creates a new FSM_TASK object.

TASK_CARGO_CSAR.Task

TASK_CARGO_CSAR:_call_handler(step, trigger, params, EventName)

Field(s)

Function(s)

Defined in:

TASK_CARGO_CSAR

Return value:

#boolean:

Instantiates a new TASK_CARGO_CSAR.

Defined in:

TASK_CARGO_CSAR

Parameters:

The set of groups for which the Task can be assigned.

#string TaskName

The name of the Task.

The scope of the cargo to be transported.

#string TaskBriefing

The Cargo Task briefing.

Return value:

OnAfter Transition Handler for Event CargoDeployed.

Defined in:

TASK_CARGO_CSAR

Parameters:

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

The Unit (Client) that Deployed the cargo. You can use this to retrieve the PlayerName etc.

The Cargo that got PickedUp by the TaskUnit. You can use this to check Cargo Status.

Core.Zone#ZONE DeployZone

The zone where the Cargo got Deployed or UnBoarded.

OnAfter Transition Handler for Event CargoPickedUp.

Defined in:

TASK_CARGO_CSAR

Parameters:

#string From

The From State string.

#string Event

The Event string.

#string To

The To State string.

The Unit (Client) that PickedUp the cargo. You can use this to retrieve the PlayerName etc.

The Cargo that got PickedUp by the TaskUnit. You can use this to check Cargo Status.

Defined in:

TASK_CARGO_CSAR

Parameter:

ReportGroup

Defined in:

TASK_CARGO_CSAR

Parameters:

TaskUnit

From

Event

To

Field(s)

Function(s)

This function is called from the Tasking.CommandCenter#COMMANDCENTER to determine the method of automatic task selection.

Defined in:

Parameters:

#number AutoAssignMethod

The method to be applied to the task.

The player group.

Defined in:

Return value:

#list<Core.Zone#ZONE\_BASE>:

The Deployment Zones.

Defined in:

Parameter:

Return value:

The Zone object where the Target is located on the map.

Instantiates a new TASK_CARGO.

Defined in:

Parameters:

The set of groups for which the Task can be assigned.

#string TaskName

The name of the Task.

The scope of the cargo to be transported.

#string TaskType

The type of Cargo task.

#string TaskBriefing

The Cargo Task briefing.

Return value:

self

CargoDeployed Handler OnAfter for TASK_CARGO

Defined in:

Parameters:

#string From

#string Event

#string To

The Unit (Client) that Deployed the cargo. You can use this to retrieve the PlayerName etc.

The Cargo that got PickedUp by the TaskUnit. You can use this to check Cargo Status.

Core.Zone#ZONE DeployZone

The zone where the Cargo got Deployed or UnBoarded.

Usage:


  -- Add a Transport task to transport cargo of different types to a Transport Deployment Zone.
 TaskDispatcher = TASK_CARGO_DISPATCHER:New( Mission, TransportGroups )
 
 local CargoSetWorkmaterials = SET_CARGO:New():FilterTypes( "Workmaterials" ):FilterStart()
 local EngineerCargoGroup = CARGO_GROUP:New( GROUP:FindByName( "Engineers" ), "Workmaterials", "Engineers", 250 )
 local ConcreteCargo = CARGO_SLINGLOAD:New( STATIC:FindByName( "Concrete" ), "Workmaterials", "Concrete", 150, 50 )
 local CrateCargo = CARGO_CRATE:New( STATIC:FindByName( "Crate" ), "Workmaterials", "Crate", 150, 50 )
 local EnginesCargo = CARGO_CRATE:New( STATIC:FindByName( "Engines" ), "Workmaterials", "Engines", 150, 50 )
 local MetalCargo = CARGO_CRATE:New( STATIC:FindByName( "Metal" ), "Workmaterials", "Metal", 150, 50 )
 
 -- Here we add the task. We name the task "Build a Workplace".
 -- We provide the CargoSetWorkmaterials, and a briefing as the 2nd and 3rd parameter.
 -- The :AddTransportTask() returns a Tasking.Task_Cargo_Transport#TASK_CARGO_TRANSPORT object, which we keep as a reference for further actions.
 -- The WorkplaceTask holds the created and returned Tasking.Task_Cargo_Transport#TASK_CARGO_TRANSPORT object.
 local WorkplaceTask = TaskDispatcher:AddTransportTask( "Build a Workplace", CargoSetWorkmaterials, "Transport the workers, engineers and the equipment near the Workplace." )
 
 -- Here we set a TransportDeployZone. We use the WorkplaceTask as the reference, and provide a ZONE object.
 TaskDispatcher:SetTransportDeployZone( WorkplaceTask, ZONE:New( "Workplace" ) )
 
 Helos = { SPAWN:New( "Helicopters 1" ), SPAWN:New( "Helicopters 2" ), SPAWN:New( "Helicopters 3" ), SPAWN:New( "Helicopters 4" ), SPAWN:New( "Helicopters 5" ) }
 EnemyHelos = { SPAWN:New( "Enemy Helicopters 1" ), SPAWN:New( "Enemy Helicopters 2" ), SPAWN:New( "Enemy Helicopters 3" ) }
 
 -- This is our worker method! So when a cargo is deployed within a deployment zone, this method will be called.
 -- By example we are spawning here a random friendly helicopter and a random enemy helicopter.
 function WorkplaceTask:OnAfterCargoDeployed( From, Event, To, TaskUnit, Cargo, DeployZone )
   Helos[ math.random(1,#Helos) ]:Spawn()
   EnemyHelos[ math.random(1,#EnemyHelos) ]:Spawn()
 end

CargoPickedUp Handler OnAfter for TASK_CARGO

Defined in:

Parameters:

#string From

#string Event

#string To

The Unit (Client) that PickedUp the cargo. You can use this to retrieve the PlayerName etc.

The Cargo that got PickedUp by the TaskUnit. You can use this to check Cargo Status.

CargoDeployed Handler OnBefore for TASK_CARGO

Defined in:

Parameters:

#string From

#string Event

#string To

The Unit (Client) that Deployed the cargo. You can use this to retrieve the PlayerName etc.

The Cargo that got PickedUp by the TaskUnit. You can use this to check Cargo Status.

Core.Zone#ZONE DeployZone

The zone where the Cargo got Deployed or UnBoarded.

Return value:

#boolean:

CargoPickedUp Handler OnBefore for TASK_CARGO

Defined in:

Parameters:

#string From

#string Event

#string To

The Unit (Client) that PickedUp the cargo. You can use this to retrieve the PlayerName etc.

The Cargo that got PickedUp by the TaskUnit. You can use this to check Cargo Status.

Return value:

#boolean:

Set a limit on the amount of cargo items that can be loaded into the Carriers.

Defined in:

Parameter:

CargoLimit

Specifies a number of cargo items that can be loaded in the helicopter.

Return value:

Defined in:

Parameters:

#list<Core.Zone#ZONE> DeployZones

Return value:

Set a penalty when the task goals have failed..

Defined in:

Parameters:

#string Text

The text to display to the player, when the task goals has failed.

#number Penalty

The penalty in points.

Return value:

Set a score when progress is made.

Defined in:

Parameters:

#string Text

The text to display to the player, when there is progress on the task goals.

#number Score

The score in points.

Return value:

Set a score when success is achieved.

Defined in:

Parameters:

#string Text

The text to display to the player, when the task goals have been achieved.

#number Score

The score in points.

Return value:

Defined in:

Parameters:

Color

Might be SMOKECOLOR.Blue, SMOKECOLOR.Red SMOKECOLOR.Orange, SMOKECOLOR.White or SMOKECOLOR.Green

self

SmokeColor

Field(s)

Function(s)

FSM Abort synchronous event function for TASK.

Use this event to Abort the Task.

Defined in:

A group aborting the task.

Defined in:

Parameter:

Wrapper.Group#GROUP PlayerGroup

The group aborting the task.

Return value:

Gets the SET_GROUP assigned to the TASK.

Defined in:

Parameter:

Return value:

Add Task Progress for a Player Name

Defined in:

Parameters:

#string PlayerName

The name of the player.

#string ProgressText

The text that explains the Progress achieved.

#number ProgressTime

The time the progress was achieved.

ProgressPoints

Return value:

Assign the Task to a Wrapper.Group.

Defined in:

Parameter:

Return value:

Assign the Task to an alive Wrapper.Unit.

Defined in:

Parameter:

Return value:

self

FSM Cancel synchronous event function for TASK.

Use this event to Cancel the Task.

Defined in:

Clear the Wrapper.Group assignment from the Task.

Defined in:

Parameter:

Return value:

A group crashing and thus aborting from the task.

Defined in:

Parameter:

Wrapper.Group#GROUP PlayerGroup

The group aborting the task.

Return value:

FSM Fail synchronous event function for TASK.

Use this event to Fail the Task.

Defined in:

TODO: Obscolete? - Fail processes from Task with key Wrapper.Unit @param #TASK self @param #string TaskUnitName @return #TASK self

Defined in:

Parameter:

TaskUnitName

Gets the Task briefing.

Defined in:

Return value:

#string:

The briefing text.

Get goal of a task

Defined in:

Return value:

The Goal

Gets the SET_GROUP assigned to the TASK.

Defined in:

Return value:

Gets the ID of the Task

Defined in:

Return value:

#string:

TaskID

Gets the Mission to where the TASK belongs.

Defined in:

Return value:

Gets the Name of the Task

Defined in:

Return value:

#string:

The Task Name

Create a count of the players in the Task.

Defined in:

Return value:

#number:

The total number of players in the task.

Create a list of the players in the Task.

Defined in:

Return value:

#map<#string,Wrapper.Group#GROUP>:

A map of the players

Get the default or currently assigned Process template with key ProcessName.

Defined in:

Parameter:

#string ProcessName

Return value:

Gets the Scoring of the task

Defined in:

Return value:

Gets the FiniteStateMachine of Task with key TaskWrapper.Unit

Defined in:

Parameter:

Return value:

Returns the Task briefing.

Defined in:

Return value:

#string:

Task briefing.

Get Task Control Menu

Defined in:

Parameters:

The Wrapper.Unit that contains a player.

TaskName

Return value:

TaskControlMenu The Task Control Menu

Gets the Task Index, which is a combination of the Task type, the Task name.

Defined in:

Return value:

#string:

The Task ID

Returns the Task name.

Defined in:

Return value:

#string:

TaskName

Gets the Type of the Task

Defined in:

Return value:

#string:

TaskType

Get the Task FSM Process Template

Defined in:

Parameter:

TaskUnit

Return value:

Goal Trigger for TASK

Defined in:

Parameters:

Wrapper.Unit#UNIT PlayerUnit

The Wrapper.Unit of the player.

#string PlayerName

The name of the player.

Returns if the Task has still alive and assigned Units.

Defined in:

Return value:

#boolean:

Defined in:

Parameter:

Return value:

#boolean:

Checks if there is a FiniteStateMachine assigned to TaskWrapper.Unit for Task

Defined in:

Parameter:

Return value:

self

Init Task Control Menu

Defined in:

Parameter:

The Wrapper.Unit that contains a player.

Return value:

Task Control Menu Refresh ID

Returns if the Task is assigned to the Group.

Defined in:

Parameter:

Return value:

#boolean:

Is the Task status Aborted.

Defined in:

Is the Task status Assigned.

Defined in:

Is the Task status Cancelled.

Defined in:

Is the Task status Failed.

Defined in:

Is the Task status Hold.

Defined in:

Is the Task status Planned.

Defined in:

Is the Task status Replanned.

Defined in:

Is the Task status Success.

Defined in:

Add a PlayerUnit to join the Task.

For each Group within the Task, the Unit is checked if it can join the Task. If the Unit was not part of the Task, false is returned. If the Unit is part of the Task, true is returned.

Defined in:

Parameters:

Wrapper.Unit#UNIT PlayerUnit

The CLIENT or UNIT of the Player joining the Mission.

Wrapper.Group#GROUP PlayerGroup

The GROUP of the player joining the Mission.

Return value:

#boolean:

true if Unit is part of the Task.

Report the task status.

Defined in:

Parameters:

TaskGroup

Flash

Report the task status.

Defined in:

Parameter:

TaskGroup

Report the task status.

Defined in:

Parameter:

Send a message of the Task to the assigned Wrapper.Groups.

Defined in:

Parameter:

Message

Instantiates a new TASK.

Should never be used. Interface Class.

Defined in:

Parameters:

The mission wherein the Task is registered.

Core.Set#SET_GROUP SetGroupAssign

The set of groups for which the Task can be assigned.

#string TaskName

The name of the Task

#string TaskType

The type of the Task

TaskBriefing

Return value:

self

Goal Handler OnAfter for TASK

Defined in:

Parameters:

#string From

#string Event

#string To

Wrapper.Unit#UNIT PlayerUnit

The Wrapper.Unit of the player.

#string PlayerName

The name of the player.

FSM PlayerAborted event handler prototype for TASK.

Defined in:

Parameters:

Wrapper.Unit#UNIT PlayerUnit

The Unit of the Player when he went back to spectators or left the mission.

#string PlayerName

The name of the Player.

FSM PlayerCrashed event handler prototype for TASK.

Defined in:

Parameters:

Wrapper.Unit#UNIT PlayerUnit

The Unit of the Player when he crashed in the mission.

#string PlayerName

The name of the Player.

FSM PlayerDead event handler prototype for TASK.

Defined in:

Parameters:

Wrapper.Unit#UNIT PlayerUnit

The Unit of the Player when he died in the mission.

#string PlayerName

The name of the Player.

Goal Handler OnBefore for TASK

Defined in:

Parameters:

#string From

#string Event

#string To

Wrapper.Unit#UNIT PlayerUnit

The Wrapper.Unit of the player.

#string PlayerName

The name of the player.

Return value:

#boolean:

Remove the menu option of the Task for a Wrapper.Group.

Defined in:

Parameters:

#number MenuTime

Return value:

self

Refresh Task Control Menu

Defined in:

Parameters:

The Wrapper.Unit that contains a player.

MenuTime

The refresh time that was used to refresh the Task Control Menu items.

MenuTag

The tag.

A group rejecting a planned task.

Defined in:

Parameter:

Wrapper.Group#GROUP PlayerGroup

The group rejecting the task.

Return value:

Remove the assigned menu option of the Task for a Wrapper.Group.

Defined in:

Parameters:

#number MenuTime

Return value:

self

Remove the menu options of the Task to all the groups in the SetGroup.

Defined in:

Parameter:

#number MenuTime

Return value:

Remove FiniteStateMachines from Task with key TaskWrapper.Unit

Defined in:

Parameter:

Return value:

self

Remove Task Control Menu

Defined in:

Parameter:

The Wrapper.Unit that contains a player.

FSM Replan synchronous event function for TASK.

Use this event to Replan the Task.

Defined in:

Create a detailed report of the Task.

List the Task Status, and the Players assigned to the Task.

Defined in:

Parameters:

ReportGroup

Return value:

#string:

Create an overiew report of the Task.

List the Task Name and Status

Defined in:

Parameter:

ReportGroup

Return value:

#string:

Create a summary report of the Task.

List the Task Name and Status

Defined in:

Parameter:

Wrapper.Group#GROUP ReportGroup

Return value:

#string:

Send the briefng message of the Task to the assigned Wrapper.Groups.

Defined in:

Set the assigned menu options of the Task.

Defined in:

Parameters:

#number MenuTime

Return value:

self

Sets a Task briefing.

Defined in:

Parameter:

#string TaskBriefing

Return value:

self

Set detection of a task

Defined in:

Parameters:

DetectedItem

Return value:

Set dispatcher of a task

Defined in:

Parameter:

Return value:

Set goal of a task

Defined in:

Parameter:

Return value:

Set Wrapper.Group assigned to the Task.

Defined in:

Parameter:

Return value:

Sets the ID of the Task

Defined in:

Parameter:

#string TaskID

Set the menu options of the Task to all the groups in the SetGroup.

Defined in:

Parameter:

#number MenuTime

Return value:

Set the Menu for a Group

Defined in:

Parameters:

#number MenuTime

TaskGroup

Return value:

Sets the Name of the Task

Defined in:

Parameter:

#string TaskName

Set the planned menu option of the Task.

Defined in:

Parameters:

#string MenuText

The menu text.

#number MenuTime

Return value:

self

Set a penalty when the A2A attack has failed.

Defined in:

Parameters:

#string PlayerName

The name of the player.

#number Penalty

The penalty in points, must be a negative value!

Return value:

Set a score when progress has been made by the player.

Defined in:

Parameters:

#string PlayerName

The name of the player.

#number Score

The score in points to be granted when task process has been achieved.

Return value:

Set a score when all the targets in scope of the A2A attack, have been destroyed.

Defined in:

Parameters:

#string PlayerName

The name of the player.

#number Score

The score in points.

Return value:

Add a FiniteStateMachine to Task with key TaskWrapper.Unit

Defined in:

Parameters:

Return value:

self

Sets the TimeOut for the Task.

If Task stayed planned for longer than TimeOut, it gets into Cancelled status.

Defined in:

Parameter:

#integer Timer

in seconds

Return value:

self

Sets the Type of the Task

Defined in:

Parameter:

#string TaskType

Sets the Task FSM Process Template

Defined in:

Parameters:

Core

Fsm#FSM_PROCESS

FsmTemplate

Sets a Task to status Aborted.

Defined in:

Sets a Task to status Assigned.

Defined in:

Sets a Task to status Cancelled.

Defined in:

Sets a Task to status Failed.

Defined in:

Sets a Task to status Hold.

Defined in:

Sets a Task to status Planned.

Defined in:

Sets a Task to status Replanned.

Defined in:

Sets a Task to status Success.

Defined in:

FSM Success synchronous event function for TASK.

Use this event to make the Task a Success.

Defined in:

UnAssign the Task from an alive Wrapper.Unit.

Defined in:

Parameter:

Return value:

self

FSM Abort asynchronous event function for TASK.

Use this event to Abort the Task.

Defined in:

FSM Cancel asynchronous event function for TASK.

Use this event to Cancel the Task.

Defined in:

FSM Fail asynchronous event function for TASK.

Use this event to Fail the Task.

Defined in:

Goal Asynchronous Trigger for TASK

Defined in:

Parameters:

#number Delay

Wrapper.Unit#UNIT PlayerUnit

The Wrapper.Unit of the player.

#string PlayerName

The name of the player.

FSM Replan asynchronous event function for TASK.

Use this event to Replan the Task.

Defined in:

FSM Success asynchronous event function for TASK.

Use this event to make the Task a Success.

Defined in:

FSM function for a TASK

Defined in:

Parameters:

#string From

#string Event

#string To

FSM function for a TASK

Defined in:

Parameters:

#string Event

#string From

#string To

FSM function for a TASK

Defined in:

Parameters:

#string From

#string Event

#string To

FSM function for a TASK

Defined in:

Parameters:

#string Event

#string From

#string To

PlayerUnit

PlayerName

FSM function for a TASK

Defined in:

Parameters:

#string From

#string Event

#string To

FSM function for a TASK

Defined in:

Parameters:

#string From

#string Event

#string To

FSM function for a TASK

Defined in:

Parameters:

#string Event

#string From

#string To

FSM function for a TASK

Defined in:

Parameters:

#string Event

#string From

#string To

FSM function for a TASK

Defined in:

Parameters:

#string Event

#string From

#string To

Field(s)

Function(s)

Creates a new FSM_TASK object.

Defined in:

Parameter:

#string TaskName

The name of the task.

Return value:

Defined in:

Parameters:

step

trigger

params

EventName