Class 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.

Tables

MISSION.SpawnCargo Add Cargo to the mission...

Issues

MISSION.SpawnCargo-todo1 check this
MISSION.SpawnCargo-todo1-todo2 check this

Methods

MISSION:New (MissionName, MissionPriority, MissionBriefing, MissionCoalition) This is the main MISSION declaration method.
MISSION:IsCompleted () Returns if a Mission has completed.
MISSION:Completed () Set a Mission to completed.
MISSION:IsOngoing () Returns if a Mission is ongoing.
MISSION:Ongoing () Set a Mission to ongoing.
MISSION:IsPending () Returns if a Mission is pending.
MISSION:Pending () Set a Mission to pending.
MISSION:IsFailed () Returns if a Mission has failed.
MISSION:Failed () Set a Mission to failed.
MISSION:StatusToClients () Send the status of the MISSION to all Clients.
MISSION:ReportTrigger () Handles the reporting.
MISSION:ReportToAll () Report the status of all MISSIONs to all active Clients.
MISSION:AddGoalFunction (GoalFunction) Add a goal function to a MISSION.
MISSION:ShowBriefing (Client) Show the briefing of the MISSION to the CLIENT.
MISSION:AddClient (Client) Register a new CLIENT to participate within the mission.
MISSION:FindClient (ClientName) Find a CLIENT object within the MISSION by its ClientName.
MISSION:AddTask (Task, TaskNumber) Register a TASK to be completed within the MISSION.
MISSION:GetTask (TaskNumber) Get the TASK idenified by the TaskNumber from the Mission.
MISSION:GetTasks () Get all the TASKs from the Mission.

Class MISSIONSCHEDULER

MISSIONSCHEDULER.Scheduler () This is the main MISSIONSCHEDULER Scheduler function.
MISSIONSCHEDULER.Start () Start the MISSIONSCHEDULER.
MISSIONSCHEDULER.Stop () Stop the MISSIONSCHEDULER.
MISSIONSCHEDULER.AddMission (Mission) This is the main MISSION declaration method.
MISSIONSCHEDULER.RemoveMission (MissionName) Remove a MISSION from the MISSIONSCHEDULER.
MISSIONSCHEDULER.FindMission (MissionName) Find a MISSION within the MISSIONSCHEDULER.
MISSIONSCHEDULER.ReportMenu () Enables a MENU option in the communications menu under F10 to control the status of the active missions.
MISSIONSCHEDULER:TimeShow () Show the remaining mission time.


Tables

MISSION.SpawnCargo
Add Cargo to the mission... Cargo functionality needs to be reworked a bit, so this is still under construction. I need to make a CARGO Class...

Issues

MISSION.SpawnCargo-todo1
check this
MISSION.SpawnCargo-todo1-todo2
check this

Methods

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:

  • MissionName string is the name of the mission. This name will be used to reference the status of each mission by the players.
  • MissionPriority string 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.
  • MissionBriefing string is a string indicating the mission briefing to be shown when a player joins a CLIENT.
  • MissionCoalition string 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"...

Returns:

    MISSION

Usage:

     -- Declare a few missions.
     local Mission = MISSIONSCHEDULER.AddMission( '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' )
     local Mission = MISSIONSCHEDULER.AddMission( 'Patriots', 'Primary', 'Our intelligence reports that 3 Patriot SAM defense batteries are located near Ruisi, Kvarhiti and Gori.', 'Russia'  )
     local Mission = MISSIONSCHEDULER.AddMission( 'Package Delivery', 'Operational', 'In order to be in full control of the situation, we need you to deliver a very important package at a secret location. Fly undetected through the NATO defenses and deliver the secret package. The secret agent is located at waypoint 4.', 'Russia'  )
     local Mission = MISSIONSCHEDULER.AddMission( 'Rescue General', 'Tactical', 'Our intelligence has received a remote signal behind Gori. We believe it is a very important Russian General that was captured by Georgia. Go out there and rescue him! Ensure you stay out of the battle zone, keep south. Waypoint 4 is the location of our Russian General.', 'Russia'  )
     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' )
     local Mission = MISSIONSCHEDULER.AddMission( 'SA-6 SAMs', 'Primary', 'Our intelligence reports that 3 SA-6 SAM defense batteries are located near Didmukha, Khetagurov and Berula. Eliminate the Russian SAMs.', 'NATO'  )
     local Mission = MISSIONSCHEDULER.AddMission( 'NATO Sling Load', 'Operational', 'Fly to the cargo pickup zone at Dzegvi or Kaspi, and sling the cargo to Soganlug airbase.', 'NATO' )
     local Mission = MISSIONSCHEDULER.AddMission( 'Rescue secret agent', 'Tactical', 'In order to be in full control of the situation, we need you to rescue a secret agent from the woods behind enemy lines. Avoid the Russian defenses and rescue the agent. Keep south until Khasuri, and keep your eyes open for any SAM presence. The agent is located at waypoint 4 on your kneeboard.', 'NATO'  )
MISSION:IsCompleted ()
Returns if a Mission has completed.

Returns:

    bool
MISSION:Completed ()
Set a Mission to completed.
MISSION:IsOngoing ()
Returns if a Mission is ongoing. treturn bool
MISSION:Ongoing ()
Set a Mission to ongoing.
MISSION:IsPending ()
Returns if a Mission is pending. treturn bool
MISSION:Pending ()
Set a Mission to pending.
MISSION:IsFailed ()
Returns if a Mission has failed. treturn bool
MISSION:Failed ()
Set a Mission to failed.
MISSION:StatusToClients ()
Send the status of the MISSION to all Clients.
MISSION:ReportTrigger ()
Handles the reporting. After certain time intervals, a MISSION report MESSAGE will be shown to All Players.
MISSION:ReportToAll ()
Report the status of all MISSIONs to all active Clients.
MISSION:AddGoalFunction (GoalFunction)
Add a goal function to a MISSION. Goal functions are called when a TASK within a mission has been completed.

Parameters:

  • GoalFunction function 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.

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:ShowBriefing (Client)
Show the briefing of the MISSION to the CLIENT.

Parameters:

  • Client CLIENT to show briefing to.

Returns:

    CLIENT
MISSION:AddClient (Client)
Register a new CLIENT to participate within the mission.

Parameters:

Returns:

    CLIENT

Usage:

     Add a number of Client objects to the Mission.
     	Mission:AddClient( CLIENT:New( '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:New( '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:New( '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:New( '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:FindClient (ClientName)
Find a CLIENT object within the MISSION by its ClientName.

Parameters:

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

Returns:

    CLIENT

Usage:

     -- Seach for Client "Bomber" within the Mission.
     local BomberClient = Mission:FindClient( "Bomber" )
MISSION:AddTask (Task, TaskNumber)
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 Goal. The MISSION will not be completed until all Goals are reached.

Parameters:

  • Task TASK is the TASK object. The object must have been instantiated with TASK:New or any of its inherited TASKs.
  • TaskNumber number is the sequence number of the TASK within the MISSION. This number does have to be chronological.

Returns:

    TASK

Usage:

     -- Define a few tasks for the Mission.
    	PickupZones = { "NATO Gold Pickup Zone", "NATO Titan Pickup Zone" }
    	PickupSignalUnits = { "NATO Gold Coordination Center", "NATO Titan Coordination Center" }
    
    	-- Assign the Pickup Task
    	local PickupTask = PICKUPTASK:New( PickupZones, CARGO_TYPE.ENGINEERS, CLIENT.ONBOARDSIDE.LEFT )
    	PickupTask:AddSmokeBlue( PickupSignalUnits  )
    	PickupTask:SetGoalTotal( 3 )
    	Mission:AddTask( PickupTask, 1 )
    
    	-- Assign the Deploy Task
    	local PatriotActivationZones = { "US Patriot Battery 1 Activation", "US Patriot Battery 2 Activation", "US Patriot Battery 3 Activation" }
    	local PatriotActivationZonesSmokeUnits = { "US SAM Patriot - Battery 1 Control", "US SAM Patriot - Battery 2 Control", "US SAM Patriot - Battery 3 Control" }
    	local DeployTask = DEPLOYTASK:New( PatriotActivationZones, CARGO_TYPE.ENGINEERS )
    	--DeployTask:SetCargoTargetZoneName( 'US Troops Attack ' .. math.random(2) )
    	DeployTask:AddSmokeBlue( PatriotActivationZonesSmokeUnits )
    	DeployTask:SetGoalTotal( 3 )
    	DeployTask:SetGoalTotal( 3, "Patriots activated" )
    	Mission:AddTask( DeployTask, 2 )
MISSION:GetTask (TaskNumber)
Get the TASK idenified by the TaskNumber from the Mission. This function is useful in GoalFunctions.

Parameters:

  • TaskNumber number is the number of the TASK within the MISSION.

Returns:

    TASK

Usage:

     -- Get Task 2 from the Mission.
     Task2 = Mission:GetTask( 2 )
MISSION:GetTasks ()
Get all the TASKs from the Mission. This function is useful in GoalFunctions.

Returns:

    {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() .. "%" )

Class 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.
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.Start ()
Start the MISSIONSCHEDULER.
MISSIONSCHEDULER.Stop ()
Stop the MISSIONSCHEDULER.
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.

Parameters:

  • Mission is the MISSION object instantiated by MISSION:New.

Returns:

    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.RemoveMission (MissionName)
Remove a MISSION from the MISSIONSCHEDULER.

Parameters:

  • 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.FindMission (MissionName)
Find a MISSION within the MISSIONSCHEDULER.

Parameters:

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

Returns:

    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' )
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:TimeShow ()
Show the remaining mission time.
generated by LDoc 1.4.3 Last updated 2015-01-29 21:06:10