Module Mission

A MISSION is the main owner of a Mission orchestration within MOOSE .

The Mission framework orchestrates CLIENTs, TASKs, STAGEs etc. A CLIENT needs to be registered within the MISSION through the function AddClient. A TASK needs to be registered within the MISSION through the function AddTask.

Global(s)

MISSION
MISSIONSCHEDULER
_TransportExecuteStage

Type MISSION

MISSION.AddClient(CLIENT, self, Client)

Register a new CLIENT to participate within the mission.

MISSION.AddGoalFunction(function, self, GoalFunction)

Add a goal function to a MISSION.

MISSION:AddScoring(Scoring)

Add a scoring to the mission.

MISSION:AddTask(Task)

Register a Task to be completed within the Mission.

MISSION.AssignTaskToGroup(MenuParam)
MISSION.ClassName
MISSION:ClearMissionMenu()

Clears the mission menu for the coalition.

MISSION:Completed()

Set a Mission to completed.

MISSION:CreateTaskMenus(TaskGroup)

Fill mission menu for the Group.

MISSION.FAILED
MISSION:Failed()

Set a Mission to failed.

MISSION.FindClient(CLIENT, self, ClientName)

Find a CLIENT object within the MISSION by its ClientName.

MISSION:GetMissionMenu()

Gets the mission menu for the coalition.

MISSION:GetName()

Gets the mission name.

MISSION:GetScoring()

Get the scoring object of a mission.

MISSION:GetTask(TaskNumber)
MISSION:GetTasks()

Get all the TASKs from the Mission.

MISSION.GoalFunction
MISSION:IsCompleted()

Returns if a Mission has completed.

MISSION:IsFailed()

Returns if a Mission has failed.

MISSION:IsOngoing()

Returns if a Mission is ongoing.

MISSION:IsPending()

Returns if a Mission is pending.

MISSION:Meta()
MISSION.MissionBriefing
MISSION.MissionCoalition
MISSION.MissionMenu
MISSION.MissionPriority
MISSION.MissionProgressTrigger
MISSION.MissionReportFlash
MISSION.MissionReportShow
MISSION.MissionReportTrigger
MISSION.MissionStatus
MISSION.MissionTimeInterval
MISSION.Name
MISSION:New(MissionName, MissionPriority, MissionBriefing, MissionCoalition)

This is the main MISSION declaration method.

MISSION:Ongoing()

Set a Mission to ongoing.

MISSION:Pending()

Set a Mission to pending.

MISSION.REPEAT
MISSION:ReportToAll()

Report the status of all MISSIONs to all active Clients.

MISSION:ReportTrigger()

Handles the reporting.

MISSION.SUCCESS
MISSION.Scoring
MISSION:SetMissionMenu()

Sets the mission menu for the coalition.

MISSION:StatusToClients()

Send the status of the MISSION to all Clients.

MISSION.TaskCategoryMenus
MISSION.TaskMenus
MISSION.TaskTypeMenus
MISSION.Tasks
MISSION._ActiveTasks
MISSION._Clients
MISSION._GoalTasks

Type MISSIONSCHEDULER

MISSIONSCHEDULER.AddMission(Mission)

This is the main MISSION declaration method.

MISSIONSCHEDULER.FindMission(MissionName)

Find a MISSION within the MISSIONSCHEDULER.

MISSIONSCHEDULER.MissionCount
MISSIONSCHEDULER.Missions
MISSIONSCHEDULER.RemoveMission(MissionName)

Remove a MISSION from the MISSIONSCHEDULER.

MISSIONSCHEDULER.ReportMenu()

Enables a MENU option in the communications menu under F10 to control the status of the active missions.

MISSIONSCHEDULER.ReportMissionsFlash(TimeInterval)
MISSIONSCHEDULER.ReportMissionsHide(Prm)
MISSIONSCHEDULER.ReportMissionsShow()
MISSIONSCHEDULER.Scheduler()

This is the main MISSIONSCHEDULER Scheduler function.

MISSIONSCHEDULER.SchedulerId
MISSIONSCHEDULER:Scoring(Scoring)

Adds a mission scoring to the game.

MISSIONSCHEDULER.Start()

Start the MISSIONSCHEDULER.

MISSIONSCHEDULER.Stop()

Stop the MISSIONSCHEDULER.

MISSIONSCHEDULER:Time(TimeSeconds, TimeIntervalShow, TimeShow)
MISSIONSCHEDULER.TimeIntervalCount
MISSIONSCHEDULER.TimeIntervalShow
MISSIONSCHEDULER.TimeSeconds
MISSIONSCHEDULER.TimeShow

Global(s)

#MISSION MISSION
#MISSIONSCHEDULER MISSIONSCHEDULER
_TransportExecuteStage

_TransportExecuteStage: Defines the different stages of Transport unload/load execution. This table is internal and is used to control the validity of Transport load/unload timing.

  • _TransportExecuteStage.EXECUTING
  • _TransportExecuteStage.SUCCESS
  • _TransportExecuteStage.FAILED

--

Type Mission

Type MISSION

The MISSION class

Field(s)

MISSION.AddClient(CLIENT, self, Client)

Register a new CLIENT to participate within the mission.

Parameters

  • CLIENT : Client is the CLIENT object. The object must have been instantiated with CLIENT.

  • self :

  • Client :

Return value

CLIENT

Usage:

Add a number of Client objects to the Mission.
	Mission:AddClient( CLIENT:FindByName( 'US UH-1H*HOT-Deploy Troops 1', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() )
	Mission:AddClient( CLIENT:FindByName( 'US UH-1H*RAMP-Deploy Troops 3', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() )
	Mission:AddClient( CLIENT:FindByName( 'US UH-1H*HOT-Deploy Troops 2', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() )
	Mission:AddClient( CLIENT:FindByName( 'US UH-1H*RAMP-Deploy Troops 4', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.' ):Transport() )
MISSION.AddGoalFunction(function, self, GoalFunction)

Add a goal function to a MISSION.

Goal functions are called when a TASK within a mission has been completed.

Parameters

  • function : GoalFunction is the function defined by the mission designer to evaluate whether a certain goal has been reached after a TASK finishes within the MISSION. A GoalFunction must accept 2 parameters: Mission, Client, which contains the current MISSION object and the current CLIENT object respectively.

  • self :

  • GoalFunction :

Usage:

 PatriotActivation = { 
		{ "US SAM Patriot Zerti", false },
		{ "US SAM Patriot Zegduleti", false },
		{ "US SAM Patriot Gvleti", false }
	}

	function DeployPatriotTroopsGoal( Mission, Client )


		-- Check if the cargo is all deployed for mission success.
		for CargoID, CargoData in pairs( Mission._Cargos ) do
			if Group.getByName( CargoData.CargoGroupName ) then
				CargoGroup = Group.getByName( CargoData.CargoGroupName )
				if CargoGroup then
					-- Check if the cargo is ready to activate
					CurrentLandingZoneID = routines.IsUnitInZones( CargoGroup:getUnits()[1], Mission:GetTask( 2 ).LandingZones ) -- The second task is the Deploytask to measure mission success upon
					if CurrentLandingZoneID then
						if PatriotActivation[CurrentLandingZoneID][2] == false then
							-- Now check if this is a new Mission Task to be completed...
							trigger.action.setGroupAIOn( Group.getByName( PatriotActivation[CurrentLandingZoneID][1] ) )
							PatriotActivation[CurrentLandingZoneID][2] = true
							MessageToBlue( "Mission Command: Message to all airborne units! The " .. PatriotActivation[CurrentLandingZoneID][1] .. " is armed. Our air defenses are now stronger.", 60, "BLUE/PatriotDefense" )
							MessageToRed( "Mission Command: Our satellite systems are detecting additional NATO air defenses. To all airborne units: Take care!!!", 60, "RED/PatriotDefense" )
							Mission:GetTask( 2 ):AddGoalCompletion( "Patriots activated", PatriotActivation[CurrentLandingZoneID][1], 1 ) -- Register Patriot activation as part of mission goal.
						end
					end
				end
			end
		end
	end

	local Mission = MISSIONSCHEDULER.AddMission( 'NATO Transport Troops', 'Operational', 'Transport 3 groups of air defense engineers from our barracks "Gold" and "Titan" to each patriot battery control center to activate our air defenses.', 'NATO' )
	Mission:AddGoalFunction( DeployPatriotTroopsGoal )
MISSION:AddScoring(Scoring)

Add a scoring to the mission.

Parameter

  • Scoring :

Return value

#MISSION: self

MISSION:AddTask(Task)

Register a Task to be completed within the Mission.

Note that there can be multiple Tasks registered to be completed. Each Task can be set a certain Goals. The Mission will not be completed until all Goals are reached.

Parameter

Return value

Task#TASK_BASE: The task added.

MISSION.AssignTaskToGroup(MenuParam)

Parameter

  • MenuParam :

#string MISSION.ClassName
MISSION:ClearMissionMenu()

Clears the mission menu for the coalition.

Return value

#MISSION: self

MISSION:Completed()

Set a Mission to completed.

MISSION:CreateTaskMenus(TaskGroup)

Fill mission menu for the Group.

Parameter

  • TaskGroup :

Return value

#MISSION: self

#number MISSION.FAILED
MISSION:Failed()

Set a Mission to failed.

MISSION.FindClient(CLIENT, self, ClientName)

Find a CLIENT object within the MISSION by its ClientName.

Parameters

  • CLIENT : ClientName is a string defining the Client Group as defined within the ME.

  • self :

  • ClientName :

Return value

CLIENT

Usage:

-- Seach for Client "Bomber" within the Mission.
local BomberClient = Mission:FindClient( "Bomber" )
MISSION:GetMissionMenu()

Gets the mission menu for the coalition.

Return value

Menu#MENU_COALITION: self

MISSION:GetName()

Gets the mission name.

Return value

#MISSION: self

MISSION:GetScoring()

Get the scoring object of a mission.

Return value

#SCORING: Scoring

MISSION:GetTask(TaskNumber)

Parameter

  • TaskNumber :

MISSION:GetTasks()

Get all the TASKs from the Mission.

This function is useful in GoalFunctions.

Return value

{TASK,...} Structure of TASKS with the TASK number as the key.

Usage:

-- Get Tasks from the Mission.
Tasks = Mission:GetTasks()
env.info( "Task 2 Completion = " .. Tasks[2]:GetGoalPercentage() .. "%" )
MISSION.GoalFunction
MISSION:IsCompleted()

Returns if a Mission has completed.

Return value

bool

MISSION:IsFailed()

Returns if a Mission has failed.

treturn bool

MISSION:IsOngoing()

Returns if a Mission is ongoing.

treturn bool

MISSION:IsPending()

Returns if a Mission is pending.

treturn bool

MISSION:Meta()
#string MISSION.MissionBriefing
MISSION.MissionCoalition
Menu#MENU_COALITION MISSION.MissionMenu
MISSION.MissionPriority
#number MISSION.MissionProgressTrigger
#boolean MISSION.MissionReportFlash
#boolean MISSION.MissionReportShow
#number MISSION.MissionReportTrigger
#string MISSION.MissionStatus
#number MISSION.MissionTimeInterval
MISSION.Name
MISSION:New(MissionName, MissionPriority, MissionBriefing, MissionCoalition)

This is the main MISSION declaration method.

Each Mission is like the master or a Mission orchestration between, Clients, Tasks, Stages etc.

Parameters

  • #string MissionName : is the name of the mission. This name will be used to reference the status of each mission by the players.

  • #string MissionPriority : is a string indicating the "priority" of the Mission. f.e. "Primary", "Secondary" or "First", "Second". It is free format and up to the Mission designer to choose. There are no rules behind this field.

  • #string MissionBriefing : is a string indicating the mission briefing to be shown when a player joins a CLIENT.

  • DCSCoalitionObject#coalition MissionCoalition : is a string indicating the coalition or party to which this mission belongs to. It is free format and can be chosen freely by the mission designer. Note that this field is not to be confused with the coalition concept of the ME. Examples of a Mission Coalition could be "NATO", "CCCP", "Intruders", "Terrorists"...

Return value

#MISSION: self

MISSION:Ongoing()

Set a Mission to ongoing.

MISSION:Pending()

Set a Mission to pending.

#number MISSION.REPEAT
MISSION:ReportToAll()

Report the status of all MISSIONs to all active Clients.

MISSION:ReportTrigger()

Handles the reporting.

After certain time intervals, a MISSION report MESSAGE will be shown to All Players.

#number MISSION.SUCCESS
MISSION.Scoring
MISSION:SetMissionMenu()

Sets the mission menu for the coalition.

Return value

#MISSION: self

MISSION:StatusToClients()

Send the status of the MISSION to all Clients.

MISSION.TaskCategoryMenus
MISSION.TaskMenus
MISSION.TaskTypeMenus
MISSION.Tasks
MISSION._ActiveTasks
#MISSION.Clients MISSION._Clients
MISSION._GoalTasks

Type MISSION.Clients

Type MISSIONSCHEDULER

The MISSIONSCHEDULER is an OBJECT and is the main scheduler of ALL active MISSIONs registered within this scheduler.

It's workings are considered internal and is automatically created when the Mission.lua file is included.

Field(s)

MISSIONSCHEDULER.AddMission(Mission)

This is the main MISSION declaration method.

Each Mission is like the master or a Mission orchestration between, Clients, Tasks, Stages etc.

Parameter

  • Mission : is the MISSION object instantiated by MISSION.

Return value

MISSION

Usage:


-- Declare a mission.
Mission = MISSION:New( 'Russia Transport Troops SA-6', 
                       'Operational', 
                       'Transport troops from the control center to one of the SA-6 SAM sites to activate their operation.', 
                       'Russia' )
MISSIONSCHEDULER:AddMission( Mission )
MISSIONSCHEDULER.FindMission(MissionName)

Find a MISSION within the MISSIONSCHEDULER.

Parameter

  • MissionName : is the name of the MISSION given at declaration using AddMission.

Return value

MISSION

Usage:

-- Declare a mission.
Mission = MISSION:New( 'Russia Transport Troops SA-6', 
                       'Operational', 
                       'Transport troops from the control center to one of the SA-6 SAM sites to activate their operation.', 
                       'Russia' )
MISSIONSCHEDULER:AddMission( Mission )

-- Now find the Mission.
MissionFind = MISSIONSCHEDULER:FindMission( 'Russia Transport Troops SA-6' )
#number MISSIONSCHEDULER.MissionCount
#MISSIONSCHEDULER.MISSIONS MISSIONSCHEDULER.Missions
MISSIONSCHEDULER.RemoveMission(MissionName)

Remove a MISSION from the MISSIONSCHEDULER.

Parameter

  • MissionName : is the name of the MISSION given at declaration using AddMission.

Usage:

-- Declare a mission.
Mission = MISSION:New( 'Russia Transport Troops SA-6', 
                       'Operational', 
                       'Transport troops from the control center to one of the SA-6 SAM sites to activate their operation.', 
                       'Russia' )
MISSIONSCHEDULER:AddMission( Mission )

-- Now remove the Mission.
MISSIONSCHEDULER:RemoveMission( 'Russia Transport Troops SA-6' )
MISSIONSCHEDULER.ReportMenu()

Enables a MENU option in the communications menu under F10 to control the status of the active missions.

This function should be called only once when starting the MISSIONSCHEDULER.

MISSIONSCHEDULER.ReportMissionsFlash(TimeInterval)

Internal function used by the MISSIONSCHEDULER menu.

Parameter

  • TimeInterval :

MISSIONSCHEDULER.ReportMissionsHide(Prm)

Internal function used by the MISSIONSCHEDULER menu.

Parameter

  • Prm :

MISSIONSCHEDULER.ReportMissionsShow()

Internal function used by the MISSIONSCHEDULER menu.

MISSIONSCHEDULER.Scheduler()

This is the main MISSIONSCHEDULER Scheduler function.

It is considered internal and is automatically created when the Mission.lua file is included.

MISSIONSCHEDULER.SchedulerId

MISSIONSCHEDULER.SchedulerId = routines.scheduleFunction( MISSIONSCHEDULER.Scheduler, { }, 0, 2 )

MISSIONSCHEDULER:Scoring(Scoring)

Adds a mission scoring to the game.

Parameter

  • Scoring :

MISSIONSCHEDULER.Start()

Start the MISSIONSCHEDULER.

MISSIONSCHEDULER.Stop()

Stop the MISSIONSCHEDULER.

MISSIONSCHEDULER:Time(TimeSeconds, TimeIntervalShow, TimeShow)

Parameters

  • TimeSeconds :

  • TimeIntervalShow :

  • TimeShow :

#number MISSIONSCHEDULER.TimeIntervalCount
#number MISSIONSCHEDULER.TimeIntervalShow
#number MISSIONSCHEDULER.TimeSeconds
#number MISSIONSCHEDULER.TimeShow

Type MISSIONSCHEDULER.MISSIONS

Type SCORING