diff --git a/Moose Development/Moose/Functional/Scoring.lua b/Moose Development/Moose/Functional/Scoring.lua index c3ed9d4e0..c122fc465 100644 --- a/Moose Development/Moose/Functional/Scoring.lua +++ b/Moose Development/Moose/Functional/Scoring.lua @@ -1,7 +1,7 @@ --- Single-Player:**Yes** / Multi-Player:**Yes** / Core:**Yes** -- **Administer the scoring of player achievements, -- and create a CSV file logging the scoring events for use at team or squadron websites.** -- --- -- ![Banner Image](..\Presentations\AI_Balancer\Dia1.JPG) +-- -- ![Banner Image](..\Presentations\Scoring\Dia1.JPG) -- -- === -- @@ -9,14 +9,66 @@ -- -- The @{#SCORING} class administers the scoring of player achievements, -- and creates a CSV file logging the scoring events for use at team or squadron websites. --- In other words, use AI_BALANCER to simulate human behaviour by spawning in replacement AI in multi player missions. -- --- This scoring class calculates the hits and kills that players make within a simulation session. --- Scoring is calculated using a defined algorithm. +-- The scores are calculated by scoring the hits and kills of objects that players make, +-- which are @{Unit} and @{Static) objects within your mission. +-- On top, @{Zone}s can be defined for which scores are also granted when a @{Scenery} object is hit and killed within that Zone. +-- +-- Scores are calculated based on the threat level of the objects involved. +-- The threat level of a unit can be a value between 0 and 10. +-- A calculated score takes the threat level of the target divided by the threat level of the player unit. +-- This provides a value between 0.1 and 10. +-- The stronger or the higher the threat of the player unit, the less score will be given in kills. +-- +-- +-- +-- That value can then be multiplied by a multiplier. A multiplier can be set for enemies and friendlies kills. +-- +-- Special scores can be given to specific units. These scores are added when player(s) kill that unit. +-- -- With a small change in MissionScripting.lua, the scoring can also be logged in a CSV file, that can then be uploaded -- to a database or a BI tool to publish the scoring results to the player community. +-- +-- ## 1.1) Set the kill score or penalty multiplier +-- +-- Score multipliers can be set for scores granted when enemies or friendlies are killed. +-- Use the method @{#SCORING.SetMultiplierKillScore}() to set the multiplier of enemy kills (positive kills). +-- Use the method @{#SCORING.SetMultiplierKillPenalty}() to set the multiplier of friendly kills (negative kills). +-- +-- ## 1.2) Define special targets in the mission that will give extra scores. +-- +-- Special targets can be set that will give extra scores to the players when these are killed. +-- Use the method @{#SCORING.SetScoreUnit}() to specify a special additional score for a specific @{Unit}. +-- Use the method @{#SCORING.SetScoreGroup}() to specify a special additional score for a specific @{Group}. +-- +-- ==== +-- +-- # **API CHANGE HISTORY** +-- +-- The underlying change log documents the API changes. Please read this carefully. The following notation is used: +-- +-- * **Added** parts are expressed in bold type face. +-- * _Removed_ parts are expressed in italic type face. +-- +-- Hereby the change log: +-- +-- 2017-02-26: Initial class and API. +-- +-- === +-- +-- # **AUTHORS and CONTRIBUTIONS** +-- +-- ### Contributions: +-- +-- * **Wingthor**: Testing & Advice. +-- * **Dutch-Baron**: Testing & Advice. +-- * **[Whisper](http://forums.eagle.ru/member.php?u=3829): Testing. +-- +-- ### Authors: +-- +-- * **FlightControl**: Concept, Design & Programming. +-- -- @module Scoring --- @author FlightControl --- The Scoring class @@ -62,6 +114,12 @@ function SCORING:New( GameName ) error( "A game name must be given to register the scoring results" ) end + -- Multipliers + self.MultiplierKillScore = 10 + self.MultiplierKillPenalty = 20 + + -- Additional Scores + self.ScoreUnits = {} self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash ) self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash ) @@ -78,6 +136,61 @@ function SCORING:New( GameName ) end +--- Set the multiplier for scoring valid kills (enemy kills). +-- A calculated score is a value between 0.1 and 10. +-- The multiplier magnifies the scores given to the players. +-- @param #SCORING self +-- @param #number Multiplier The multiplier of the score given. +function SCORING:SetMultiplierKillScore( Multiplier ) + + self.MultiplierKillScore = Multiplier + + return self +end + +--- Set the multiplier for scoring penalty kills (friendly kills). +-- A calculated score is a value between 0.1 and 10. +-- The multiplier magnifies the scores given to the players. +-- @param #SCORING self +-- @param #number Multiplier The multiplier of the score given. +function SCORING:SetMultiplierKillPenalty( Multiplier ) + + self.MultiplierKillPenalty = Multiplier + + return self +end + +--- Specify a special additional score for a @{Unit}. +-- @param #SCORING self +-- @param Wrapper.Unit#UNIT ScoreUnit The @{Unit} for which the Score is given. +-- @param #number Score The Score value. +function SCORING:SetScoreUnit( ScoreUnit, Score ) + + local UnitName = ScoreUnit:GetName() + + self.ScoreUnits[UnitName] = Score + + return self +end + +--- Specify a special additional score for a @{Group}. +-- @param #SCORING self +-- @param Wrapper.Group#GROUP ScoreGroup The @{Group} for which each @{Unit} a Score is given. +-- @param #number Score The Score value. +function SCORING:SetScoreGroup( ScoreGroup, Score ) + + local ScoreUnits = ScoreGroup:GetUnits() + + for ScoreUnitID, ScoreUnit in pairs( ScoreUnits ) do + local UnitName = ScoreUnit:GetName() + self.ScoreUnits[UnitName] = Score + end + + return self +end + + + --- Creates a score radio menu. Can be accessed using Radio -> F10. -- @param #SCORING self -- @return #SCORING self @@ -493,30 +606,30 @@ function SCORING:_EventOnDeadOrCrash( Event ) if InitCoalition == TargetCoalition then local ThreatLevelTarget, ThreatTypeTarget = PlayerKill.UNIT:GetThreatLevel() local ThreatLevelPlayer = Player.UNIT:GetThreatLevel() - local ThreatLevel = math.ceil( ThreatLevelTarget / ThreatLevelPlayer * 100 ) + local ThreatLevel = math.ceil( ( ThreatLevelTarget / ThreatLevelPlayer ) * self.MultiplierKillPenalty ) self:E( { ThreatLevel = ThreatLevel, ThreatLevelTarget = ThreatLevelTarget, ThreatTypeTarget = ThreatTypeTarget, ThreatLevelPlayer = ThreatLevelPlayer } ) - Player.Penalty = Player.Penalty + ThreatLevel * 4 - PlayerKill.Penalty = PlayerKill.Penalty + ThreatLevel * 4 + Player.Penalty = Player.Penalty + ThreatLevel + PlayerKill.Penalty = PlayerKill.Penalty + ThreatLevel PlayerKill.PenaltyKill = PlayerKill.PenaltyKill + 1 if Player.HitPlayers[TargetPlayerName] then -- A player killed another player MESSAGE:New( "Player '" .. PlayerName .. "' killed friendly player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " .. PlayerKill.PenaltyKill .. " times. Penalty: -" .. PlayerKill.Penalty .. ". Score Total:" .. Player.Score - Player.Penalty, - 5 ):ToAll() + 15 ):ToAll() else MESSAGE:New( "Player '" .. PlayerName .. "' killed a friendly " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " .. PlayerKill.PenaltyKill .. " times. Penalty: -" .. PlayerKill.Penalty .. ". Score Total:" .. Player.Score - Player.Penalty, - 5 ):ToAll() + 15 ):ToAll() end self:ScoreCSV( PlayerName, "KILL_PENALTY", 1, -125, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType ) else local ThreatLevelTarget, ThreatTypeTarget = PlayerKill.UNIT:GetThreatLevel() local ThreatLevelPlayer = Player.UNIT:GetThreatLevel() - local ThreatLevel = math.ceil( ThreatLevelTarget / ThreatLevelPlayer * 100 ) + local ThreatLevel = math.ceil( ( ThreatLevelTarget / ThreatLevelPlayer ) * self.MultiplierKillScore ) self:E( { ThreatLevel = ThreatLevel, ThreatLevelTarget = ThreatLevelTarget, ThreatTypeTarget = ThreatTypeTarget, ThreatLevelPlayer = ThreatLevelPlayer } ) Player.Score = Player.Score + ThreatLevel @@ -526,13 +639,22 @@ function SCORING:_EventOnDeadOrCrash( Event ) MESSAGE:New( "Player '" .. PlayerName .. "' killed enemy player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " .. PlayerKill.ScoreKill .. " times. Score: " .. PlayerKill.Score .. ". Score Total:" .. Player.Score - Player.Penalty, - 5 ):ToAll() + 15 ):ToAll() else MESSAGE:New( "Player '" .. PlayerName .. "' killed an enemy " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " .. PlayerKill.ScoreKill .. " times. Score: " .. PlayerKill.Score .. - ". Score Total:" .. Player.Score - Player.Penalty, - 5 ):ToAll() + ". Total:" .. Player.Score - Player.Penalty, + 15 ):ToAll() end + + local UnitName = PlayerKill.UNIT:GetName() + local ScoreUnit = self.ScoreUnits[UnitName] + if ScoreUnit then + Player.Score = Player.Score + ScoreUnit + PlayerKill.Score = PlayerKill.Score + ScoreUnit + MESSAGE:New( "Player '" .. PlayerName .. "' receives an extra " .. ScoreUnit .. " points! Total: " .. Player.Score - Player.Penalty, + 15 ):ToAll() + end self:ScoreCSV( PlayerName, "KILL_SCORE", 1, 10, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType ) end end diff --git a/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua b/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua index 8b4e8253d..2858727c8 100644 --- a/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua +++ b/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua @@ -1,5 +1,5 @@ env.info( '*** MOOSE STATIC INCLUDE START *** ' ) -env.info( 'Moose Generation Timestamp: 20170226_1531' ) +env.info( 'Moose Generation Timestamp: 20170226_2255' ) local base = _G Include = {} @@ -17752,7 +17752,7 @@ end --- Single-Player:**Yes** / Multi-Player:**Yes** / Core:**Yes** -- **Administer the scoring of player achievements, -- and create a CSV file logging the scoring events for use at team or squadron websites.** -- --- -- ![Banner Image](..\Presentations\AI_Balancer\Dia1.JPG) +-- -- ![Banner Image](..\Presentations\Scoring\Dia1.JPG) -- -- === -- @@ -17760,14 +17760,66 @@ end -- -- The @{#SCORING} class administers the scoring of player achievements, -- and creates a CSV file logging the scoring events for use at team or squadron websites. --- In other words, use AI_BALANCER to simulate human behaviour by spawning in replacement AI in multi player missions. -- --- This scoring class calculates the hits and kills that players make within a simulation session. --- Scoring is calculated using a defined algorithm. +-- The scores are calculated by scoring the hits and kills of objects that players make, +-- which are @{Unit} and @{Static) objects within your mission. +-- On top, @{Zone}s can be defined for which scores are also granted when a @{Scenery} object is hit and killed within that Zone. +-- +-- Scores are calculated based on the threat level of the objects involved. +-- The threat level of a unit can be a value between 0 and 10. +-- A calculated score takes the threat level of the target divided by the threat level of the player unit. +-- This provides a value between 0.1 and 10. +-- The stronger or the higher the threat of the player unit, the less score will be given in kills. +-- +-- +-- +-- That value can then be multiplied by a multiplier. A multiplier can be set for enemies and friendlies kills. +-- +-- Special scores can be given to specific units. These scores are added when player(s) kill that unit. +-- -- With a small change in MissionScripting.lua, the scoring can also be logged in a CSV file, that can then be uploaded -- to a database or a BI tool to publish the scoring results to the player community. +-- +-- ## 1.1) Set the kill score or penalty multiplier +-- +-- Score multipliers can be set for scores granted when enemies or friendlies are killed. +-- Use the method @{#SCORING.SetMultiplierKillScore}() to set the multiplier of enemy kills (positive kills). +-- Use the method @{#SCORING.SetMultiplierKillPenalty}() to set the multiplier of friendly kills (negative kills). +-- +-- ## 1.2) Define special targets in the mission that will give extra scores. +-- +-- Special targets can be set that will give extra scores to the players when these are killed. +-- Use the method @{#SCORING.SetScoreUnit}() to specify a special additional score for a specific @{Unit}. +-- Use the method @{#SCORING.SetScoreGroup}() to specify a special additional score for a specific @{Group}. +-- +-- ==== +-- +-- # **API CHANGE HISTORY** +-- +-- The underlying change log documents the API changes. Please read this carefully. The following notation is used: +-- +-- * **Added** parts are expressed in bold type face. +-- * _Removed_ parts are expressed in italic type face. +-- +-- Hereby the change log: +-- +-- 2017-02-26: Initial class and API. +-- +-- === +-- +-- # **AUTHORS and CONTRIBUTIONS** +-- +-- ### Contributions: +-- +-- * **Wingthor**: Testing & Advice. +-- * **Dutch-Baron**: Testing & Advice. +-- * **[Whisper](http://forums.eagle.ru/member.php?u=3829): Testing. +-- +-- ### Authors: +-- +-- * **FlightControl**: Concept, Design & Programming. +-- -- @module Scoring --- @author FlightControl --- The Scoring class @@ -17813,6 +17865,12 @@ function SCORING:New( GameName ) error( "A game name must be given to register the scoring results" ) end + -- Multipliers + self.MultiplierKillScore = 10 + self.MultiplierKillPenalty = 20 + + -- Additional Scores + self.ScoreUnits = {} self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash ) self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash ) @@ -17829,6 +17887,61 @@ function SCORING:New( GameName ) end +--- Set the multiplier for scoring valid kills (enemy kills). +-- A calculated score is a value between 0.1 and 10. +-- The multiplier magnifies the scores given to the players. +-- @param #SCORING self +-- @param #number Multiplier The multiplier of the score given. +function SCORING:SetMultiplierKillScore( Multiplier ) + + self.MultiplierKillScore = Multiplier + + return self +end + +--- Set the multiplier for scoring penalty kills (friendly kills). +-- A calculated score is a value between 0.1 and 10. +-- The multiplier magnifies the scores given to the players. +-- @param #SCORING self +-- @param #number Multiplier The multiplier of the score given. +function SCORING:SetMultiplierKillPenalty( Multiplier ) + + self.MultiplierKillPenalty = Multiplier + + return self +end + +--- Specify a special additional score for a @{Unit}. +-- @param #SCORING self +-- @param Wrapper.Unit#UNIT ScoreUnit The @{Unit} for which the Score is given. +-- @param #number Score The Score value. +function SCORING:SetScoreUnit( ScoreUnit, Score ) + + local UnitName = ScoreUnit:GetName() + + self.ScoreUnits[UnitName] = Score + + return self +end + +--- Specify a special additional score for a @{Group}. +-- @param #SCORING self +-- @param Wrapper.Group#GROUP ScoreGroup The @{Group} for which each @{Unit} a Score is given. +-- @param #number Score The Score value. +function SCORING:SetScoreGroup( ScoreGroup, Score ) + + local ScoreUnits = ScoreGroup:GetUnits() + + for ScoreUnitID, ScoreUnit in pairs( ScoreUnits ) do + local UnitName = ScoreUnit:GetName() + self.ScoreUnits[UnitName] = Score + end + + return self +end + + + --- Creates a score radio menu. Can be accessed using Radio -> F10. -- @param #SCORING self -- @return #SCORING self @@ -18244,30 +18357,30 @@ function SCORING:_EventOnDeadOrCrash( Event ) if InitCoalition == TargetCoalition then local ThreatLevelTarget, ThreatTypeTarget = PlayerKill.UNIT:GetThreatLevel() local ThreatLevelPlayer = Player.UNIT:GetThreatLevel() - local ThreatLevel = math.ceil( ThreatLevelTarget / ThreatLevelPlayer * 100 ) + local ThreatLevel = math.ceil( ( ThreatLevelTarget / ThreatLevelPlayer ) * self.MultiplierKillPenalty ) self:E( { ThreatLevel = ThreatLevel, ThreatLevelTarget = ThreatLevelTarget, ThreatTypeTarget = ThreatTypeTarget, ThreatLevelPlayer = ThreatLevelPlayer } ) - Player.Penalty = Player.Penalty + ThreatLevel * 4 - PlayerKill.Penalty = PlayerKill.Penalty + ThreatLevel * 4 + Player.Penalty = Player.Penalty + ThreatLevel + PlayerKill.Penalty = PlayerKill.Penalty + ThreatLevel PlayerKill.PenaltyKill = PlayerKill.PenaltyKill + 1 if Player.HitPlayers[TargetPlayerName] then -- A player killed another player MESSAGE:New( "Player '" .. PlayerName .. "' killed friendly player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " .. PlayerKill.PenaltyKill .. " times. Penalty: -" .. PlayerKill.Penalty .. ". Score Total:" .. Player.Score - Player.Penalty, - 5 ):ToAll() + 15 ):ToAll() else MESSAGE:New( "Player '" .. PlayerName .. "' killed a friendly " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " .. PlayerKill.PenaltyKill .. " times. Penalty: -" .. PlayerKill.Penalty .. ". Score Total:" .. Player.Score - Player.Penalty, - 5 ):ToAll() + 15 ):ToAll() end self:ScoreCSV( PlayerName, "KILL_PENALTY", 1, -125, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType ) else local ThreatLevelTarget, ThreatTypeTarget = PlayerKill.UNIT:GetThreatLevel() local ThreatLevelPlayer = Player.UNIT:GetThreatLevel() - local ThreatLevel = math.ceil( ThreatLevelTarget / ThreatLevelPlayer * 100 ) + local ThreatLevel = math.ceil( ( ThreatLevelTarget / ThreatLevelPlayer ) * self.MultiplierKillScore ) self:E( { ThreatLevel = ThreatLevel, ThreatLevelTarget = ThreatLevelTarget, ThreatTypeTarget = ThreatTypeTarget, ThreatLevelPlayer = ThreatLevelPlayer } ) Player.Score = Player.Score + ThreatLevel @@ -18277,13 +18390,22 @@ function SCORING:_EventOnDeadOrCrash( Event ) MESSAGE:New( "Player '" .. PlayerName .. "' killed enemy player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " .. PlayerKill.ScoreKill .. " times. Score: " .. PlayerKill.Score .. ". Score Total:" .. Player.Score - Player.Penalty, - 5 ):ToAll() + 15 ):ToAll() else MESSAGE:New( "Player '" .. PlayerName .. "' killed an enemy " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " .. PlayerKill.ScoreKill .. " times. Score: " .. PlayerKill.Score .. - ". Score Total:" .. Player.Score - Player.Penalty, - 5 ):ToAll() + ". Total:" .. Player.Score - Player.Penalty, + 15 ):ToAll() end + + local UnitName = PlayerKill.UNIT:GetName() + local ScoreUnit = self.ScoreUnits[UnitName] + if ScoreUnit then + Player.Score = Player.Score + ScoreUnit + PlayerKill.Score = PlayerKill.Score + ScoreUnit + MESSAGE:New( "Player '" .. PlayerName .. "' receives an extra " .. ScoreUnit .. " points! Total: " .. Player.Score - Player.Penalty, + 15 ):ToAll() + end self:ScoreCSV( PlayerName, "KILL_SCORE", 1, 10, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType ) end end diff --git a/Moose Mission Setup/Moose.lua b/Moose Mission Setup/Moose.lua index 8b4e8253d..2858727c8 100644 --- a/Moose Mission Setup/Moose.lua +++ b/Moose Mission Setup/Moose.lua @@ -1,5 +1,5 @@ env.info( '*** MOOSE STATIC INCLUDE START *** ' ) -env.info( 'Moose Generation Timestamp: 20170226_1531' ) +env.info( 'Moose Generation Timestamp: 20170226_2255' ) local base = _G Include = {} @@ -17752,7 +17752,7 @@ end --- Single-Player:**Yes** / Multi-Player:**Yes** / Core:**Yes** -- **Administer the scoring of player achievements, -- and create a CSV file logging the scoring events for use at team or squadron websites.** -- --- -- ![Banner Image](..\Presentations\AI_Balancer\Dia1.JPG) +-- -- ![Banner Image](..\Presentations\Scoring\Dia1.JPG) -- -- === -- @@ -17760,14 +17760,66 @@ end -- -- The @{#SCORING} class administers the scoring of player achievements, -- and creates a CSV file logging the scoring events for use at team or squadron websites. --- In other words, use AI_BALANCER to simulate human behaviour by spawning in replacement AI in multi player missions. -- --- This scoring class calculates the hits and kills that players make within a simulation session. --- Scoring is calculated using a defined algorithm. +-- The scores are calculated by scoring the hits and kills of objects that players make, +-- which are @{Unit} and @{Static) objects within your mission. +-- On top, @{Zone}s can be defined for which scores are also granted when a @{Scenery} object is hit and killed within that Zone. +-- +-- Scores are calculated based on the threat level of the objects involved. +-- The threat level of a unit can be a value between 0 and 10. +-- A calculated score takes the threat level of the target divided by the threat level of the player unit. +-- This provides a value between 0.1 and 10. +-- The stronger or the higher the threat of the player unit, the less score will be given in kills. +-- +-- +-- +-- That value can then be multiplied by a multiplier. A multiplier can be set for enemies and friendlies kills. +-- +-- Special scores can be given to specific units. These scores are added when player(s) kill that unit. +-- -- With a small change in MissionScripting.lua, the scoring can also be logged in a CSV file, that can then be uploaded -- to a database or a BI tool to publish the scoring results to the player community. +-- +-- ## 1.1) Set the kill score or penalty multiplier +-- +-- Score multipliers can be set for scores granted when enemies or friendlies are killed. +-- Use the method @{#SCORING.SetMultiplierKillScore}() to set the multiplier of enemy kills (positive kills). +-- Use the method @{#SCORING.SetMultiplierKillPenalty}() to set the multiplier of friendly kills (negative kills). +-- +-- ## 1.2) Define special targets in the mission that will give extra scores. +-- +-- Special targets can be set that will give extra scores to the players when these are killed. +-- Use the method @{#SCORING.SetScoreUnit}() to specify a special additional score for a specific @{Unit}. +-- Use the method @{#SCORING.SetScoreGroup}() to specify a special additional score for a specific @{Group}. +-- +-- ==== +-- +-- # **API CHANGE HISTORY** +-- +-- The underlying change log documents the API changes. Please read this carefully. The following notation is used: +-- +-- * **Added** parts are expressed in bold type face. +-- * _Removed_ parts are expressed in italic type face. +-- +-- Hereby the change log: +-- +-- 2017-02-26: Initial class and API. +-- +-- === +-- +-- # **AUTHORS and CONTRIBUTIONS** +-- +-- ### Contributions: +-- +-- * **Wingthor**: Testing & Advice. +-- * **Dutch-Baron**: Testing & Advice. +-- * **[Whisper](http://forums.eagle.ru/member.php?u=3829): Testing. +-- +-- ### Authors: +-- +-- * **FlightControl**: Concept, Design & Programming. +-- -- @module Scoring --- @author FlightControl --- The Scoring class @@ -17813,6 +17865,12 @@ function SCORING:New( GameName ) error( "A game name must be given to register the scoring results" ) end + -- Multipliers + self.MultiplierKillScore = 10 + self.MultiplierKillPenalty = 20 + + -- Additional Scores + self.ScoreUnits = {} self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash ) self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash ) @@ -17829,6 +17887,61 @@ function SCORING:New( GameName ) end +--- Set the multiplier for scoring valid kills (enemy kills). +-- A calculated score is a value between 0.1 and 10. +-- The multiplier magnifies the scores given to the players. +-- @param #SCORING self +-- @param #number Multiplier The multiplier of the score given. +function SCORING:SetMultiplierKillScore( Multiplier ) + + self.MultiplierKillScore = Multiplier + + return self +end + +--- Set the multiplier for scoring penalty kills (friendly kills). +-- A calculated score is a value between 0.1 and 10. +-- The multiplier magnifies the scores given to the players. +-- @param #SCORING self +-- @param #number Multiplier The multiplier of the score given. +function SCORING:SetMultiplierKillPenalty( Multiplier ) + + self.MultiplierKillPenalty = Multiplier + + return self +end + +--- Specify a special additional score for a @{Unit}. +-- @param #SCORING self +-- @param Wrapper.Unit#UNIT ScoreUnit The @{Unit} for which the Score is given. +-- @param #number Score The Score value. +function SCORING:SetScoreUnit( ScoreUnit, Score ) + + local UnitName = ScoreUnit:GetName() + + self.ScoreUnits[UnitName] = Score + + return self +end + +--- Specify a special additional score for a @{Group}. +-- @param #SCORING self +-- @param Wrapper.Group#GROUP ScoreGroup The @{Group} for which each @{Unit} a Score is given. +-- @param #number Score The Score value. +function SCORING:SetScoreGroup( ScoreGroup, Score ) + + local ScoreUnits = ScoreGroup:GetUnits() + + for ScoreUnitID, ScoreUnit in pairs( ScoreUnits ) do + local UnitName = ScoreUnit:GetName() + self.ScoreUnits[UnitName] = Score + end + + return self +end + + + --- Creates a score radio menu. Can be accessed using Radio -> F10. -- @param #SCORING self -- @return #SCORING self @@ -18244,30 +18357,30 @@ function SCORING:_EventOnDeadOrCrash( Event ) if InitCoalition == TargetCoalition then local ThreatLevelTarget, ThreatTypeTarget = PlayerKill.UNIT:GetThreatLevel() local ThreatLevelPlayer = Player.UNIT:GetThreatLevel() - local ThreatLevel = math.ceil( ThreatLevelTarget / ThreatLevelPlayer * 100 ) + local ThreatLevel = math.ceil( ( ThreatLevelTarget / ThreatLevelPlayer ) * self.MultiplierKillPenalty ) self:E( { ThreatLevel = ThreatLevel, ThreatLevelTarget = ThreatLevelTarget, ThreatTypeTarget = ThreatTypeTarget, ThreatLevelPlayer = ThreatLevelPlayer } ) - Player.Penalty = Player.Penalty + ThreatLevel * 4 - PlayerKill.Penalty = PlayerKill.Penalty + ThreatLevel * 4 + Player.Penalty = Player.Penalty + ThreatLevel + PlayerKill.Penalty = PlayerKill.Penalty + ThreatLevel PlayerKill.PenaltyKill = PlayerKill.PenaltyKill + 1 if Player.HitPlayers[TargetPlayerName] then -- A player killed another player MESSAGE:New( "Player '" .. PlayerName .. "' killed friendly player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " .. PlayerKill.PenaltyKill .. " times. Penalty: -" .. PlayerKill.Penalty .. ". Score Total:" .. Player.Score - Player.Penalty, - 5 ):ToAll() + 15 ):ToAll() else MESSAGE:New( "Player '" .. PlayerName .. "' killed a friendly " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " .. PlayerKill.PenaltyKill .. " times. Penalty: -" .. PlayerKill.Penalty .. ". Score Total:" .. Player.Score - Player.Penalty, - 5 ):ToAll() + 15 ):ToAll() end self:ScoreCSV( PlayerName, "KILL_PENALTY", 1, -125, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType ) else local ThreatLevelTarget, ThreatTypeTarget = PlayerKill.UNIT:GetThreatLevel() local ThreatLevelPlayer = Player.UNIT:GetThreatLevel() - local ThreatLevel = math.ceil( ThreatLevelTarget / ThreatLevelPlayer * 100 ) + local ThreatLevel = math.ceil( ( ThreatLevelTarget / ThreatLevelPlayer ) * self.MultiplierKillScore ) self:E( { ThreatLevel = ThreatLevel, ThreatLevelTarget = ThreatLevelTarget, ThreatTypeTarget = ThreatTypeTarget, ThreatLevelPlayer = ThreatLevelPlayer } ) Player.Score = Player.Score + ThreatLevel @@ -18277,13 +18390,22 @@ function SCORING:_EventOnDeadOrCrash( Event ) MESSAGE:New( "Player '" .. PlayerName .. "' killed enemy player '" .. TargetPlayerName .. "' " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " .. PlayerKill.ScoreKill .. " times. Score: " .. PlayerKill.Score .. ". Score Total:" .. Player.Score - Player.Penalty, - 5 ):ToAll() + 15 ):ToAll() else MESSAGE:New( "Player '" .. PlayerName .. "' killed an enemy " .. TargetUnitCategory .. " ( " .. ThreatTypeTarget .. " ) " .. PlayerKill.ScoreKill .. " times. Score: " .. PlayerKill.Score .. - ". Score Total:" .. Player.Score - Player.Penalty, - 5 ):ToAll() + ". Total:" .. Player.Score - Player.Penalty, + 15 ):ToAll() end + + local UnitName = PlayerKill.UNIT:GetName() + local ScoreUnit = self.ScoreUnits[UnitName] + if ScoreUnit then + Player.Score = Player.Score + ScoreUnit + PlayerKill.Score = PlayerKill.Score + ScoreUnit + MESSAGE:New( "Player '" .. PlayerName .. "' receives an extra " .. ScoreUnit .. " points! Total: " .. Player.Score - Player.Penalty, + 15 ):ToAll() + end self:ScoreCSV( PlayerName, "KILL_SCORE", 1, 10, InitUnitName, InitUnitCoalition, InitUnitCategory, InitUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType ) end end diff --git a/Moose Test Missions/SCO - Scoring/SCO-100 - Scoring of Statics/SCO-100 - Scoring of Statics.lua b/Moose Test Missions/SCO - Scoring/SCO-100 - Scoring of Statics/SCO-100 - Scoring of Statics.lua index 7c2f7a85e..a13479d45 100644 --- a/Moose Test Missions/SCO - Scoring/SCO-100 - Scoring of Statics/SCO-100 - Scoring of Statics.lua +++ b/Moose Test Missions/SCO - Scoring/SCO-100 - Scoring of Statics/SCO-100 - Scoring of Statics.lua @@ -18,4 +18,10 @@ local CommandCenter = COMMANDCENTER:New( HQ, "Lima" ) local Scoring = SCORING:New( "Detect Demo" ) +Scoring:SetMultiplierKillScore( 10 ) + +Scoring:SetMultiplierKillPenalty( 40 ) + +Scoring:SetScoreUnit( UNIT:FindByName( "Unit #001" ), 200 ) + diff --git a/Moose Test Missions/SCO - Scoring/SCO-100 - Scoring of Statics/SCO-100 - Scoring of Statics.miz b/Moose Test Missions/SCO - Scoring/SCO-100 - Scoring of Statics/SCO-100 - Scoring of Statics.miz index 3889bddfc..dc006b894 100644 Binary files a/Moose Test Missions/SCO - Scoring/SCO-100 - Scoring of Statics/SCO-100 - Scoring of Statics.miz and b/Moose Test Missions/SCO - Scoring/SCO-100 - Scoring of Statics/SCO-100 - Scoring of Statics.miz differ diff --git a/Moose Test Missions/SCO - Scoring/SCO-101 - Scoring Client to Client/SCO-101 - Scoring Client to Client.miz b/Moose Test Missions/SCO - Scoring/SCO-101 - Scoring Client to Client/SCO-101 - Scoring Client to Client.miz index f91a56ba3..14d54dfae 100644 Binary files a/Moose Test Missions/SCO - Scoring/SCO-101 - Scoring Client to Client/SCO-101 - Scoring Client to Client.miz and b/Moose Test Missions/SCO - Scoring/SCO-101 - Scoring Client to Client/SCO-101 - Scoring Client to Client.miz differ diff --git a/docs/Documentation/AI_Balancer.html b/docs/Documentation/AI_Balancer.html index 7b1a36cfe..3430f1276 100644 --- a/docs/Documentation/AI_Balancer.html +++ b/docs/Documentation/AI_Balancer.html @@ -71,7 +71,7 @@

Module AI_Balancer

-

Single-Player:No / Mulit-Player:Yes / AI:Yes / Human:No / Types:All -- AI Balancing will replace in multi player missions +

Single-Player:No / Multi-Player:Yes / AI:Yes / Human:No / Types:All -- AI Balancing will replace in multi player missions non-occupied human slots with AI groups, in order to provide an engaging simulation environment, even when there are hardly any players in the mission.

diff --git a/docs/Documentation/AI_Cap.html b/docs/Documentation/AI_Cap.html index ec34c1a56..7142bc794 100644 --- a/docs/Documentation/AI_Cap.html +++ b/docs/Documentation/AI_Cap.html @@ -71,7 +71,7 @@

Module AI_Cap

-

Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Air -- Execute Combat Air Patrol (CAP).

+

Single-Player:Yes / Multi-Player:Yes / AI:Yes / Human:No / Types:Air -- Execute Combat Air Patrol (CAP).

Banner Image

diff --git a/docs/Documentation/AI_Cas.html b/docs/Documentation/AI_Cas.html index a18c40a16..d92668d0a 100644 --- a/docs/Documentation/AI_Cas.html +++ b/docs/Documentation/AI_Cas.html @@ -71,7 +71,7 @@

Module AI_Cas

-

Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Air -- +

Single-Player:Yes / Multi-Player:Yes / AI:Yes / Human:No / Types:Air -- Provide Close Air Support to friendly ground troops.

Banner Image

@@ -307,7 +307,7 @@ It can be notified to go RTB through the RTB event.

- AI_CAS_ZONE:New(PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType, EngageZone) + AI_CAS_ZONE:New(PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageZone, PatrolAltType)

Creates a new AICASZONE object

@@ -706,7 +706,7 @@ It can be notified to go RTB through the RTB event.

-AI_CAS_ZONE:New(PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, PatrolAltType, EngageZone) +AI_CAS_ZONE:New(PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed, EngageZone, PatrolAltType)
@@ -747,13 +747,14 @@ The maximum speed of the Controllable in km/h.
  • -

    Dcs.DCSTypes#AltitudeType PatrolAltType : -The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to RADIO

    +

    Core.Zone#ZONE_BASE EngageZone : +The zone where the engage will happen.

  • -

    Core.Zone#ZONE EngageZone :

    +

    Dcs.DCSTypes#AltitudeType PatrolAltType : +The altitude type ("RADIO"=="AGL", "BARO"=="ASL"). Defaults to RADIO

  • diff --git a/docs/Documentation/AI_Patrol.html b/docs/Documentation/AI_Patrol.html index c2d613229..1e1e5be34 100644 --- a/docs/Documentation/AI_Patrol.html +++ b/docs/Documentation/AI_Patrol.html @@ -71,7 +71,7 @@

    Module AI_Patrol

    -

    Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Air -- +

    Single-Player:Yes / Multi-Player:Yes / AI:Yes / Human:No / Types:Air -- Air Patrolling or Staging.

    Banner Image

    diff --git a/docs/Documentation/Cargo.html b/docs/Documentation/Cargo.html index fb98d54a5..ead2acb94 100644 --- a/docs/Documentation/Cargo.html +++ b/docs/Documentation/Cargo.html @@ -71,7 +71,7 @@

    Module Cargo

    -

    Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Ground --
    +

    Single-Player:Yes / Multi-Player:Yes / AI:Yes / Human:No / Types:Ground --
    Management of logical cargo objects, that can be transported from and to transportation carriers.

    Banner Image

    diff --git a/docs/Documentation/Event.html b/docs/Documentation/Event.html index 79c16f3a2..ac8a076a3 100644 --- a/docs/Documentation/Event.html +++ b/docs/Documentation/Event.html @@ -115,7 +115,7 @@ in the correct processing order.

    Objects

    -

    For most DCS events, the above order of updating will be followed.1

    +

    For most DCS events, the above order of updating will be followed.

    Objects

    @@ -206,6 +206,23 @@ There are basically 4 main categories of information stored in the EVENTDATA str

    Objects

    +

    IMPORTANT NOTE: Some events can involve not just UNIT objects, but also STATIC objects!!! +In that case the initiator or target unit fields will refer to a STATIC object! +In case a STATIC object is involved, the documentation indicates which fields will and won't not be populated. +The fields IniCategory and TgtCategory contain the indicator which kind of object is involved in the event. +You can use the enumerator Object.Category.UNIT and Object.Category.STATIC to check on IniCategory and TgtCategory. +Example code snippet:

    + +
     if Event.IniCategory == Object.Category.UNIT then
    +  ...
    + end
    + if Event.IniCategory == Object.Category.STATIC then
    +  ...
    + end 
    +
    + +

    When a static object is involved in the event, the Group and Player fields won't be populated.

    +

    API CHANGE HISTORY

    @@ -571,81 +588,141 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added

    Type EVENTDATA

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -669,25 +746,28 @@ YYYY-MM-DD: CLASS:NewFunction( Params ) added

    EVENTDATA.IniCategory +
      (UNIT/STATIC) The initiator object category ( Object.Category.UNIT or Object.Category.STATIC ).
    +
    +
    EVENTDATA.IniDCSGroup - +
      (UNIT) The initiating {Dcs.DCSGroup#Group}.
    +
    EVENTDATA.IniDCSGroupName - +

    (UNIT) The initiating Group name.

    EVENTDATA.IniDCSUnit - +
       (UNIT/STATIC) The initiating <a href="Dcs.DCSUnit.html##(Unit)">Dcs.DCSUnit#Unit</a> or <a href="Dcs.DCSStaticObject.html##(StaticObject)">Dcs.DCSStaticObject#StaticObject</a>.
    +
    EVENTDATA.IniDCSUnitName - +

    (UNIT/STATIC) The initiating Unit name.

    EVENTDATA.IniGroup +
         (UNIT) The initiating MOOSE wrapper <a href="Wrapper.Group.html##(GROUP)">Wrapper.Group#GROUP</a> of the initiator Group object.
    +
    +
    EVENTDATA.IniGroupName +
     (UNIT) The initiating GROUP name (same as IniDCSGroupName).
    +
    +
    EVENTDATA.IniPlayerName +
    (UNIT) The name of the initiating player in case the Unit is a client or player slot.
    +
    EVENTDATA.IniUnit - +
          (UNIT/STATIC) The initiating MOOSE wrapper <a href="Wrapper.Unit.html##(UNIT)">Wrapper.Unit#UNIT</a> of the initiator Unit object.
    +
    EVENTDATA.IniUnitName - +
      (UNIT/STATIC) The initiating UNIT name (same as IniDCSUnitName).
    +
    +
    EVENTDATA.TgtCategory +
      (UNIT/STATIC) The target object category ( Object.Category.UNIT or Object.Category.STATIC ).
    +
    EVENTDATA.TgtDCSGroup - +
      (UNIT) The target {Dcs.DCSGroup#Group}.
    +
    EVENTDATA.TgtDCSGroupName - +

    (UNIT) The target Group name.

    EVENTDATA.TgtDCSUnit - +
       (UNIT/STATIC) The target <a href="Dcs.DCSUnit.html##(Unit)">Dcs.DCSUnit#Unit</a> or <a href="Dcs.DCSStaticObject.html##(StaticObject)">Dcs.DCSStaticObject#StaticObject</a>.
    +
    EVENTDATA.TgtDCSUnitName +

    (UNIT/STATIC) The target Unit name.

    +
    EVENTDATA.TgtGroup +
         (UNIT) The target MOOSE wrapper <a href="Wrapper.Group.html##(GROUP)">Wrapper.Group#GROUP</a> of the target Group object.
    +
    +
    EVENTDATA.TgtGroupName +
     (UNIT) The target GROUP name (same as TgtDCSGroupName).
    +
    +
    EVENTDATA.TgtPlayerName +
    (UNIT) The name of the target player in case the Unit is a client or player slot.
    +
    EVENTDATA.TgtUnit - +
          (UNIT/STATIC) The target MOOSE wrapper <a href="Wrapper.Unit.html##(UNIT)">Wrapper.Unit#UNIT</a> of the target Unit object.
    +
    EVENTDATA.TgtUnitName - +
      (UNIT/STATIC) The target UNIT name (same as TgtDCSUnitName).
    +
    EVENTDATA.id +

    The identifier of the event.

    EVENTDATA.initiator - +
        (UNIT/STATIC) The initiating <a href="Dcs.DCSUnit.html##(Unit)">Dcs.DCSUnit#Unit</a> or <a href="Dcs.DCSStaticObject.html##(StaticObject)">Dcs.DCSStaticObject#StaticObject</a>.
    +
    EVENTDATA.target - +
           (UNIT/STATIC) The target <a href="Dcs.DCSUnit.html##(Unit)">Dcs.DCSUnit#Unit</a> or <a href="Dcs.DCSStaticObject.html##(StaticObject)">Dcs.DCSStaticObject#StaticObject</a>.
    +
    EVENTDATA.weapon - +

    The weapon used during the event.

    @@ -2438,71 +2518,135 @@ The self instance of the class for which the event is.

    Type EVENTDATA

    -

    The Event structure

    +

    The Event structure +Note that at the beginning of each field description, there is an indication which field will be populated depending on the object type involved in the Event:

    + +
      +
    • A (Object.Category.)UNIT : A UNIT object type is involved in the Event.
    • +
    + + +
      +
    • A (Object.Category.)STATIC : A STATIC object type is involved in the Event.µ +
    • +

    Field(s)

    + Dcs.DCSObject#Object.Category + +EVENTDATA.IniCategory + +
    +
    + +
      (UNIT/STATIC) The initiator object category ( Object.Category.UNIT or Object.Category.STATIC ).
    +
    + +
    +
    +
    +
    + + Dcs.DCSGroup#Group EVENTDATA.IniDCSGroup
    - +
      (UNIT) The initiating {Dcs.DCSGroup#Group}.
    +
    + #string EVENTDATA.IniDCSGroupName
    - +

    (UNIT) The initiating Group name.

    + Dcs.DCSUnit#Unit EVENTDATA.IniDCSUnit
    - +
       (UNIT/STATIC) The initiating <a href="Dcs.DCSUnit.html##(Unit)">Dcs.DCSUnit#Unit</a> or <a href="Dcs.DCSStaticObject.html##(StaticObject)">Dcs.DCSStaticObject#StaticObject</a>.
    +
    + #string EVENTDATA.IniDCSUnitName
    - +

    (UNIT/STATIC) The initiating Unit name.

    - + Wrapper.Group#GROUP EVENTDATA.IniGroup
    +
         (UNIT) The initiating MOOSE wrapper <a href="Wrapper.Group.html##(GROUP)">Wrapper.Group#GROUP</a> of the initiator Group object.
    +
    + +
    +
    +
    +
    + + #string + +EVENTDATA.IniGroupName + +
    +
    + +
     (UNIT) The initiating GROUP name (same as IniDCSGroupName).
    +
    + +
    +
    +
    +
    + + #string + +EVENTDATA.IniPlayerName + +
    +
    + +
    (UNIT) The name of the initiating player in case the Unit is a client or player slot.
    +
    @@ -2517,7 +2661,8 @@ The self instance of the class for which the event is.

    - +
          (UNIT/STATIC) The initiating MOOSE wrapper <a href="Wrapper.Unit.html##(UNIT)">Wrapper.Unit#UNIT</a> of the initiator Unit object.
    +
    @@ -2531,58 +2676,126 @@ The self instance of the class for which the event is.

    - +
      (UNIT/STATIC) The initiating UNIT name (same as IniDCSUnitName).
    +
    + Dcs.DCSObject#Object.Category + +EVENTDATA.TgtCategory + +
    +
    + +
      (UNIT/STATIC) The target object category ( Object.Category.UNIT or Object.Category.STATIC ).
    +
    + +
    +
    +
    +
    + + Dcs.DCSGroup#Group EVENTDATA.TgtDCSGroup
    - +
      (UNIT) The target {Dcs.DCSGroup#Group}.
    +
    + #string EVENTDATA.TgtDCSGroupName
    - +

    (UNIT) The target Group name.

    + Dcs.DCSUnit#Unit EVENTDATA.TgtDCSUnit
    - +
       (UNIT/STATIC) The target <a href="Dcs.DCSUnit.html##(Unit)">Dcs.DCSUnit#Unit</a> or <a href="Dcs.DCSStaticObject.html##(StaticObject)">Dcs.DCSStaticObject#StaticObject</a>.
    +
    + #string EVENTDATA.TgtDCSUnitName
    +

    (UNIT/STATIC) The target Unit name.

    + +
    +
    +
    +
    + + Wrapper.Group#GROUP + +EVENTDATA.TgtGroup + +
    +
    + +
         (UNIT) The target MOOSE wrapper <a href="Wrapper.Group.html##(GROUP)">Wrapper.Group#GROUP</a> of the target Group object.
    +
    + +
    +
    +
    +
    + + #string + +EVENTDATA.TgtGroupName + +
    +
    + +
     (UNIT) The target GROUP name (same as TgtDCSGroupName).
    +
    + +
    +
    +
    +
    + + #string + +EVENTDATA.TgtPlayerName + +
    +
    + +
    (UNIT) The name of the target player in case the Unit is a client or player slot.
    +
    @@ -2597,7 +2810,8 @@ The self instance of the class for which the event is.

    - +
          (UNIT/STATIC) The target MOOSE wrapper <a href="Wrapper.Unit.html##(UNIT)">Wrapper.Unit#UNIT</a> of the target Unit object.
    +
    @@ -2611,7 +2825,8 @@ The self instance of the class for which the event is.

    - +
      (UNIT/STATIC) The target UNIT name (same as TgtDCSUnitName).
    +
    @@ -2657,12 +2872,14 @@ The self instance of the class for which the event is.

    + #number EVENTDATA.id
    +

    The identifier of the event.

    @@ -2670,26 +2887,30 @@ The self instance of the class for which the event is.

    + Dcs.DCSUnit#Unit EVENTDATA.initiator
    - +
        (UNIT/STATIC) The initiating <a href="Dcs.DCSUnit.html##(Unit)">Dcs.DCSUnit#Unit</a> or <a href="Dcs.DCSStaticObject.html##(StaticObject)">Dcs.DCSStaticObject#StaticObject</a>.
    +
    + Dcs.DCSUnit#Unit EVENTDATA.target
    - +
           (UNIT/STATIC) The target <a href="Dcs.DCSUnit.html##(Unit)">Dcs.DCSUnit#Unit</a> or <a href="Dcs.DCSStaticObject.html##(StaticObject)">Dcs.DCSStaticObject#StaticObject</a>.
    +
    @@ -2702,7 +2923,7 @@ The self instance of the class for which the event is.

    - +

    The weapon used during the event.

    diff --git a/docs/Documentation/Scoring.html b/docs/Documentation/Scoring.html index 1e707ab2a..18ca500a0 100644 --- a/docs/Documentation/Scoring.html +++ b/docs/Documentation/Scoring.html @@ -71,22 +71,86 @@

    Module Scoring

    -

    Scoring system for MOOSE.

    +

    Single-Player:Yes / Multi-Player:Yes / Core:Yes -- Administer the scoring of player achievements, +and create a CSV file logging the scoring events for use at team or squadron websites.

    + +

    -- Banner Image

    + +
    + +

    1) Scoring#SCORING class, extends Base#BASE

    + +

    The #SCORING class administers the scoring of player achievements, +and creates a CSV file logging the scoring events for use at team or squadron websites.

    -

    This scoring class calculates the hits and kills that players make within a simulation session. -Scoring is calculated using a defined algorithm. -With a small change in MissionScripting.lua, the scoring can also be logged in a CSV file, that can then be uploaded + +

    The scores are calculated by scoring the hits and kills of objects that players make, +which are Unit and Statics can be defined for which scores are also granted when a Scenery object is hit and killed within that Zone.

    + +

    Scores are calculated based on the threat level of the objects involved. +The threat level of a unit can be a value between 0 and 10. +A calculated score takes the threat level of the target divided by the threat level of the player unit. +This provides a value between 0.1 and 10. +The stronger or the higher the threat of the player unit, the less score will be given in kills.

    + + + +

    That value can then be multiplied by a multiplier. A multiplier can be set for enemies and friendlies kills.

    + +

    Special scores can be given to specific units. These scores are added when player(s) kill that unit.

    + +

    With a small change in MissionScripting.lua, the scoring can also be logged in a CSV file, that can then be uploaded to a database or a BI tool to publish the scoring results to the player community.

    +

    1.1) Set the kill score or penalty multiplier

    + +

    Score multipliers can be set for scores granted when enemies or friendlies are killed. +Use the method SCORING.SetMultiplierKillScore() to set the multiplier of enemy kills (positive kills). +Use the method SCORING.SetMultiplierKillPenalty() to set the multiplier of friendly kills (negative kills).

    + +

    1.2) Define special targets in the mission that will give extra scores.

    + +

    Special targets can be set that will give extra scores to the players when these are killed. +Use the method SCORING.SetScoreUnit() to specify a special additional score for a specific Unit. +Use the method SCORING.SetScoreGroup() to specify a special additional score for a specific Group.

    + +
    + +

    API CHANGE HISTORY

    + +

    The underlying change log documents the API changes. Please read this carefully. The following notation is used:

    + +
      +
    • Added parts are expressed in bold type face.
    • +
    • Removed parts are expressed in italic type face.
    • +
    + +

    Hereby the change log:

    + +

    2017-02-26: Initial class and API.

    + +
    + +

    AUTHORS and CONTRIBUTIONS

    + +

    Contributions:

    + +
      +
    • Wingthor: Testing & Advice.
    • +
    • Dutch-Baron: Testing & Advice.
    • +
    • **Whisper: Testing.
    • +
    + +

    Authors:

    + +
      +
    • FlightControl: Concept, Design & Programming.
    • +
    + +

    Global(s)

    - - - - + + + + + + + + @@ -202,6 +278,30 @@ to a database or a BI tool to publish the scoring results to the player communit + + + + + + + + + + + + + + + + @@ -246,20 +346,6 @@ to a database or a BI tool to publish the scoring results to the player communit
    - - -ClientGroup - -
    -
    - - - -
    -
    -
    -
    - #SCORING SCORING @@ -387,6 +473,34 @@ to a database or a BI tool to publish the scoring results to the player communit + +
    +
    +
    + + + +SCORING.MultiplierKillPenalty + +
    +
    + + + +
    +
    +
    +
    + + + +SCORING.MultiplierKillScore + +
    +
    + + +
    @@ -656,6 +770,114 @@ self

    + +SCORING:SetMultiplierKillPenalty(Multiplier) + +
    +
    + +

    Set the multiplier for scoring penalty kills (friendly kills).

    + + +

    A calculated score is a value between 0.1 and 10. +The multiplier magnifies the scores given to the players.

    + +

    Parameter

    +
      +
    • + +

      #number Multiplier : +The multiplier of the score given.

      + +
    • +
    +
    +
    +
    +
    + + +SCORING:SetMultiplierKillScore(Multiplier) + +
    +
    + +

    Set the multiplier for scoring valid kills (enemy kills).

    + + +

    A calculated score is a value between 0.1 and 10. +The multiplier magnifies the scores given to the players.

    + +

    Parameter

    +
      +
    • + +

      #number Multiplier : +The multiplier of the score given.

      + +
    • +
    +
    +
    +
    +
    + + +SCORING:SetScoreGroup(ScoreGroup, Score) + +
    +
    + +

    Specify a special additional score for a Group.

    + +

    Parameters

    + +
    +
    +
    +
    + + +SCORING:SetScoreUnit(ScoreUnit, Score) + +
    +
    + +

    Specify a special additional score for a Unit.

    + +

    Parameters

    +
      +
    • + +

      Wrapper.Unit#UNIT ScoreUnit : +The Unit for which the Score is given.

      + +
    • +
    • + +

      #number Score : +The Score value.

      + +
    • +
    +
    +
    +
    +
    + SCORING:_AddMissionScore(Mission, PlayerUnit, Text, Score) @@ -740,7 +962,7 @@ self

    diff --git a/docs/Documentation/Spawn.html b/docs/Documentation/Spawn.html index 42eb4a563..0075c158f 100644 --- a/docs/Documentation/Spawn.html +++ b/docs/Documentation/Spawn.html @@ -71,7 +71,7 @@

    Module Spawn

    -

    Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:All --
    +

    Single-Player:Yes / Multi-Player:Yes / AI:Yes / Human:No / Types:All --
    Spawn groups of units dynamically in your missions.

    Banner Image

    @@ -1758,6 +1758,9 @@ The group that was spawned. You can use this group for further actions.

    + +

    Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.

    +
    @@ -2528,7 +2531,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 )
    - + #boolean SPAWN.SpawnUnControlled @@ -2552,7 +2555,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 ) -

    Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned.

    +

    When the first Spawn executes, all the Groups need to be made visible before start.

    diff --git a/docs/Documentation/Static.html b/docs/Documentation/Static.html index f71da321b..bd45b0b02 100644 --- a/docs/Documentation/Static.html +++ b/docs/Documentation/Static.html @@ -133,6 +133,12 @@ If the DCS Static object does not exist or is nil, the STATIC methods will retur
    + + + + @@ -226,6 +232,19 @@ Name of the DCS Static as defined within the Mission Editor.

    + +
    +
    + + +STATIC:GetThreatLevel() + +
    +
    + + +
    diff --git a/docs/Documentation/index.html b/docs/Documentation/index.html index bc5b59a13..e358d4b77 100644 --- a/docs/Documentation/index.html +++ b/docs/Documentation/index.html @@ -74,7 +74,7 @@
    @@ -358,7 +368,7 @@ following a given priority.

    ClientGroup - -
    SCORING @@ -142,6 +206,18 @@ to a database or a BI tool to publish the scoring results to the player communit SCORING.Menu +
    SCORING.MultiplierKillPenalty + +
    SCORING.MultiplierKillScore +
    SCORING:SecondsToClock(sSeconds) +
    SCORING:SetMultiplierKillPenalty(Multiplier) +

    Set the multiplier for scoring penalty kills (friendly kills).

    +
    SCORING:SetMultiplierKillScore(Multiplier) +

    Set the multiplier for scoring valid kills (enemy kills).

    +
    SCORING:SetScoreGroup(ScoreGroup, Score) +

    Specify a special additional score for a Group.

    +
    SCORING:SetScoreUnit(ScoreUnit, Score) +

    Specify a special additional score for a Unit.

    STATIC:GetDCSObject() +
    STATIC:GetThreatLevel() +
    AI_Balancer -

    Single-Player:No / Mulit-Player:Yes / AI:Yes / Human:No / Types:All -- AI Balancing will replace in multi player missions +

    Single-Player:No / Multi-Player:Yes / AI:Yes / Human:No / Types:All -- AI Balancing will replace in multi player missions non-occupied human slots with AI groups, in order to provide an engaging simulation environment, even when there are hardly any players in the mission.

    @@ -91,7 +91,7 @@ CLIENTS in a SET_CLIENT collection, which are not occupied by human players.

    AI_Cap -

    Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Air -- Execute Combat Air Patrol (CAP).

    +

    Single-Player:Yes / Multi-Player:Yes / AI:Yes / Human:No / Types:Air -- Execute Combat Air Patrol (CAP).

    Banner Image

    @@ -106,7 +106,7 @@ and automatically engage any airborne enemies that are within a certain range or
    AI_Cas -

    Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Air -- +

    Single-Player:Yes / Multi-Player:Yes / AI:Yes / Human:No / Types:Air -- Provide Close Air Support to friendly ground troops.

    Banner Image

    @@ -121,7 +121,7 @@ and automatically engage any airborne enemies that are within a certain range or
    AI_Patrol -

    Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Air -- +

    Single-Player:Yes / Multi-Player:Yes / AI:Yes / Human:No / Types:Air -- Air Patrolling or Staging.

    Banner Image

    @@ -166,7 +166,7 @@ and automatically engage any airborne enemies that are within a certain range or
    Cargo -

    Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:Ground --
    +

    Single-Player:Yes / Multi-Player:Yes / AI:Yes / Human:No / Types:Ground --
    Management of logical cargo objects, that can be transported from and to transportation carriers.

    Banner Image

    @@ -334,7 +334,17 @@ following a given priority.

    Scoring -

    Scoring system for MOOSE.

    +

    Single-Player:Yes / Multi-Player:Yes / Core:Yes -- Administer the scoring of player achievements, +and create a CSV file logging the scoring events for use at team or squadron websites.

    + +

    -- Banner Image

    + +
    + +

    1) Scoring#SCORING class, extends Base#BASE

    + +

    The #SCORING class administers the scoring of player achievements, +and creates a CSV file logging the scoring events for use at team or squadron websites.

    Spawn -

    Single-Player:Yes / Mulit-Player:Yes / AI:Yes / Human:No / Types:All --
    +

    Single-Player:Yes / Multi-Player:Yes / AI:Yes / Human:No / Types:All --
    Spawn groups of units dynamically in your missions.

    Banner Image