Module Scoring

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.

The scores are calculated by scoring the hits and destroys of objects that players make, which are Unit and Statics** can be defined for which scores are also granted when objects in that Zone are destroyed. This is specifically useful to designate scenery targets on the map that will generate points when destroyed.

With a small change in MissionScripting.lua, the scoring can also be logged in a CSV file.
The CSV files can be used to:

  • Upload scoring to a database or a BI tool to publish the scoring results to the player community.
  • Upload scoring in an (online) Excel like tool, using pivot tables and pivot charts to show mission results.
  • Share scoring amoung players after the mission to discuss mission results.

1.1) Set the destroy score or penalty multiplier

Score multipliers can be set for scores granted when enemies or friendlies are destroyed. Use the method SCORING.SetMultiplierDestroyScore() to set the multiplier of enemy destroys (positive destroys). Use the method SCORING.SetMultiplierDestroyPenalty() to set the multiplier of friendly destroys (negative destroys).

 local Scoring = SCORING:New( "Scoring File" )
 Scoring:SetMultiplierDestroyScore( 10 )
 Scoring:SetMultiplierDestroyPenalty( 40 )

The above sets the multiplier for valid scores to 10. So scores will be given in a scale from 0 to 10. The penalties will be given in a scale from 0 to 40.

1.2) Define special targets that will give extra scores.

Special targets can be set that will give extra scores to the players when these are destroyed. Use the methods SCORING.AddUnitScore() and SCORING.RemoveUnitScore() to specify a special additional score for a specific Units.
Use the methods SCORING.AddStaticScore() and SCORING.RemoveStaticScore() to specify a special additional score for a specific Statics.
Use the method SCORING.SetGroupGroup() to specify a special additional score for a specific Groups.

 local Scoring = SCORING:New( "Scoring File" )
 Scoring:AddUnitScore( UNIT:FindByName( "Unit #001" ), 200 )
 Scoring:AddStaticScore( STATIC:FindByName( "Static #1" ), 100 )

The above grants an additional score of 200 points for Unit #001 and an additional 100 points of Static #1 if these are destroyed. Note that later in the mission, one can remove these scores set, for example, when the a goal achievement time limit is over. For example, this can be done as follows:

 Scoring:RemoveUnitScore( UNIT:FindByName( "Unit #001" ) )

1.3) Define destruction zones that will give extra scores.

Define zones of destruction. Any object destroyed within the zone of the given category will give extra points. Use the method SCORING.AddZoneScore to add a Zone for additional scoring.
Use the method SCORING.RemoveZoneScore to remove a Zone for additional scoring.
There are interesting variations that can be achieved with this functionality. For example, if the Zone is a Zone#ZONE_UNIT, then the zone is a moving zone, and anything destroyed within that Zone will generate points. The other implementation could be to designate a scenery target (a building) in the mission editor surrounded by a Zone, just large enough around that building.

1.4) Define output CSV files.

The CSV file is given the name of the string given in the SCORING.New{} constructor, followed by the .csv extension. The file is incrementally saved in the **\Saved Games\DCS\Logs** folder, and has a time stamp indicating each mission run. See the following example:

local ScoringFirstMission = SCORING:New( "FirstMission" )
local ScoringSecondMission = SCORING:New( "SecondMission" )

The above documents that 2 Scoring objects are created, ScoringFirstMission and ScoringSecondMission.


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)

SCORING
nHours
nMins
nSecs

Type SCORING

SCORING:AddScoreGroup(ScoreGroup, Score)

Specify a special additional score for a Group.

SCORING:AddStaticScore(ScoreStatic, Score)

Add a Static for additional scoring when the Static is destroyed.

SCORING:AddUnitScore(ScoreUnit, Score)

Add a Unit for additional scoring when the Unit is destroyed.

SCORING:AddZoneScore(ScoreZone, Score)

Add a Zone to define additional scoring when any object is destroyed in that zone.

SCORING.AllScoresMenu
SCORING.ClassID
SCORING.ClassName
SCORING:CloseCSV()
SCORING.Menu
SCORING.MultiplierDestroyPenalty
SCORING.MultiplierDestroyScore
SCORING:New(GameName)

Creates a new SCORING object to administer the scoring achieved by players.

SCORING:OpenCSV(ScoringCSV)

Opens a score CSV file to log the scores.

SCORING.Players

A collection of the current players that have joined the game.

SCORING:RemoveStaticScore(ScoreStatic)

Removes a Static for additional scoring when the Static is destroyed.

SCORING:RemoveUnitScore(ScoreUnit)

Removes a Unit for additional scoring when the Unit is destroyed.

SCORING:RemoveZoneScore(ScoreZone)

Remove a Zone for additional scoring.

SCORING:ReportScoreAll()
SCORING:ReportScorePlayer()
SCORING.RunTime
SCORING:ScoreCSV(PlayerName, ScoreType, ScoreTimes, ScoreAmount, PlayerUnitName, PlayerUnitCoalition, PlayerUnitCategory, PlayerUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType)

Registers a score for a player.

SCORING:ScoreMenu()

Creates a score radio menu.

SCORING.ScoringCSV
SCORING:SecondsToClock(sSeconds)
SCORING:SetMultiplierDestroyPenalty(Multiplier)

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

SCORING:SetMultiplierDestroyScore(Multiplier)

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

SCORING:_AddMissionScore(Mission, PlayerUnit, Text, Score)

Registers Mission Scores for possible multiple players that contributed in the Mission.

SCORING:_AddMissionTaskScore(Mission, PlayerUnit, Text, Score)

Registers Scores the players completing a Mission Task.

SCORING:_AddPlayerFromUnit(UnitData)

Add a new player entering a Unit.

SCORING:_EventOnDeadOrCrash(Event)

Track DEAD or CRASH events for the scoring.

SCORING:_EventOnHit(Event)

Handles the OnHit event for the scoring.

SCORING:_FollowPlayersScheduled()

Follows new players entering Clients within the DCSRTE.

Global(s)

#SCORING SCORING
nHours
nMins
nSecs

Type Scoring

Type SCORING

The Scoring class

Field(s)

SCORING:AddScoreGroup(ScoreGroup, Score)

Specify a special additional score for a Group.

Parameters

Return value

#SCORING:

SCORING:AddStaticScore(ScoreStatic, Score)

Add a Static for additional scoring when the Static is destroyed.

Note that if there was already a Static declared within the scoring with the same name, then the old Static will be replaced with the new Static.

Parameters

Return value

#SCORING:

SCORING:AddUnitScore(ScoreUnit, Score)

Add a Unit for additional scoring when the Unit is destroyed.

Note that if there was already a Unit declared within the scoring with the same name, then the old Unit will be replaced with the new Unit.

Parameters

  • Wrapper.Unit#UNIT ScoreUnit : The Unit for which the Score needs to be given.

  • #number Score : The Score value.

Return value

#SCORING:

SCORING:AddZoneScore(ScoreZone, Score)

Add a Zone to define additional scoring when any object is destroyed in that zone.

Note that if a Zone with the same name is already within the scoring added, the Zone (type) and Score will be replaced! This allows for a dynamic destruction zone evolution within your mission.

Parameters

  • Core.Zone#ZONE_BASE ScoreZone : The Zone which defines the destruction score perimeters. Note that a zone can be a polygon or a moving zone.

  • #number Score : The Score value.

Return value

#SCORING:

SCORING.AllScoresMenu
#number SCORING.ClassID
#string SCORING.ClassName
SCORING:CloseCSV()
SCORING.Menu
SCORING.MultiplierDestroyPenalty
SCORING.MultiplierDestroyScore
SCORING:New(GameName)

Creates a new SCORING object to administer the scoring achieved by players.

Parameter

  • #string GameName : The name of the game. This name is also logged in the CSV score file.

Return value

#SCORING: self

Usage:

-- Define a new scoring object for the mission Gori Valley.
ScoringObject = SCORING:New( "Gori Valley" )
SCORING:OpenCSV(ScoringCSV)

Opens a score CSV file to log the scores.

Parameter

  • #string ScoringCSV :

Return value

#SCORING: self

Usage:

-- Open a new CSV file to log the scores of the game Gori Valley. Let the name of the CSV file begin with "Player Scores".
ScoringObject = SCORING:New( "Gori Valley" )
ScoringObject:OpenCSV( "Player Scores" )
SCORING.Players

A collection of the current players that have joined the game.

SCORING:RemoveStaticScore(ScoreStatic)

Removes a Static for additional scoring when the Static is destroyed.

Parameter

Return value

#SCORING:

SCORING:RemoveUnitScore(ScoreUnit)

Removes a Unit for additional scoring when the Unit is destroyed.

Parameter

Return value

#SCORING:

SCORING:RemoveZoneScore(ScoreZone)

Remove a Zone for additional scoring.

The scoring will search if any Zone is added with the given name, and will remove that zone from the scoring. This allows for a dynamic destruction zone evolution within your mission.

Parameter

  • Core.Zone#ZONE_BASE ScoreZone : The Zone which defines the destruction score perimeters. Note that a zone can be a polygon or a moving zone.

Return value

#SCORING:

SCORING:ReportScoreAll()
SCORING:ReportScorePlayer()
SCORING.RunTime
SCORING:ScoreCSV(PlayerName, ScoreType, ScoreTimes, ScoreAmount, PlayerUnitName, PlayerUnitCoalition, PlayerUnitCategory, PlayerUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType)

Registers a score for a player.

Parameters

  • #string PlayerName : The name of the player.

  • #string ScoreType : The type of the score.

  • #string ScoreTimes : The amount of scores achieved.

  • #string ScoreAmount : The score given.

  • #string PlayerUnitName : The unit name of the player.

  • #string PlayerUnitCoalition : The coalition of the player unit.

  • #string PlayerUnitCategory : The category of the player unit.

  • #string PlayerUnitType : The type of the player unit.

  • #string TargetUnitName : The name of the target unit.

  • #string TargetUnitCoalition : The coalition of the target unit.

  • #string TargetUnitCategory : The category of the target unit.

  • #string TargetUnitType : The type of the target unit.

Return value

#SCORING: self

SCORING:ScoreMenu()

Creates a score radio menu.

Can be accessed using Radio -> F10.

Return value

#SCORING: self

SCORING.ScoringCSV
SCORING:SecondsToClock(sSeconds)

Parameter

  • sSeconds :

SCORING:SetMultiplierDestroyPenalty(Multiplier)

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

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.

Return value

#SCORING:

SCORING:SetMultiplierDestroyScore(Multiplier)

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

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:_AddMissionScore(Mission, PlayerUnit, Text, Score)

Registers Mission Scores for possible multiple players that contributed in the Mission.

Parameters

SCORING:_AddMissionTaskScore(Mission, PlayerUnit, Text, Score)

Registers Scores the players completing a Mission Task.

Parameters

SCORING:_AddPlayerFromUnit(UnitData)

Add a new player entering a Unit.

Parameter

SCORING:_EventOnDeadOrCrash(Event)

Track DEAD or CRASH events for the scoring.

Parameter

SCORING:_EventOnHit(Event)

Handles the OnHit event for the scoring.

Parameter

SCORING:_FollowPlayersScheduled()

Follows new players entering Clients within the DCSRTE.

TODO: Need to see if i can catch this also with an event. It will eliminate the schedule ...