mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Added API to set Goal Scores upon a condition
This commit is contained in:
parent
1b6d241acc
commit
ef5f83034b
@ -43,7 +43,7 @@
|
||||
--
|
||||
-- 
|
||||
--
|
||||
-- **Various @{Zone}s** can be defined for which scores are also granted when objects in that @{Zone} are destroyed.
|
||||
-- Various @{Zone}s 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 results can also be logged in a **CSV file**.
|
||||
@ -99,13 +99,18 @@
|
||||
-- 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) Configure fratricide level.
|
||||
-- ## 1.4) Add extra Goal scores upon an event or a condition.
|
||||
--
|
||||
-- A mission has goals and achievements. The scoring system provides an API to set additional scores when a goal or achievement event happens.
|
||||
-- Use the method @{#SCORING.AddGoalScore}() to add a score for a Player at any time in your mission.
|
||||
--
|
||||
-- ## 1.5) Configure fratricide level.
|
||||
--
|
||||
-- When a player commits too much damage to friendlies, his penalty score will reach a certain level.
|
||||
-- Use the method @{#SCORING.SetFratricide}() to define the level when a player gets kicked.
|
||||
-- By default, the fratricide level is the default penalty mutiplier * 2 for the penalty score.
|
||||
--
|
||||
-- ## 1.5) Penalty score when a player changes the coalition.
|
||||
-- ## 1.6) Penalty score when a player changes the coalition.
|
||||
--
|
||||
-- When a player changes the coalition, he can receive a penalty score.
|
||||
-- Use the method @{#SCORING.SetCoalitionChangePenalty}() to define the penalty when a player changes coalition.
|
||||
@ -514,6 +519,7 @@ function SCORING:SetFratricide( Fratricide )
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- When a player changes the coalition, he can receive a penalty score.
|
||||
-- Use the method @{#SCORING.SetCoalitionChangePenalty}() to define the penalty when a player changes coalition.
|
||||
-- By default, the penalty for changing coalition is the default penalty scale.
|
||||
@ -600,6 +606,37 @@ function SCORING:_AddPlayerFromUnit( UnitData )
|
||||
end
|
||||
|
||||
|
||||
--- Add a goal score for a player.
|
||||
-- The method takes the PlayerUnit for which the Goal score needs to be set.
|
||||
-- The GoalTag is a string or identifier that is taken into the CSV file scoring log to identify the goal.
|
||||
-- A free text can be given that is shown to the players.
|
||||
-- The Score can be both positive and negative.
|
||||
-- @param #SCORING self
|
||||
-- @param Wrapper.Unit#UNIT PlayerUnit The @{Unit} of the Player. Other Properties for the scoring are taken from this PlayerUnit, like coalition, type etc.
|
||||
-- @param #string GoalTag The string or identifier that is used in the CSV file to identify the goal (sort or group later in Excel).
|
||||
-- @param #string Text A free text that is shown to the players.
|
||||
-- @param #number Score The score can be both positive or negative ( Penalty ).
|
||||
function SCORING:AddGoalScore( PlayerUnit, GoalTag, Text, Score )
|
||||
|
||||
local PlayerName = PlayerUnit:GetPlayerName()
|
||||
|
||||
self:E( { PlayerUnit.UnitName, PlayerName, GoalTag, Text, Score } )
|
||||
|
||||
-- PlayerName can be nil, if the Unit with the player crashed or due to another reason.
|
||||
if PlayerName then
|
||||
local PlayerData = self.Players[PlayerName]
|
||||
|
||||
PlayerData.Goals[GoalTag] = PlayerData.Goals[GoalTag] or { Score = 0 }
|
||||
PlayerData.Goals[GoalTag].Score = PlayerData.Goals[GoalTag].Score + Score
|
||||
PlayerData.Score = PlayerData.Score + Score
|
||||
|
||||
MESSAGE:New( Text, 30 ):ToAll()
|
||||
|
||||
self:ScoreCSV( PlayerName, "GOAL_" .. string.upper( GoalTag ), 1, Score, PlayerUnit:GetName() )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- Registers Scores the players completing a Mission Task.
|
||||
-- @param #SCORING self
|
||||
-- @param Tasking.Mission#MISSION Mission
|
||||
@ -1223,6 +1260,43 @@ function SCORING:ReportDetailedPlayerCoalitionChanges( PlayerName )
|
||||
return ScoreMessage, PlayerScore, PlayerPenalty
|
||||
end
|
||||
|
||||
--- Produce detailed report of player goal scores.
|
||||
-- @param #SCORING self
|
||||
-- @param #string PlayerName The name of the player.
|
||||
-- @return #string The report.
|
||||
function SCORING:ReportDetailedPlayerMissions( PlayerName )
|
||||
|
||||
local ScoreMessage = ""
|
||||
local PlayerScore = 0
|
||||
local PlayerPenalty = 0
|
||||
|
||||
local PlayerData = self.Players[PlayerName]
|
||||
if PlayerData then -- This should normally not happen, but i'll test it anyway.
|
||||
self:T( "Score Player: " .. PlayerName )
|
||||
|
||||
-- Some variables
|
||||
local InitUnitCoalition = _SCORINGCoalition[PlayerData.UnitCoalition]
|
||||
local InitUnitCategory = _SCORINGCategory[PlayerData.UnitCategory]
|
||||
local InitUnitType = PlayerData.UnitType
|
||||
local InitUnitName = PlayerData.UnitName
|
||||
|
||||
local ScoreMessageGoal = ""
|
||||
local ScoreGoal = 0
|
||||
local ScoreTask = 0
|
||||
for GoalName, GoalData in pairs( PlayerData.Goals ) do
|
||||
ScoreGoal = ScoreGoal + GoalData.Score
|
||||
ScoreMessageGoal = ScoreMessageGoal .. "'" .. GoalName .. "':" .. GoalData.Score .. "; "
|
||||
end
|
||||
PlayerScore = PlayerScore + ScoreGoal
|
||||
|
||||
if ScoreMessageGoal ~= "" then
|
||||
ScoreMessage = "Goals: " .. ScoreMessageGoal
|
||||
end
|
||||
end
|
||||
|
||||
return ScoreMessage, PlayerScore, PlayerPenalty
|
||||
end
|
||||
|
||||
--- Produce detailed report of player penalty scores because of changing the coalition.
|
||||
-- @param #SCORING self
|
||||
-- @param #string PlayerName The name of the player.
|
||||
@ -1243,9 +1317,6 @@ function SCORING:ReportDetailedPlayerMissions( PlayerName )
|
||||
local InitUnitType = PlayerData.UnitType
|
||||
local InitUnitName = PlayerData.UnitName
|
||||
|
||||
local PlayerScore = 0
|
||||
local PlayerPenalty = 0
|
||||
|
||||
local ScoreMessageMission = ""
|
||||
local ScoreMission = 0
|
||||
local ScoreTask = 0
|
||||
@ -1257,7 +1328,7 @@ function SCORING:ReportDetailedPlayerMissions( PlayerName )
|
||||
PlayerScore = PlayerScore + ScoreMission + ScoreTask
|
||||
|
||||
if ScoreMessageMission ~= "" then
|
||||
ScoreMessage = ScoreMessage .. "Tasks: " .. ScoreTask .. " Mission: " .. ScoreMission .. " ( " .. ScoreMessageMission .. ")"
|
||||
ScoreMessage = "Tasks: " .. ScoreTask .. " Mission: " .. ScoreMission .. " ( " .. ScoreMessageMission .. ")"
|
||||
end
|
||||
end
|
||||
|
||||
@ -1284,18 +1355,25 @@ function SCORING:ReportScoreGroupSummary( PlayerGroup )
|
||||
local ReportHits, ScoreHits, PenaltyHits = self:ReportDetailedPlayerHits( PlayerName )
|
||||
ReportHits = ReportHits ~= "" and "\n- " .. ReportHits or ReportHits
|
||||
self:E( { ReportHits, ScoreHits, PenaltyHits } )
|
||||
|
||||
local ReportDestroys, ScoreDestroys, PenaltyDestroys = self:ReportDetailedPlayerDestroys( PlayerName )
|
||||
ReportDestroys = ReportDestroys ~= "" and "\n- " .. ReportDestroys or ReportDestroys
|
||||
self:E( { ReportDestroys, ScoreDestroys, PenaltyDestroys } )
|
||||
|
||||
local ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges = self:ReportDetailedPlayerCoalitionChanges( PlayerName )
|
||||
ReportCoalitionChanges = ReportCoalitionChanges ~= "" and "\n- " .. ReportCoalitionChanges or ReportCoalitionChanges
|
||||
self:E( { ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges } )
|
||||
|
||||
local ReportGoals, ScoreGoals, PenaltyGoals = self:ReportDetailedPlayerGoals( PlayerName )
|
||||
ReportGoals = ReportGoals ~= "" and "\n- " .. ReportGoals or ReportGoals
|
||||
self:E( { ReportGoals, ScoreGoals, PenaltyGoals } )
|
||||
|
||||
local ReportMissions, ScoreMissions, PenaltyMissions = self:ReportDetailedPlayerMissions( PlayerName )
|
||||
ReportMissions = ReportMissions ~= "" and "\n- " .. ReportMissions or ReportMissions
|
||||
self:E( { ReportMissions, ScoreMissions, PenaltyMissions } )
|
||||
|
||||
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreMissions
|
||||
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + PenaltyMissions
|
||||
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreGoals + ScoreMissions
|
||||
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + ScoreGoals + PenaltyMissions
|
||||
|
||||
PlayerMessage =
|
||||
string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties )",
|
||||
@ -1329,21 +1407,28 @@ function SCORING:ReportScoreGroupDetailed( PlayerGroup )
|
||||
local ReportHits, ScoreHits, PenaltyHits = self:ReportDetailedPlayerHits( PlayerName )
|
||||
ReportHits = ReportHits ~= "" and "\n- " .. ReportHits or ReportHits
|
||||
self:E( { ReportHits, ScoreHits, PenaltyHits } )
|
||||
|
||||
local ReportDestroys, ScoreDestroys, PenaltyDestroys = self:ReportDetailedPlayerDestroys( PlayerName )
|
||||
ReportDestroys = ReportDestroys ~= "" and "\n- " .. ReportDestroys or ReportDestroys
|
||||
self:E( { ReportDestroys, ScoreDestroys, PenaltyDestroys } )
|
||||
|
||||
local ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges = self:ReportDetailedPlayerCoalitionChanges( PlayerName )
|
||||
ReportCoalitionChanges = ReportCoalitionChanges ~= "" and "\n- " .. ReportCoalitionChanges or ReportCoalitionChanges
|
||||
self:E( { ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges } )
|
||||
|
||||
local ReportGoals, ScoreGoals, PenaltyGoals = self:ReportDetailedPlayerGoals( PlayerName )
|
||||
ReportGoals = ReportGoals ~= "" and "\n- " .. ReportGoals or ReportGoals
|
||||
self:E( { ReportGoals, ScoreGoals, PenaltyGoals } )
|
||||
|
||||
local ReportMissions, ScoreMissions, PenaltyMissions = self:ReportDetailedPlayerMissions( PlayerName )
|
||||
ReportMissions = ReportMissions ~= "" and "\n- " .. ReportMissions or ReportMissions
|
||||
self:E( { ReportMissions, ScoreMissions, PenaltyMissions } )
|
||||
|
||||
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreMissions
|
||||
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + PenaltyMissions
|
||||
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreGoals + ScoreMissions
|
||||
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + ScoreGoals + PenaltyMissions
|
||||
|
||||
PlayerMessage =
|
||||
string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties )%s%s%s%s",
|
||||
string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties )%s%s%s%s%s",
|
||||
PlayerName,
|
||||
PlayerScore - PlayerPenalty,
|
||||
PlayerScore,
|
||||
@ -1351,6 +1436,7 @@ function SCORING:ReportScoreGroupDetailed( PlayerGroup )
|
||||
ReportHits,
|
||||
ReportDestroys,
|
||||
ReportCoalitionChanges,
|
||||
ReportGoals,
|
||||
ReportMissions
|
||||
)
|
||||
MESSAGE:New( PlayerMessage, 30, "Player '" .. PlayerName .. "'" ):ToGroup( PlayerGroup )
|
||||
@ -1375,18 +1461,25 @@ function SCORING:ReportScoreAllSummary( PlayerGroup )
|
||||
local ReportHits, ScoreHits, PenaltyHits = self:ReportDetailedPlayerHits( PlayerName )
|
||||
ReportHits = ReportHits ~= "" and "\n- " .. ReportHits or ReportHits
|
||||
self:E( { ReportHits, ScoreHits, PenaltyHits } )
|
||||
|
||||
local ReportDestroys, ScoreDestroys, PenaltyDestroys = self:ReportDetailedPlayerDestroys( PlayerName )
|
||||
ReportDestroys = ReportDestroys ~= "" and "\n- " .. ReportDestroys or ReportDestroys
|
||||
self:E( { ReportDestroys, ScoreDestroys, PenaltyDestroys } )
|
||||
|
||||
local ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges = self:ReportDetailedPlayerCoalitionChanges( PlayerName )
|
||||
ReportCoalitionChanges = ReportCoalitionChanges ~= "" and "\n- " .. ReportCoalitionChanges or ReportCoalitionChanges
|
||||
self:E( { ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges } )
|
||||
|
||||
local ReportGoals, ScoreGoals, PenaltyGoals = self:ReportDetailedPlayerGoals( PlayerName )
|
||||
ReportGoals = ReportGoals ~= "" and "\n- " .. ReportGoals or ReportGoals
|
||||
self:E( { ReportGoals, ScoreGoals, PenaltyGoals } )
|
||||
|
||||
local ReportMissions, ScoreMissions, PenaltyMissions = self:ReportDetailedPlayerMissions( PlayerName )
|
||||
ReportMissions = ReportMissions ~= "" and "\n- " .. ReportMissions or ReportMissions
|
||||
self:E( { ReportMissions, ScoreMissions, PenaltyMissions } )
|
||||
|
||||
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreMissions
|
||||
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + PenaltyMissions
|
||||
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreGoals + ScoreMissions
|
||||
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + ScoreGoals + PenaltyMissions
|
||||
|
||||
PlayerMessage =
|
||||
string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties )",
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
||||
env.info( 'Moose Generation Timestamp: 20170302_2326' )
|
||||
env.info( 'Moose Generation Timestamp: 20170303_0807' )
|
||||
local base = _G
|
||||
|
||||
Include = {}
|
||||
@ -17902,7 +17902,7 @@ end
|
||||
--
|
||||
-- 
|
||||
--
|
||||
-- **Various @{Zone}s** can be defined for which scores are also granted when objects in that @{Zone} are destroyed.
|
||||
-- Various @{Zone}s 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 results can also be logged in a **CSV file**.
|
||||
@ -17958,13 +17958,18 @@ end
|
||||
-- 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) Configure fratricide level.
|
||||
-- ## 1.4) Add extra Goal scores upon an event or a condition.
|
||||
--
|
||||
-- A mission has goals and achievements. The scoring system provides an API to set additional scores when a goal or achievement event happens.
|
||||
-- Use the method @{#SCORING.AddGoalScore}() to add a score for a Player at any time in your mission.
|
||||
--
|
||||
-- ## 1.5) Configure fratricide level.
|
||||
--
|
||||
-- When a player commits too much damage to friendlies, his penalty score will reach a certain level.
|
||||
-- Use the method @{#SCORING.SetFratricide}() to define the level when a player gets kicked.
|
||||
-- By default, the fratricide level is the default penalty mutiplier * 2 for the penalty score.
|
||||
--
|
||||
-- ## 1.5) Penalty score when a player changes the coalition.
|
||||
-- ## 1.6) Penalty score when a player changes the coalition.
|
||||
--
|
||||
-- When a player changes the coalition, he can receive a penalty score.
|
||||
-- Use the method @{#SCORING.SetCoalitionChangePenalty}() to define the penalty when a player changes coalition.
|
||||
@ -18373,6 +18378,7 @@ function SCORING:SetFratricide( Fratricide )
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- When a player changes the coalition, he can receive a penalty score.
|
||||
-- Use the method @{#SCORING.SetCoalitionChangePenalty}() to define the penalty when a player changes coalition.
|
||||
-- By default, the penalty for changing coalition is the default penalty scale.
|
||||
@ -18459,6 +18465,37 @@ function SCORING:_AddPlayerFromUnit( UnitData )
|
||||
end
|
||||
|
||||
|
||||
--- Add a goal score for a player.
|
||||
-- The method takes the PlayerUnit for which the Goal score needs to be set.
|
||||
-- The GoalTag is a string or identifier that is taken into the CSV file scoring log to identify the goal.
|
||||
-- A free text can be given that is shown to the players.
|
||||
-- The Score can be both positive and negative.
|
||||
-- @param #SCORING self
|
||||
-- @param Wrapper.Unit#UNIT PlayerUnit The @{Unit} of the Player. Other Properties for the scoring are taken from this PlayerUnit, like coalition, type etc.
|
||||
-- @param #string GoalTag The string or identifier that is used in the CSV file to identify the goal (sort or group later in Excel).
|
||||
-- @param #string Text A free text that is shown to the players.
|
||||
-- @param #number Score The score can be both positive or negative ( Penalty ).
|
||||
function SCORING:AddGoalScore( PlayerUnit, GoalTag, Text, Score )
|
||||
|
||||
local PlayerName = PlayerUnit:GetPlayerName()
|
||||
|
||||
self:E( { PlayerUnit.UnitName, PlayerName, GoalTag, Text, Score } )
|
||||
|
||||
-- PlayerName can be nil, if the Unit with the player crashed or due to another reason.
|
||||
if PlayerName then
|
||||
local PlayerData = self.Players[PlayerName]
|
||||
|
||||
PlayerData.Goals[GoalTag] = PlayerData.Goals[GoalTag] or { Score = 0 }
|
||||
PlayerData.Goals[GoalTag].Score = PlayerData.Goals[GoalTag].Score + Score
|
||||
PlayerData.Score = PlayerData.Score + Score
|
||||
|
||||
MESSAGE:New( Text, 30 ):ToAll()
|
||||
|
||||
self:ScoreCSV( PlayerName, "GOAL_" .. string.upper( GoalTag ), 1, Score, PlayerUnit:GetName() )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- Registers Scores the players completing a Mission Task.
|
||||
-- @param #SCORING self
|
||||
-- @param Tasking.Mission#MISSION Mission
|
||||
@ -19082,6 +19119,43 @@ function SCORING:ReportDetailedPlayerCoalitionChanges( PlayerName )
|
||||
return ScoreMessage, PlayerScore, PlayerPenalty
|
||||
end
|
||||
|
||||
--- Produce detailed report of player goal scores.
|
||||
-- @param #SCORING self
|
||||
-- @param #string PlayerName The name of the player.
|
||||
-- @return #string The report.
|
||||
function SCORING:ReportDetailedPlayerMissions( PlayerName )
|
||||
|
||||
local ScoreMessage = ""
|
||||
local PlayerScore = 0
|
||||
local PlayerPenalty = 0
|
||||
|
||||
local PlayerData = self.Players[PlayerName]
|
||||
if PlayerData then -- This should normally not happen, but i'll test it anyway.
|
||||
self:T( "Score Player: " .. PlayerName )
|
||||
|
||||
-- Some variables
|
||||
local InitUnitCoalition = _SCORINGCoalition[PlayerData.UnitCoalition]
|
||||
local InitUnitCategory = _SCORINGCategory[PlayerData.UnitCategory]
|
||||
local InitUnitType = PlayerData.UnitType
|
||||
local InitUnitName = PlayerData.UnitName
|
||||
|
||||
local ScoreMessageGoal = ""
|
||||
local ScoreGoal = 0
|
||||
local ScoreTask = 0
|
||||
for GoalName, GoalData in pairs( PlayerData.Goals ) do
|
||||
ScoreGoal = ScoreGoal + GoalData.Score
|
||||
ScoreMessageGoal = ScoreMessageGoal .. "'" .. GoalName .. "':" .. GoalData.Score .. "; "
|
||||
end
|
||||
PlayerScore = PlayerScore + ScoreGoal
|
||||
|
||||
if ScoreMessageGoal ~= "" then
|
||||
ScoreMessage = "Goals: " .. ScoreMessageGoal
|
||||
end
|
||||
end
|
||||
|
||||
return ScoreMessage, PlayerScore, PlayerPenalty
|
||||
end
|
||||
|
||||
--- Produce detailed report of player penalty scores because of changing the coalition.
|
||||
-- @param #SCORING self
|
||||
-- @param #string PlayerName The name of the player.
|
||||
@ -19102,9 +19176,6 @@ function SCORING:ReportDetailedPlayerMissions( PlayerName )
|
||||
local InitUnitType = PlayerData.UnitType
|
||||
local InitUnitName = PlayerData.UnitName
|
||||
|
||||
local PlayerScore = 0
|
||||
local PlayerPenalty = 0
|
||||
|
||||
local ScoreMessageMission = ""
|
||||
local ScoreMission = 0
|
||||
local ScoreTask = 0
|
||||
@ -19116,7 +19187,7 @@ function SCORING:ReportDetailedPlayerMissions( PlayerName )
|
||||
PlayerScore = PlayerScore + ScoreMission + ScoreTask
|
||||
|
||||
if ScoreMessageMission ~= "" then
|
||||
ScoreMessage = ScoreMessage .. "Tasks: " .. ScoreTask .. " Mission: " .. ScoreMission .. " ( " .. ScoreMessageMission .. ")"
|
||||
ScoreMessage = "Tasks: " .. ScoreTask .. " Mission: " .. ScoreMission .. " ( " .. ScoreMessageMission .. ")"
|
||||
end
|
||||
end
|
||||
|
||||
@ -19143,18 +19214,25 @@ function SCORING:ReportScoreGroupSummary( PlayerGroup )
|
||||
local ReportHits, ScoreHits, PenaltyHits = self:ReportDetailedPlayerHits( PlayerName )
|
||||
ReportHits = ReportHits ~= "" and "\n- " .. ReportHits or ReportHits
|
||||
self:E( { ReportHits, ScoreHits, PenaltyHits } )
|
||||
|
||||
local ReportDestroys, ScoreDestroys, PenaltyDestroys = self:ReportDetailedPlayerDestroys( PlayerName )
|
||||
ReportDestroys = ReportDestroys ~= "" and "\n- " .. ReportDestroys or ReportDestroys
|
||||
self:E( { ReportDestroys, ScoreDestroys, PenaltyDestroys } )
|
||||
|
||||
local ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges = self:ReportDetailedPlayerCoalitionChanges( PlayerName )
|
||||
ReportCoalitionChanges = ReportCoalitionChanges ~= "" and "\n- " .. ReportCoalitionChanges or ReportCoalitionChanges
|
||||
self:E( { ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges } )
|
||||
|
||||
local ReportGoals, ScoreGoals, PenaltyGoals = self:ReportDetailedPlayerGoals( PlayerName )
|
||||
ReportGoals = ReportGoals ~= "" and "\n- " .. ReportGoals or ReportGoals
|
||||
self:E( { ReportGoals, ScoreGoals, PenaltyGoals } )
|
||||
|
||||
local ReportMissions, ScoreMissions, PenaltyMissions = self:ReportDetailedPlayerMissions( PlayerName )
|
||||
ReportMissions = ReportMissions ~= "" and "\n- " .. ReportMissions or ReportMissions
|
||||
self:E( { ReportMissions, ScoreMissions, PenaltyMissions } )
|
||||
|
||||
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreMissions
|
||||
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + PenaltyMissions
|
||||
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreGoals + ScoreMissions
|
||||
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + ScoreGoals + PenaltyMissions
|
||||
|
||||
PlayerMessage =
|
||||
string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties )",
|
||||
@ -19188,21 +19266,28 @@ function SCORING:ReportScoreGroupDetailed( PlayerGroup )
|
||||
local ReportHits, ScoreHits, PenaltyHits = self:ReportDetailedPlayerHits( PlayerName )
|
||||
ReportHits = ReportHits ~= "" and "\n- " .. ReportHits or ReportHits
|
||||
self:E( { ReportHits, ScoreHits, PenaltyHits } )
|
||||
|
||||
local ReportDestroys, ScoreDestroys, PenaltyDestroys = self:ReportDetailedPlayerDestroys( PlayerName )
|
||||
ReportDestroys = ReportDestroys ~= "" and "\n- " .. ReportDestroys or ReportDestroys
|
||||
self:E( { ReportDestroys, ScoreDestroys, PenaltyDestroys } )
|
||||
|
||||
local ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges = self:ReportDetailedPlayerCoalitionChanges( PlayerName )
|
||||
ReportCoalitionChanges = ReportCoalitionChanges ~= "" and "\n- " .. ReportCoalitionChanges or ReportCoalitionChanges
|
||||
self:E( { ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges } )
|
||||
|
||||
local ReportGoals, ScoreGoals, PenaltyGoals = self:ReportDetailedPlayerGoals( PlayerName )
|
||||
ReportGoals = ReportGoals ~= "" and "\n- " .. ReportGoals or ReportGoals
|
||||
self:E( { ReportGoals, ScoreGoals, PenaltyGoals } )
|
||||
|
||||
local ReportMissions, ScoreMissions, PenaltyMissions = self:ReportDetailedPlayerMissions( PlayerName )
|
||||
ReportMissions = ReportMissions ~= "" and "\n- " .. ReportMissions or ReportMissions
|
||||
self:E( { ReportMissions, ScoreMissions, PenaltyMissions } )
|
||||
|
||||
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreMissions
|
||||
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + PenaltyMissions
|
||||
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreGoals + ScoreMissions
|
||||
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + ScoreGoals + PenaltyMissions
|
||||
|
||||
PlayerMessage =
|
||||
string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties )%s%s%s%s",
|
||||
string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties )%s%s%s%s%s",
|
||||
PlayerName,
|
||||
PlayerScore - PlayerPenalty,
|
||||
PlayerScore,
|
||||
@ -19210,6 +19295,7 @@ function SCORING:ReportScoreGroupDetailed( PlayerGroup )
|
||||
ReportHits,
|
||||
ReportDestroys,
|
||||
ReportCoalitionChanges,
|
||||
ReportGoals,
|
||||
ReportMissions
|
||||
)
|
||||
MESSAGE:New( PlayerMessage, 30, "Player '" .. PlayerName .. "'" ):ToGroup( PlayerGroup )
|
||||
@ -19234,18 +19320,25 @@ function SCORING:ReportScoreAllSummary( PlayerGroup )
|
||||
local ReportHits, ScoreHits, PenaltyHits = self:ReportDetailedPlayerHits( PlayerName )
|
||||
ReportHits = ReportHits ~= "" and "\n- " .. ReportHits or ReportHits
|
||||
self:E( { ReportHits, ScoreHits, PenaltyHits } )
|
||||
|
||||
local ReportDestroys, ScoreDestroys, PenaltyDestroys = self:ReportDetailedPlayerDestroys( PlayerName )
|
||||
ReportDestroys = ReportDestroys ~= "" and "\n- " .. ReportDestroys or ReportDestroys
|
||||
self:E( { ReportDestroys, ScoreDestroys, PenaltyDestroys } )
|
||||
|
||||
local ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges = self:ReportDetailedPlayerCoalitionChanges( PlayerName )
|
||||
ReportCoalitionChanges = ReportCoalitionChanges ~= "" and "\n- " .. ReportCoalitionChanges or ReportCoalitionChanges
|
||||
self:E( { ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges } )
|
||||
|
||||
local ReportGoals, ScoreGoals, PenaltyGoals = self:ReportDetailedPlayerGoals( PlayerName )
|
||||
ReportGoals = ReportGoals ~= "" and "\n- " .. ReportGoals or ReportGoals
|
||||
self:E( { ReportGoals, ScoreGoals, PenaltyGoals } )
|
||||
|
||||
local ReportMissions, ScoreMissions, PenaltyMissions = self:ReportDetailedPlayerMissions( PlayerName )
|
||||
ReportMissions = ReportMissions ~= "" and "\n- " .. ReportMissions or ReportMissions
|
||||
self:E( { ReportMissions, ScoreMissions, PenaltyMissions } )
|
||||
|
||||
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreMissions
|
||||
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + PenaltyMissions
|
||||
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreGoals + ScoreMissions
|
||||
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + ScoreGoals + PenaltyMissions
|
||||
|
||||
PlayerMessage =
|
||||
string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties )",
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
||||
env.info( 'Moose Generation Timestamp: 20170302_2326' )
|
||||
env.info( 'Moose Generation Timestamp: 20170303_0807' )
|
||||
local base = _G
|
||||
|
||||
Include = {}
|
||||
@ -17902,7 +17902,7 @@ end
|
||||
--
|
||||
-- 
|
||||
--
|
||||
-- **Various @{Zone}s** can be defined for which scores are also granted when objects in that @{Zone} are destroyed.
|
||||
-- Various @{Zone}s 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 results can also be logged in a **CSV file**.
|
||||
@ -17958,13 +17958,18 @@ end
|
||||
-- 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) Configure fratricide level.
|
||||
-- ## 1.4) Add extra Goal scores upon an event or a condition.
|
||||
--
|
||||
-- A mission has goals and achievements. The scoring system provides an API to set additional scores when a goal or achievement event happens.
|
||||
-- Use the method @{#SCORING.AddGoalScore}() to add a score for a Player at any time in your mission.
|
||||
--
|
||||
-- ## 1.5) Configure fratricide level.
|
||||
--
|
||||
-- When a player commits too much damage to friendlies, his penalty score will reach a certain level.
|
||||
-- Use the method @{#SCORING.SetFratricide}() to define the level when a player gets kicked.
|
||||
-- By default, the fratricide level is the default penalty mutiplier * 2 for the penalty score.
|
||||
--
|
||||
-- ## 1.5) Penalty score when a player changes the coalition.
|
||||
-- ## 1.6) Penalty score when a player changes the coalition.
|
||||
--
|
||||
-- When a player changes the coalition, he can receive a penalty score.
|
||||
-- Use the method @{#SCORING.SetCoalitionChangePenalty}() to define the penalty when a player changes coalition.
|
||||
@ -18373,6 +18378,7 @@ function SCORING:SetFratricide( Fratricide )
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- When a player changes the coalition, he can receive a penalty score.
|
||||
-- Use the method @{#SCORING.SetCoalitionChangePenalty}() to define the penalty when a player changes coalition.
|
||||
-- By default, the penalty for changing coalition is the default penalty scale.
|
||||
@ -18459,6 +18465,37 @@ function SCORING:_AddPlayerFromUnit( UnitData )
|
||||
end
|
||||
|
||||
|
||||
--- Add a goal score for a player.
|
||||
-- The method takes the PlayerUnit for which the Goal score needs to be set.
|
||||
-- The GoalTag is a string or identifier that is taken into the CSV file scoring log to identify the goal.
|
||||
-- A free text can be given that is shown to the players.
|
||||
-- The Score can be both positive and negative.
|
||||
-- @param #SCORING self
|
||||
-- @param Wrapper.Unit#UNIT PlayerUnit The @{Unit} of the Player. Other Properties for the scoring are taken from this PlayerUnit, like coalition, type etc.
|
||||
-- @param #string GoalTag The string or identifier that is used in the CSV file to identify the goal (sort or group later in Excel).
|
||||
-- @param #string Text A free text that is shown to the players.
|
||||
-- @param #number Score The score can be both positive or negative ( Penalty ).
|
||||
function SCORING:AddGoalScore( PlayerUnit, GoalTag, Text, Score )
|
||||
|
||||
local PlayerName = PlayerUnit:GetPlayerName()
|
||||
|
||||
self:E( { PlayerUnit.UnitName, PlayerName, GoalTag, Text, Score } )
|
||||
|
||||
-- PlayerName can be nil, if the Unit with the player crashed or due to another reason.
|
||||
if PlayerName then
|
||||
local PlayerData = self.Players[PlayerName]
|
||||
|
||||
PlayerData.Goals[GoalTag] = PlayerData.Goals[GoalTag] or { Score = 0 }
|
||||
PlayerData.Goals[GoalTag].Score = PlayerData.Goals[GoalTag].Score + Score
|
||||
PlayerData.Score = PlayerData.Score + Score
|
||||
|
||||
MESSAGE:New( Text, 30 ):ToAll()
|
||||
|
||||
self:ScoreCSV( PlayerName, "GOAL_" .. string.upper( GoalTag ), 1, Score, PlayerUnit:GetName() )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- Registers Scores the players completing a Mission Task.
|
||||
-- @param #SCORING self
|
||||
-- @param Tasking.Mission#MISSION Mission
|
||||
@ -19082,6 +19119,43 @@ function SCORING:ReportDetailedPlayerCoalitionChanges( PlayerName )
|
||||
return ScoreMessage, PlayerScore, PlayerPenalty
|
||||
end
|
||||
|
||||
--- Produce detailed report of player goal scores.
|
||||
-- @param #SCORING self
|
||||
-- @param #string PlayerName The name of the player.
|
||||
-- @return #string The report.
|
||||
function SCORING:ReportDetailedPlayerMissions( PlayerName )
|
||||
|
||||
local ScoreMessage = ""
|
||||
local PlayerScore = 0
|
||||
local PlayerPenalty = 0
|
||||
|
||||
local PlayerData = self.Players[PlayerName]
|
||||
if PlayerData then -- This should normally not happen, but i'll test it anyway.
|
||||
self:T( "Score Player: " .. PlayerName )
|
||||
|
||||
-- Some variables
|
||||
local InitUnitCoalition = _SCORINGCoalition[PlayerData.UnitCoalition]
|
||||
local InitUnitCategory = _SCORINGCategory[PlayerData.UnitCategory]
|
||||
local InitUnitType = PlayerData.UnitType
|
||||
local InitUnitName = PlayerData.UnitName
|
||||
|
||||
local ScoreMessageGoal = ""
|
||||
local ScoreGoal = 0
|
||||
local ScoreTask = 0
|
||||
for GoalName, GoalData in pairs( PlayerData.Goals ) do
|
||||
ScoreGoal = ScoreGoal + GoalData.Score
|
||||
ScoreMessageGoal = ScoreMessageGoal .. "'" .. GoalName .. "':" .. GoalData.Score .. "; "
|
||||
end
|
||||
PlayerScore = PlayerScore + ScoreGoal
|
||||
|
||||
if ScoreMessageGoal ~= "" then
|
||||
ScoreMessage = "Goals: " .. ScoreMessageGoal
|
||||
end
|
||||
end
|
||||
|
||||
return ScoreMessage, PlayerScore, PlayerPenalty
|
||||
end
|
||||
|
||||
--- Produce detailed report of player penalty scores because of changing the coalition.
|
||||
-- @param #SCORING self
|
||||
-- @param #string PlayerName The name of the player.
|
||||
@ -19102,9 +19176,6 @@ function SCORING:ReportDetailedPlayerMissions( PlayerName )
|
||||
local InitUnitType = PlayerData.UnitType
|
||||
local InitUnitName = PlayerData.UnitName
|
||||
|
||||
local PlayerScore = 0
|
||||
local PlayerPenalty = 0
|
||||
|
||||
local ScoreMessageMission = ""
|
||||
local ScoreMission = 0
|
||||
local ScoreTask = 0
|
||||
@ -19116,7 +19187,7 @@ function SCORING:ReportDetailedPlayerMissions( PlayerName )
|
||||
PlayerScore = PlayerScore + ScoreMission + ScoreTask
|
||||
|
||||
if ScoreMessageMission ~= "" then
|
||||
ScoreMessage = ScoreMessage .. "Tasks: " .. ScoreTask .. " Mission: " .. ScoreMission .. " ( " .. ScoreMessageMission .. ")"
|
||||
ScoreMessage = "Tasks: " .. ScoreTask .. " Mission: " .. ScoreMission .. " ( " .. ScoreMessageMission .. ")"
|
||||
end
|
||||
end
|
||||
|
||||
@ -19143,18 +19214,25 @@ function SCORING:ReportScoreGroupSummary( PlayerGroup )
|
||||
local ReportHits, ScoreHits, PenaltyHits = self:ReportDetailedPlayerHits( PlayerName )
|
||||
ReportHits = ReportHits ~= "" and "\n- " .. ReportHits or ReportHits
|
||||
self:E( { ReportHits, ScoreHits, PenaltyHits } )
|
||||
|
||||
local ReportDestroys, ScoreDestroys, PenaltyDestroys = self:ReportDetailedPlayerDestroys( PlayerName )
|
||||
ReportDestroys = ReportDestroys ~= "" and "\n- " .. ReportDestroys or ReportDestroys
|
||||
self:E( { ReportDestroys, ScoreDestroys, PenaltyDestroys } )
|
||||
|
||||
local ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges = self:ReportDetailedPlayerCoalitionChanges( PlayerName )
|
||||
ReportCoalitionChanges = ReportCoalitionChanges ~= "" and "\n- " .. ReportCoalitionChanges or ReportCoalitionChanges
|
||||
self:E( { ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges } )
|
||||
|
||||
local ReportGoals, ScoreGoals, PenaltyGoals = self:ReportDetailedPlayerGoals( PlayerName )
|
||||
ReportGoals = ReportGoals ~= "" and "\n- " .. ReportGoals or ReportGoals
|
||||
self:E( { ReportGoals, ScoreGoals, PenaltyGoals } )
|
||||
|
||||
local ReportMissions, ScoreMissions, PenaltyMissions = self:ReportDetailedPlayerMissions( PlayerName )
|
||||
ReportMissions = ReportMissions ~= "" and "\n- " .. ReportMissions or ReportMissions
|
||||
self:E( { ReportMissions, ScoreMissions, PenaltyMissions } )
|
||||
|
||||
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreMissions
|
||||
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + PenaltyMissions
|
||||
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreGoals + ScoreMissions
|
||||
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + ScoreGoals + PenaltyMissions
|
||||
|
||||
PlayerMessage =
|
||||
string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties )",
|
||||
@ -19188,21 +19266,28 @@ function SCORING:ReportScoreGroupDetailed( PlayerGroup )
|
||||
local ReportHits, ScoreHits, PenaltyHits = self:ReportDetailedPlayerHits( PlayerName )
|
||||
ReportHits = ReportHits ~= "" and "\n- " .. ReportHits or ReportHits
|
||||
self:E( { ReportHits, ScoreHits, PenaltyHits } )
|
||||
|
||||
local ReportDestroys, ScoreDestroys, PenaltyDestroys = self:ReportDetailedPlayerDestroys( PlayerName )
|
||||
ReportDestroys = ReportDestroys ~= "" and "\n- " .. ReportDestroys or ReportDestroys
|
||||
self:E( { ReportDestroys, ScoreDestroys, PenaltyDestroys } )
|
||||
|
||||
local ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges = self:ReportDetailedPlayerCoalitionChanges( PlayerName )
|
||||
ReportCoalitionChanges = ReportCoalitionChanges ~= "" and "\n- " .. ReportCoalitionChanges or ReportCoalitionChanges
|
||||
self:E( { ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges } )
|
||||
|
||||
local ReportGoals, ScoreGoals, PenaltyGoals = self:ReportDetailedPlayerGoals( PlayerName )
|
||||
ReportGoals = ReportGoals ~= "" and "\n- " .. ReportGoals or ReportGoals
|
||||
self:E( { ReportGoals, ScoreGoals, PenaltyGoals } )
|
||||
|
||||
local ReportMissions, ScoreMissions, PenaltyMissions = self:ReportDetailedPlayerMissions( PlayerName )
|
||||
ReportMissions = ReportMissions ~= "" and "\n- " .. ReportMissions or ReportMissions
|
||||
self:E( { ReportMissions, ScoreMissions, PenaltyMissions } )
|
||||
|
||||
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreMissions
|
||||
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + PenaltyMissions
|
||||
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreGoals + ScoreMissions
|
||||
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + ScoreGoals + PenaltyMissions
|
||||
|
||||
PlayerMessage =
|
||||
string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties )%s%s%s%s",
|
||||
string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties )%s%s%s%s%s",
|
||||
PlayerName,
|
||||
PlayerScore - PlayerPenalty,
|
||||
PlayerScore,
|
||||
@ -19210,6 +19295,7 @@ function SCORING:ReportScoreGroupDetailed( PlayerGroup )
|
||||
ReportHits,
|
||||
ReportDestroys,
|
||||
ReportCoalitionChanges,
|
||||
ReportGoals,
|
||||
ReportMissions
|
||||
)
|
||||
MESSAGE:New( PlayerMessage, 30, "Player '" .. PlayerName .. "'" ):ToGroup( PlayerGroup )
|
||||
@ -19234,18 +19320,25 @@ function SCORING:ReportScoreAllSummary( PlayerGroup )
|
||||
local ReportHits, ScoreHits, PenaltyHits = self:ReportDetailedPlayerHits( PlayerName )
|
||||
ReportHits = ReportHits ~= "" and "\n- " .. ReportHits or ReportHits
|
||||
self:E( { ReportHits, ScoreHits, PenaltyHits } )
|
||||
|
||||
local ReportDestroys, ScoreDestroys, PenaltyDestroys = self:ReportDetailedPlayerDestroys( PlayerName )
|
||||
ReportDestroys = ReportDestroys ~= "" and "\n- " .. ReportDestroys or ReportDestroys
|
||||
self:E( { ReportDestroys, ScoreDestroys, PenaltyDestroys } )
|
||||
|
||||
local ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges = self:ReportDetailedPlayerCoalitionChanges( PlayerName )
|
||||
ReportCoalitionChanges = ReportCoalitionChanges ~= "" and "\n- " .. ReportCoalitionChanges or ReportCoalitionChanges
|
||||
self:E( { ReportCoalitionChanges, ScoreCoalitionChanges, PenaltyCoalitionChanges } )
|
||||
|
||||
local ReportGoals, ScoreGoals, PenaltyGoals = self:ReportDetailedPlayerGoals( PlayerName )
|
||||
ReportGoals = ReportGoals ~= "" and "\n- " .. ReportGoals or ReportGoals
|
||||
self:E( { ReportGoals, ScoreGoals, PenaltyGoals } )
|
||||
|
||||
local ReportMissions, ScoreMissions, PenaltyMissions = self:ReportDetailedPlayerMissions( PlayerName )
|
||||
ReportMissions = ReportMissions ~= "" and "\n- " .. ReportMissions or ReportMissions
|
||||
self:E( { ReportMissions, ScoreMissions, PenaltyMissions } )
|
||||
|
||||
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreMissions
|
||||
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + PenaltyMissions
|
||||
local PlayerScore = ScoreHits + ScoreDestroys + ScoreCoalitionChanges + ScoreGoals + ScoreMissions
|
||||
local PlayerPenalty = PenaltyHits + PenaltyDestroys + PenaltyCoalitionChanges + ScoreGoals + PenaltyMissions
|
||||
|
||||
PlayerMessage =
|
||||
string.format( "Player '%s' Score = %d ( %d Score, -%d Penalties )",
|
||||
|
||||
Binary file not shown.
@ -881,9 +881,6 @@ Use the method <a href="##(AI_PATROL_ZONE).ManageDamage">AI<em>PATROL</em>ZONE.M
|
||||
|
||||
|
||||
|
||||
|
||||
<p> This table contains the targets detected during patrol.</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
|
||||
@ -2425,7 +2425,6 @@ The UNIT carrying the package.</p>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<em></em>
|
||||
<a id="#(AI_CARGO_UNIT).CargoCarrier" >
|
||||
<strong>AI_CARGO_UNIT.CargoCarrier</strong>
|
||||
</a>
|
||||
|
||||
@ -315,8 +315,7 @@ Nothing of this code should be modified without testing it thoroughly.</p>
|
||||
|
||||
|
||||
|
||||
<p> Initialize the ObjectSchedulers array, which is a weakly coupled table.
|
||||
If the object used as the key is nil, then the garbage collector will remove the item from the Functions array.</p>
|
||||
<p> setmetatable( {}, { __mode = "v" } )</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
@ -119,7 +119,7 @@ The default range of the scores granted is a value between 0 and 10. The default
|
||||
|
||||
<p><img src="..\Presentations\SCORING\Dia9.JPG" alt="Banner Image"/></p>
|
||||
|
||||
<p>**Various <a href="Zone.html">Zone</a>s** can be defined for which scores are also granted when objects in that <a href="Zone.html">Zone</a> are destroyed.
|
||||
<p>Various <a href="Zone.html">Zone</a>s can be defined for which scores are also granted when objects in that <a href="Zone.html">Zone</a> are destroyed.
|
||||
This is <strong>specifically useful</strong> to designate <strong>scenery targets on the map</strong> that will generate points when destroyed.</p>
|
||||
|
||||
<p>With a small change in MissionScripting.lua, the scoring results can also be logged in a <strong>CSV file</strong>. <br/>
|
||||
@ -180,13 +180,18 @@ then the zone is a moving zone, and anything destroyed within that <a href="Zone
|
||||
The other implementation could be to designate a scenery target (a building) in the mission editor surrounded by a <a href="Zone.html">Zone</a>,
|
||||
just large enough around that building.</p>
|
||||
|
||||
<h2>1.4) Configure fratricide level.</h2>
|
||||
<h2>1.4) Add extra Goal scores upon an event or a condition.</h2>
|
||||
|
||||
<p>A mission has goals and achievements. The scoring system provides an API to set additional scores when a goal or achievement event happens.
|
||||
Use the method <a href="##(SCORING).AddGoalScore">SCORING.AddGoalScore</a>() to add a score for a Player at any time in your mission.</p>
|
||||
|
||||
<h2>1.5) Configure fratricide level.</h2>
|
||||
|
||||
<p>When a player commits too much damage to friendlies, his penalty score will reach a certain level.
|
||||
Use the method <a href="##(SCORING).SetFratricide">SCORING.SetFratricide</a>() to define the level when a player gets kicked. <br/>
|
||||
By default, the fratricide level is the default penalty mutiplier * 2 for the penalty score.</p>
|
||||
|
||||
<h2>1.5) Penalty score when a player changes the coalition.</h2>
|
||||
<h2>1.6) Penalty score when a player changes the coalition.</h2>
|
||||
|
||||
<p>When a player changes the coalition, he can receive a penalty score.
|
||||
Use the method <a href="##(SCORING).SetCoalitionChangePenalty">SCORING.SetCoalitionChangePenalty</a>() to define the penalty when a player changes coalition.
|
||||
@ -299,6 +304,12 @@ Various methods exist to configure:</p>
|
||||
<h2><a id="#(SCORING)">Type <code>SCORING</code></a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(SCORING).AddGoalScore">SCORING:AddGoalScore(PlayerUnit, GoalTag, Text, Score)</a></td>
|
||||
<td class="summary">
|
||||
<p>Add a goal score for a player.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(SCORING).AddScoreGroup">SCORING:AddScoreGroup(ScoreGroup, Score)</a></td>
|
||||
<td class="summary">
|
||||
<p>Specify a special additional score for a <a href="Group.html">Group</a>.</p>
|
||||
@ -493,7 +504,7 @@ Various methods exist to configure:</p>
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(SCORING).ReportDetailedPlayerMissions">SCORING:ReportDetailedPlayerMissions(PlayerName)</a></td>
|
||||
<td class="summary">
|
||||
<p>Produce detailed report of player penalty scores because of changing the coalition.</p>
|
||||
<p>Produce detailed report of player goal scores.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -721,6 +732,52 @@ Various methods exist to configure:</p>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<a id="#(SCORING).AddGoalScore" >
|
||||
<strong>SCORING:AddGoalScore(PlayerUnit, GoalTag, Text, Score)</strong>
|
||||
</a>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Add a goal score for a player.</p>
|
||||
|
||||
|
||||
<p>The method takes the PlayerUnit for which the Goal score needs to be set.
|
||||
The GoalTag is a string or identifier that is taken into the CSV file scoring log to identify the goal.
|
||||
A free text can be given that is shown to the players.
|
||||
The Score can be both positive and negative.</p>
|
||||
|
||||
<h3>Parameters</h3>
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
<p><code><em><a href="Wrapper.Unit.html##(UNIT)">Wrapper.Unit#UNIT</a> PlayerUnit </em></code>:
|
||||
The <a href="Unit.html">Unit</a> of the Player. Other Properties for the scoring are taken from this PlayerUnit, like coalition, type etc. </p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p><code><em>#string GoalTag </em></code>:
|
||||
The string or identifier that is used in the CSV file to identify the goal (sort or group later in Excel).</p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p><code><em>#string Text </em></code>:
|
||||
A free text that is shown to the players.</p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p><code><em>#number Score </em></code>:
|
||||
The score can be both positive or negative ( Penalty ).</p>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<a id="#(SCORING).AddScoreGroup" >
|
||||
<strong>SCORING:AddScoreGroup(ScoreGroup, Score)</strong>
|
||||
</a>
|
||||
@ -1417,7 +1474,7 @@ The report.</p>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Produce detailed report of player penalty scores because of changing the coalition.</p>
|
||||
<p>Produce detailed report of player goal scores.</p>
|
||||
|
||||
<h3>Parameter</h3>
|
||||
<ul>
|
||||
|
||||
@ -834,12 +834,6 @@ A coding example is provided at the description of the <a href="##(SPAWN).OnSpaw
|
||||
<td class="name" nowrap="nowrap"><a href="##(SPAWN)._TranslateRotate">SPAWN:_TranslateRotate(SpawnIndex, SpawnRootX, SpawnRootY, SpawnX, SpawnY, SpawnAngle)</a></td>
|
||||
<td class="summary">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(SPAWN).uncontrolled">SPAWN.uncontrolled</a></td>
|
||||
<td class="summary">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -1765,6 +1759,9 @@ The group that was spawned. You can use this group for further actions.</p>
|
||||
|
||||
|
||||
|
||||
|
||||
<p> Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
@ -2239,7 +2236,7 @@ when nothing was spawned.</p>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<em></em>
|
||||
<em>#number</em>
|
||||
<a id="#(SPAWN).SpawnMaxGroups" >
|
||||
<strong>SPAWN.SpawnMaxGroups</strong>
|
||||
</a>
|
||||
@ -2256,7 +2253,7 @@ when nothing was spawned.</p>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<em></em>
|
||||
<em>#number</em>
|
||||
<a id="#(SPAWN).SpawnMaxUnitsAlive" >
|
||||
<strong>SPAWN.SpawnMaxUnitsAlive</strong>
|
||||
</a>
|
||||
@ -2559,7 +2556,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 )
|
||||
|
||||
|
||||
|
||||
<p> When the first Spawn executes, all the Groups need to be made visible before start.</p>
|
||||
<p> Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned.</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
@ -3198,20 +3195,6 @@ True = Continue Scheduler</p>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<em></em>
|
||||
<a id="#(SPAWN).uncontrolled" >
|
||||
<strong>SPAWN.uncontrolled</strong>
|
||||
</a>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
@ -89,6 +89,7 @@
|
||||
<li><a href="##(TASK).HasStateMachine">TASK.HasStateMachine</a>():Enquire if the task has a <a href="Fsm.html">Fsm</a></li>
|
||||
<li><a href="##(TASK).AssignToUnit">TASK.AssignToUnit</a>(): Assign a task to a unit. (Needs to be implemented in the derived classes from <a href="##(TASK)">#TASK</a>.</li>
|
||||
<li><a href="##(TASK).UnAssignFromUnit">TASK.UnAssignFromUnit</a>(): Unassign the task from a unit.</li>
|
||||
<li><a href="##(TASK).SetTimeOut">TASK.SetTimeOut</a>(): Set timer in seconds before task gets cancelled if not assigned.</li>
|
||||
</ul>
|
||||
|
||||
<h2>1.2) Set and enquire task status (beyond the task state machine processing).</h2>
|
||||
@ -512,6 +513,12 @@ Use the method <a href="##(TASK).AddScore">TASK.AddScore</a>() to add scores whe
|
||||
<td class="name" nowrap="nowrap"><a href="##(TASK).SetStateMachine">TASK:SetStateMachine(TaskUnit, Fsm)</a></td>
|
||||
<td class="summary">
|
||||
<p>Add a FiniteStateMachine to <a href="Task.html">Task</a> with key Task<a href="Unit.html">Unit</a></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(TASK).SetTimeOut">TASK:SetTimeOut(Timer)</a></td>
|
||||
<td class="summary">
|
||||
<p>Sets the TimeOut for the <a href="Task.html">Task</a>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -596,6 +603,12 @@ Use the method <a href="##(TASK).AddScore">TASK.AddScore</a>() to add scores whe
|
||||
<td class="name" nowrap="nowrap"><a href="##(TASK).TaskType">TASK.TaskType</a></td>
|
||||
<td class="summary">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(TASK).TimeOut">TASK.TimeOut</a></td>
|
||||
<td class="summary">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -644,6 +657,12 @@ Use the method <a href="##(TASK).AddScore">TASK.AddScore</a>() to add scores whe
|
||||
<td class="name" nowrap="nowrap"><a href="##(TASK).onafterReplan">TASK:onafterReplan(From, Event, To)</a></td>
|
||||
<td class="summary">
|
||||
<p>FSM function for a TASK</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(TASK).onbeforeTimeOut">TASK:onbeforeTimeOut(Event, From, To)</a></td>
|
||||
<td class="summary">
|
||||
<p>FSM function for a TASK</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -662,6 +681,12 @@ Use the method <a href="##(TASK).AddScore">TASK.AddScore</a>() to add scores whe
|
||||
<td class="name" nowrap="nowrap"><a href="##(TASK).onenterFailed">TASK:onenterFailed(From, Event, To)</a></td>
|
||||
<td class="summary">
|
||||
<p>FSM function for a TASK</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(TASK).onenterPlanned">TASK:onenterPlanned(Event, From, To)</a></td>
|
||||
<td class="summary">
|
||||
<p>FSM function for a TASK</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -1994,6 +2019,36 @@ self</p>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<a id="#(TASK).SetTimeOut" >
|
||||
<strong>TASK:SetTimeOut(Timer)</strong>
|
||||
</a>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Sets the TimeOut for the <a href="Task.html">Task</a>.</p>
|
||||
|
||||
|
||||
<p>If <a href="Task.html">Task</a> stayed planned for longer than TimeOut, it gets into Cancelled status.</p>
|
||||
|
||||
<h3>Parameter</h3>
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
<p><code><em><a href="##(integer)">#integer</a> Timer </em></code>:
|
||||
in seconds</p>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
<h3>Return value</h3>
|
||||
|
||||
<p><em><a href="##(TASK)">#TASK</a>:</em>
|
||||
self</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<a id="#(TASK).SetType" >
|
||||
<strong>TASK:SetType(TaskType)</strong>
|
||||
</a>
|
||||
@ -2201,6 +2256,20 @@ Fsm#FSM_PROCESS</p>
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<em></em>
|
||||
<a id="#(TASK).TimeOut" >
|
||||
<strong>TASK.TimeOut</strong>
|
||||
</a>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
@ -2356,6 +2425,37 @@ self</p>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<a id="#(TASK).onbeforeTimeOut" >
|
||||
<strong>TASK:onbeforeTimeOut(Event, From, To)</strong>
|
||||
</a>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>FSM function for a TASK</p>
|
||||
|
||||
<h3>Parameters</h3>
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
<p><code><em>#string Event </em></code>: </p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p><code><em>#string From </em></code>: </p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p><code><em>#string To </em></code>: </p>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<a id="#(TASK).onenterAborted" >
|
||||
<strong>TASK:onenterAborted(From, Event, To)</strong>
|
||||
</a>
|
||||
@ -2449,6 +2549,37 @@ self</p>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<a id="#(TASK).onenterPlanned" >
|
||||
<strong>TASK:onenterPlanned(Event, From, To)</strong>
|
||||
</a>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>FSM function for a TASK</p>
|
||||
|
||||
<h3>Parameters</h3>
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
<p><code><em>#string Event </em></code>: </p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p><code><em>#string From </em></code>: </p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p><code><em>#string To </em></code>: </p>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<a id="#(TASK).onenterSuccess" >
|
||||
<strong>TASK:onenterSuccess(Event, From, To)</strong>
|
||||
</a>
|
||||
@ -2509,6 +2640,8 @@ self</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h2><a id="#(integer)" >Type <code>integer</code></a></h2>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user