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
Type MISSIONSCHEDULER
Global(s)
- _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:AbortUnit(PlayerUnit)
-
Aborts a PlayerUnit from the Mission.
For each Task within the Mission, the PlayerUnit is removed from Task where it is assigned. If the Unit was not part of a Task in the Mission, false is returned. If the Unit is part of a Task in the Mission, true is returned.
Parameter
-
Wrapper.Unit#UNIT PlayerUnit: The CLIENT or UNIT of the Player joining the Mission.
Return value
#boolean: true if Unit is part of a Task in the Mission.
-
- 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
-
Tasking.Task#TASK Task: is the Task object.
Return value
Tasking.Task#TASK: The task added.
-
- #string MISSION.ClassName
- MISSION:ClearMissionMenu()
-
Clears the mission menu for the coalition.
Return value
#MISSION: self
- MISSION:Completed()
-
Set a Mission to completed.
- MISSION:CrashUnit(PlayerUnit)
-
Handles a crash of a PlayerUnit from the Mission.
For each Task within the Mission, the PlayerUnit is removed from Task where it is assigned. If the Unit was not part of a Task in the Mission, false is returned. If the Unit is part of a Task in the Mission, true is returned.
Parameter
-
Wrapper.Unit#UNIT PlayerUnit: The CLIENT or UNIT of the Player crashing.
Return value
#boolean: true if Unit is part of a Task in the Mission.
-
- #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:GetCommandCenter()
-
Gets the COMMANDCENTER.
Return value
- MISSION:GetGroups()
-
Get the groups for which TASKS are given in the mission
Return value
- MISSION:GetMissionMenu(TaskGroup)
-
Gets the mission menu for the coalition.
Parameter
-
Wrapper.Group#GROUP TaskGroup:
Return value
Core.Menu#MENU_COALITION: self
-
- MISSION:GetName()
-
Gets the mission name.
Return value
#MISSION: self
- MISSION:GetNextTaskID(Task)
-
Return the next Task ID to be completed within the Mission.
Parameter
-
Tasking.Task#TASK Task: is the Task object.
Return value
Tasking.Task#TASK: The task added.
-
- MISSION:GetScoring()
-
Get the scoring object of a mission.
Return value
#SCORING: Scoring
- MISSION.GetTask(TaskName, self)
-
Get the TASK identified by the TaskNumber from the Mission.
This function is useful in GoalFunctions.
Parameters
Return values
-
Tasking.Task#TASK: The Task
-
#nil: Returns nil if no task was found.
-
- 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:HasGroup(TaskGroup)
-
Parameter
-
TaskGroup:
-
- 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:JoinUnit(PlayerUnit, PlayerGroup)
-
Add a Unit to join the Mission.
For each Task within the Mission, the Unit is joined with the Task. If the Unit was not part of a Task in the Mission, false is returned. If the Unit is part of a Task in the Mission, true is returned.
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 a Task in the Mission.
-
- #string MISSION.MissionBriefing
- #string MISSION.MissionCoalition
- #number MISSION.MissionProgressTrigger
- #boolean MISSION.MissionReportFlash
- #boolean MISSION.MissionReportShow
- #number MISSION.MissionReportTrigger
- #string MISSION.MissionStatus
- #number MISSION.MissionTimeInterval
- #string MISSION.Name
- MISSION:New(CommandCenter, 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
-
Tasking.CommandCenter#COMMANDCENTER CommandCenter: -
#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. -
Dcs.DCSCoalitionWrapper.Object#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:RemoveMenu()
-
Removes the Planned Task menu.
- MISSION:RemoveTask(Task)
-
Removes 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
-
Tasking.Task#TASK Task: is the Task object.
Return value
#nil: The cleaned Task reference.
-
- MISSION:RemoveTaskMenu(Task)
-
Removes a Task menu.
Parameter
-
Tasking.Task#TASK Task:
Return value
#MISSION: self
-
- MISSION:ReportDetails()
-
Create a detailed report of the Mission, listing all the details of the Task.
Return value
#string:
- MISSION:ReportOverview()
-
Create a overview report of the Mission (multiple lines).
Return value
#string:
- MISSION:ReportSummary()
-
Create a summary report of the Mission (one line).
Return value
#string:
- MISSION:ReportToAll()
-
Report the status of all MISSIONs to all active Clients.
- #number MISSION.SUCCESS
- MISSION:SetAssignedMenu(Task, MenuText)
-
Sets the Assigned Task menu.
Parameters
-
Tasking.Task#TASK Task: -
#string MenuText: The menu text.
Return value
#MISSION: self
-
- MISSION:SetMenu()
-
Sets the Planned Task menu.
- MISSION:StatusToClients()
-
Send the status of the MISSION to all Clients.
- MISSION:onbeforeComplete(Event, From, To)
-
FSM function for a MISSION
Parameters
-
#string Event: -
#string From: -
#string To:
-
- MISSION:onenterCompleted(Event, From, To)
-
FSM function for a MISSION
Parameters
-
#string Event: -
#string From: -
#string To:
-
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.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.TimeSeconds
- #number MISSIONSCHEDULER.TimeShow