diff --git a/Documentation/Escort.html b/Documentation/Escort.html index b1fe8f549..9101be061 100644 --- a/Documentation/Escort.html +++ b/Documentation/Escort.html @@ -1835,7 +1835,6 @@ self

- ESCORT.ReportTargetsScheduler diff --git a/Documentation/MissileTrainer.html b/Documentation/MissileTrainer.html index 15b467d1f..2eebd576b 100644 --- a/Documentation/MissileTrainer.html +++ b/Documentation/MissileTrainer.html @@ -55,6 +55,90 @@

Provides missile training functions.

+ + +

#MISSILETRAINER class

+

The #MISSILETRAINER class uses the DCS world messaging system to be alerted of any missiles fired, and when a missile would hit your aircraft, +the class will destroy the missile within a certain range, to avoid damage to your aircraft. +It suports the following functionality:

+ + + +

When running a mission where MISSILETRAINER is used, the following radio menu structure ( 'Radio Menu' -> 'Other (F10)' -> 'MissileTrainer' ) options are available for the players:

+ + + + +

MISSILETRAINER construction methods:

+

Create a new MISSILETRAINER object with the MISSILETRAINER.New method:

+ + + +

MISSILETRAINER will collect each unit declared in the mission with a skill level "Client" and "Player", and will monitor the missiles shot at those.

+ +

MISSILETRAINER initialization methods:

+

A MISSILETRAINER object will behave differently based on the usage of initialization methods:

+ + + +

Global(s)

@@ -175,7 +259,7 @@ - + @@ -641,7 +725,7 @@ self

-MISSILETRAINER:New(Distance) +MISSILETRAINER:New(Distance, Briefing)
@@ -651,13 +735,19 @@ self

When a missile is fired a SCHEDULER is set off that follows the missile. When near a certain a client player, the missile will be destroyed.

-

Parameter

+

Parameters

  • #number Distance : The distance in meters when a tracked missile needs to be destroyed when close to a player.

    +
  • +
  • + +

    #string Briefing : +(Optional) Will show a text to the players when starting their mission. Can be used for briefing purposes.

    +

Return value

diff --git a/Embedded/Moose_Embedded.lua b/Embedded/Moose_Embedded.lua index 775f5ed65..bbe45fd13 100644 --- a/Embedded/Moose_Embedded.lua +++ b/Embedded/Moose_Embedded.lua @@ -15275,7 +15275,6 @@ function ESCORT:_ReportTargetsScheduler() end end --- Provides missile training functions. --- @module MissileTrainer -- -- @{#MISSILETRAINER} class -- ======================== @@ -15343,6 +15342,7 @@ end -- * @{#MISSILETRAINER.InitBearingOnOff}: Sets by default the display of bearing information of missiles ON of OFF. -- * @{#MISSILETRAINER.InitMenusOnOff}: Allows to configure the options through the radio menu. -- +-- @module MissileTrainer -- @author FlightControl @@ -15360,11 +15360,16 @@ MISSILETRAINER = { -- When a missile is fired a SCHEDULER is set off that follows the missile. When near a certain a client player, the missile will be destroyed. -- @param #MISSILETRAINER self -- @param #number Distance The distance in meters when a tracked missile needs to be destroyed when close to a player. +-- @param #string Briefing (Optional) Will show a text to the players when starting their mission. Can be used for briefing purposes. -- @return #MISSILETRAINER -function MISSILETRAINER:New( Distance ) +function MISSILETRAINER:New( Distance, Briefing ) local self = BASE:Inherit( self, BASE:New() ) self:F( Distance ) + if Briefing then + self.Briefing = Briefing + end + self.Schedulers = {} self.SchedulerID = 0 @@ -15383,7 +15388,9 @@ function MISSILETRAINER:New( Distance ) local function _Alive( Client ) - Client:Message( "Hello trainee, welcome to the Missile Trainer.\nGood luck!", 15, "HELLO WORLD", "Trainer" ) + if self.Briefing then + Client:Message( self.Briefing, 15, "HELLO WORLD", "Trainer" ) + end if self.MenusOnOff == true then Client:Message( "Use the 'Radio Menu' -> 'Other (F10)' -> 'Missile Trainer' menu options to change the Missile Trainer settings (for all players).", 15, "MENU", "Trainer" ) diff --git a/Moose/MissileTrainer.lua b/Moose/MissileTrainer.lua index 5454f1287..db8083430 100644 --- a/Moose/MissileTrainer.lua +++ b/Moose/MissileTrainer.lua @@ -1,5 +1,4 @@ --- Provides missile training functions. --- @module MissileTrainer -- -- @{#MISSILETRAINER} class -- ======================== @@ -67,6 +66,7 @@ -- * @{#MISSILETRAINER.InitBearingOnOff}: Sets by default the display of bearing information of missiles ON of OFF. -- * @{#MISSILETRAINER.InitMenusOnOff}: Allows to configure the options through the radio menu. -- +-- @module MissileTrainer -- @author FlightControl @@ -84,11 +84,16 @@ MISSILETRAINER = { -- When a missile is fired a SCHEDULER is set off that follows the missile. When near a certain a client player, the missile will be destroyed. -- @param #MISSILETRAINER self -- @param #number Distance The distance in meters when a tracked missile needs to be destroyed when close to a player. +-- @param #string Briefing (Optional) Will show a text to the players when starting their mission. Can be used for briefing purposes. -- @return #MISSILETRAINER -function MISSILETRAINER:New( Distance ) +function MISSILETRAINER:New( Distance, Briefing ) local self = BASE:Inherit( self, BASE:New() ) self:F( Distance ) + if Briefing then + self.Briefing = Briefing + end + self.Schedulers = {} self.SchedulerID = 0 @@ -107,7 +112,9 @@ function MISSILETRAINER:New( Distance ) local function _Alive( Client ) - Client:Message( "Hello trainee, welcome to the Missile Trainer.\nGood luck!", 15, "HELLO WORLD", "Trainer" ) + if self.Briefing then + Client:Message( self.Briefing, 15, "HELLO WORLD", "Trainer" ) + end if self.MenusOnOff == true then Client:Message( "Use the 'Radio Menu' -> 'Other (F10)' -> 'Missile Trainer' menu options to change the Missile Trainer settings (for all players).", 15, "MENU", "Trainer" ) diff --git a/Test Missions/Moose_Test_MISSILETRAINER/Moose_Test_MISSILETRAINER.lua b/Test Missions/Moose_Test_MISSILETRAINER/Moose_Test_MISSILETRAINER.lua index b5922291c..c8d4596ff 100644 --- a/Test Missions/Moose_Test_MISSILETRAINER/Moose_Test_MISSILETRAINER.lua +++ b/Test Missions/Moose_Test_MISSILETRAINER/Moose_Test_MISSILETRAINER.lua @@ -6,16 +6,15 @@ Include.File("MissileTrainer") -- This is an example of a global local Trainer = MISSILETRAINER - :New( 200 ) + :New( 200, "Trainer: Welcome to the missile training, trainee! Missiles will be fired at you. Try to evade them. Good luck!" ) :InitMessagesOnOff(true) - :InitAlertsToAll(true) -- I'll correct it below ... + :InitAlertsToAll(true) :InitAlertsHitsOnOff(true) - :InitAlertsLaunchesOnOff(false) + :InitAlertsLaunchesOnOff(false) -- I'll put it on below ... :InitBearingOnOff(true) :InitRangeOnOff(true) :InitTrackingOnOff(true) :InitTrackingToAll(true) - :InitMenusOnOff(false) -- Disable menus - :InitTrackingFrequency( 1 ) -- Make Tracking Frequency 4 seconds ... - --- Trainer:InitAlertsToAll(true) -- Now alerts are also on + :InitMenusOnOff(false) + +Trainer:InitAlertsToAll(true) -- Now alerts are also on diff --git a/Test Missions/Moose_Test_MISSILETRAINER/Moose_Test_MISSILETRAINER.miz b/Test Missions/Moose_Test_MISSILETRAINER/Moose_Test_MISSILETRAINER.miz index 9daed4d43..009a8dcde 100644 Binary files a/Test Missions/Moose_Test_MISSILETRAINER/Moose_Test_MISSILETRAINER.miz and b/Test Missions/Moose_Test_MISSILETRAINER/Moose_Test_MISSILETRAINER.miz differ
MISSILETRAINER:New(Distance)MISSILETRAINER:New(Distance, Briefing)

Creates the main object which is handling missile tracking.