Arma Reforger Script API
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SCR_BaseScoringSystemComponent Interface Reference

This component serves as a base and interface for game mode scoring system. More...

Inheritance diagram for SCR_BaseScoringSystemComponent:
[legend]

Public Member Functions

OnPlayerScoreChangedInvoker GetOnPlayerScoreChanged ()
 
OnFactionScoreChangedInvoker GetOnFactionScoreChanged ()
 
OnPlayerEventInvoker GetOnPlayerAdded ()
 
OnPlayerEventInvoker GetOnPlayerRemoved ()
 
override bool RplSave (ScriptBitWriter writer)
 Serialise current state of scoring into buffer via provided writer.
 
override bool RplLoad (ScriptBitReader reader)
 Deserialise state of scoring into buffer via provided reader.
 
void AddKill (int playerId, int count=1)
 Add count x kills to playerId's score info and their affiliated faction's.
 
void AddDeath (int playerId, int count=1)
 Add count x deaths to playerId's score info and their affiliated faction's.
 
void AddTeamKill (int playerId, int count=1)
 Add count x teamKills to playerId's score info and their affiliated faction's.
 
void AddSuicide (int playerId, int count=1)
 Add count x suicides to playerId's score info and their affiliated faction's.
 
void AddObjective (int playerId, int count=1, bool addToFaction=true)
 Add count x objectives to playerId's score info.
 
void AddFactionObjective (notnull Faction faction, int count=1)
 Add count x objectives to provided faction.
 
int GetPlayerScore (int playerId)
 
SCR_ScoreInfo GetPlayerScoreInfo (int playerId)
 
int GetFactionScore (notnull Faction faction)
 
SCR_ScoreInfo GetFactionScoreInfo (notnull Faction faction)
 
override void OnPlayerRegistered (int playerId)
 Called on every machine after a player is registered (identity, name etc.).
 
override void OnPlayerDisconnected (int playerId, KickCauseCode cause, int timeout)
 Called after a player is disconnected.
 
override void EOnDiag (IEntity owner, float timeSlice)
 
int GetScoreLimit ()
 
override void EOnInit (IEntity owner)
 
override void OnPostInit (IEntity owner)
 
override void OnDelete (IEntity owner)
 
- Public Member Functions inherited from SCR_BaseGameModeComponent
SCR_BaseGameMode GetGameMode ()
 
void OnGameEnd ()
 Called on all machines when the world ends.
 
void OnGameStateChanged (SCR_EGameModeState state)
 Called when game mode state changes called on all machines.
 
void OnGameModeStart ()
 Called on every machine when game mode starts.
 
void OnGameModeEnd (SCR_GameModeEndData data)
 Called when game mode ends.
 
void OnPlayerConnected (int playerId)
 Called after a player is connected.
 
void OnPlayerAuditSuccess (int playerId)
 Event is called when player connecting Session hosting current Game Mode where is required authentication verification via.
 
void OnPlayerAuditFail (int playerId)
 Event is called when player connecting Session hosting current Game Mode AuditFail() call may be called under two occasions: 1) verification is required but failed (account is not valid, player is banned, internet issues) 2) player cannot be verified as authentication is not required or possible - where it may be valid behavior (server online connectivity turned off for example) Basically non-audited player cannot access persistency/ etc.
 
void OnPlayerAuditTimeouted (int playerId)
 Event is called when player connected to Session was kicked and did not reconnected in time This mean that slot reservation can be canceled.
 
void OnPlayerAuditRevived (int playerId)
 Event is called when player reconnected successfully back to Session after kick This mean that slot reservation need to be finished (closed).
 
void OnPlayerRegistered (int playerId)
 Called on every machine after a player is registered (identity, name etc.).
 
void OnPlayerDisconnected (int playerId, KickCauseCode cause, int timeout)
 Called after a player is disconnected.
 
void OnPlayerSpawned (int playerId, IEntity controlledEntity)
 Called after a player is spawned.
 
bool PreparePlayerEntity_S (SCR_SpawnRequestComponent requestComponent, SCR_SpawnHandlerComponent handlerComponent, SCR_SpawnData data, IEntity entity)
 
void OnSpawnPlayerEntityFailure_S (SCR_SpawnRequestComponent requestComponent, SCR_SpawnHandlerComponent handlerComponent, IEntity entity, SCR_SpawnData data, SCR_ESpawnResult reason)
 
void OnPlayerSpawnFinalize_S (SCR_SpawnRequestComponent requestComponent, SCR_SpawnHandlerComponent handlerComponent, SCR_SpawnData data, IEntity entity)
 
bool HandlePlayerKilled (int playerId, IEntity playerEntity, IEntity killerEntity, notnull Instigator killer)
 See SCR_BaseGameMode.HandlePlayerKilled.
 
void OnPlayerKilled (int playerId, IEntity playerEntity, IEntity killerEntity, notnull Instigator killer)
 Called after a player gets killed.
 
void OnPlayerKilledHandled (int playerId, IEntity playerEntity, IEntity killerEntity, notnull Instigator killer)
 Called after player gets killed in cases where the kill was handled by the game mode, supressing the default OnPlayerKilled behaviour.
 
void OnPlayerDeleted (int playerId, IEntity player)
 Called after a player gets deleted.
 
void OnPlayerRoleChange (int playerId, EPlayerRole roleFlags)
 Called when player role changes.
 
void OnWorldPostProcess (World world)
 Called once loading of all entities of the world have been finished (still within the loading)
 
void HandleOnLoadoutAssigned (int playerID, SCR_BasePlayerLoadout assignedLoadout)
 What happens when a player is assigned a loadout.
 
void HandleOnFactionAssigned (int playerID, Faction assignedFaction)
 What happens when a player is assigned a faction.
 
void HandleOnSpawnPointAssigned (int playerID, SCR_SpawnPoint spawnPoint)
 What happens when a player is assigned a spawn point.
 
void OnControllableSpawned (IEntity entity)
 When a controllable entity is spawned, this event is raised.
 
void OnControllableDestroyed (IEntity entity, IEntity killerEntity, notnull Instigator killer)
 When a controllable entity is destroyed, this event is raised.
 
void OnControllableDeleted (IEntity entity)
 Prior to a controllable entity being DELETED, this event is raised.
 
void SCR_BaseGameModeComponent (IEntityComponentSource src, IEntity ent, IEntity parent)
 

Protected Member Functions

void OnPlayerScoreChanged (int playerId, SCR_ScoreInfo scoreInfo)
 Called on all machines when player score changes.
 
void OnFactionScoreChanged (Faction faction, SCR_ScoreInfo scoreInfo)
 Called on all machines when faction score changes.
 
int CalculateScore (SCR_ScoreInfo info)
 Calculate score for provided score info.
 

Protected Attributes

ref map< int, ref SCR_ScoreInfom_mPlayerScores = new map<int, ref SCR_ScoreInfo>()
 Map of scores per player.
 
ref map< Faction, ref SCR_ScoreInfom_mFactionScores = new map<Faction, ref SCR_ScoreInfo>()
 Map of scores per faction.
 
ref OnPlayerScoreChangedInvoker m_OnPlayerScoreChangedInvoker
 This invoker is invoked when score of provided player changes.
 
ref OnFactionScoreChangedInvoker m_OnFactionScoreChangedInvoker
 This invoker is invoked when score of provided faction changes.
 
ref OnPlayerEventInvoker m_OnPlayerAdded
 This invoker is invoked when a player is registered to the scoreboard.
 
ref OnPlayerEventInvoker m_OnPlayerRemoved
 This invoker is invoked when a player is registered to the scoreboard.
 
- Protected Attributes inherited from SCR_BaseGameModeComponent
SCR_BaseGameMode m_pGameMode
 The game mode entity this component is attached to.
 

Detailed Description

This component serves as a base and interface for game mode scoring system.

It keeps track of individual player scores and manages replication of such values to all clients when necessary.

Scoring is implemented in authoritative way, ie. only the server can update score.

This component only keeps track of scores, but does not react or change the game flow in any way. For specialised logic inherit this component and implement custom logic.

Member Function Documentation

◆ AddDeath()

void SCR_BaseScoringSystemComponent.AddDeath ( int  playerId,
int  count = 1 
)

Add count x deaths to playerId's score info and their affiliated faction's.

Server-only, propagated to all clients via BC reliable RPC.

Parameters
[in]playerId
[in]count

◆ AddFactionObjective()

void SCR_BaseScoringSystemComponent.AddFactionObjective ( notnull Faction  faction,
int  count = 1 
)

Add count x objectives to provided faction.

Server-only, propagated to all clients via BC reliable RPC.

Parameters
[in]faction
[in]count

◆ AddKill()

void SCR_BaseScoringSystemComponent.AddKill ( int  playerId,
int  count = 1 
)

Add count x kills to playerId's score info and their affiliated faction's.

Server-only, propagated to all clients via BC reliable RPC.

Parameters
[in]playerId
[in]count

◆ AddObjective()

void SCR_BaseScoringSystemComponent.AddObjective ( int  playerId,
int  count = 1,
bool  addToFaction = true 
)

Add count x objectives to playerId's score info.

Server-only, propagated to all clients via BC reliable RPC.

Parameters
[in]playerId
[in]count
[in]addToFactionIf false, score is not added to faction automatically

◆ AddSuicide()

void SCR_BaseScoringSystemComponent.AddSuicide ( int  playerId,
int  count = 1 
)

Add count x suicides to playerId's score info and their affiliated faction's.

Server-only, propagated to all clients via BC reliable RPC.

Parameters
[in]playerId
[in]count

◆ AddTeamKill()

void SCR_BaseScoringSystemComponent.AddTeamKill ( int  playerId,
int  count = 1 
)

Add count x teamKills to playerId's score info and their affiliated faction's.

Server-only, propagated to all clients via BC reliable RPC.

Parameters
[in]playerId
[in]count

◆ CalculateScore()

int SCR_BaseScoringSystemComponent.CalculateScore ( SCR_ScoreInfo  info)
protected

Calculate score for provided score info.

Different kinds of score multipliers and evaluation can be calculated by overriding this method.

Parameters
[in]info
Returns

Implemented in SCR_ScoringSystemComponent.

◆ EOnDiag()

override void SCR_BaseScoringSystemComponent.EOnDiag ( IEntity  owner,
float  timeSlice 
)

◆ EOnInit()

override void SCR_BaseScoringSystemComponent.EOnInit ( IEntity  owner)

◆ GetFactionScore()

int SCR_BaseScoringSystemComponent.GetFactionScore ( notnull Faction  faction)
Returns
score of provided faction or 0 if none.

◆ GetFactionScoreInfo()

SCR_ScoreInfo SCR_BaseScoringSystemComponent.GetFactionScoreInfo ( notnull Faction  faction)
Returns
score info of provided faction or null if none.

◆ GetOnFactionScoreChanged()

OnFactionScoreChangedInvoker SCR_BaseScoringSystemComponent.GetOnFactionScoreChanged ( )
Returns
invoker that is invoked when score of provided player changes.

◆ GetOnPlayerAdded()

OnPlayerEventInvoker SCR_BaseScoringSystemComponent.GetOnPlayerAdded ( )
Returns
invoker that is invoked when any score changes.

◆ GetOnPlayerRemoved()

OnPlayerEventInvoker SCR_BaseScoringSystemComponent.GetOnPlayerRemoved ( )
Returns
invoker that is invoked when any score changes.

◆ GetOnPlayerScoreChanged()

OnPlayerScoreChangedInvoker SCR_BaseScoringSystemComponent.GetOnPlayerScoreChanged ( )
Returns
invoker that is invoked when score of provided player changes.

◆ GetPlayerScore()

int SCR_BaseScoringSystemComponent.GetPlayerScore ( int  playerId)
Returns
score for given player by their playerId or 0 if none.

◆ GetPlayerScoreInfo()

SCR_ScoreInfo SCR_BaseScoringSystemComponent.GetPlayerScoreInfo ( int  playerId)
Returns
score info of provided player or null if none.

◆ GetScoreLimit()

int SCR_BaseScoringSystemComponent.GetScoreLimit ( )
Returns
maximum allowed score or -1 if undefined.

Implemented in SCR_ScoringSystemComponent.

◆ OnDelete()

override void SCR_BaseScoringSystemComponent.OnDelete ( IEntity  owner)

◆ OnFactionScoreChanged()

void SCR_BaseScoringSystemComponent.OnFactionScoreChanged ( Faction  faction,
SCR_ScoreInfo  scoreInfo 
)
protected

Called on all machines when faction score changes.

Parameters
[in]faction
[in]scoreInfo

Implemented in SCR_ScoringSystemComponent.

◆ OnPlayerDisconnected()

override void SCR_BaseScoringSystemComponent.OnPlayerDisconnected ( int  playerId,
KickCauseCode  cause,
int  timeout 
)

Called after a player is disconnected.

Parameters
[in]playerIdPlayerId of disconnected player.
[in]causeReason player disconnected
[in]timeoutTimeout for when players are allowed to connect again. -1 means Ban without an assigned timeout

Implements SCR_BaseGameModeComponent.

◆ OnPlayerRegistered()

override void SCR_BaseScoringSystemComponent.OnPlayerRegistered ( int  playerId)

Called on every machine after a player is registered (identity, name etc.).

Always called after OnPlayerConnected.

Parameters
[in]playerIdPlayerId of registered player.

Implements SCR_BaseGameModeComponent.

◆ OnPlayerScoreChanged()

void SCR_BaseScoringSystemComponent.OnPlayerScoreChanged ( int  playerId,
SCR_ScoreInfo  scoreInfo 
)
protected

Called on all machines when player score changes.

Parameters
[in]playerId
[in]scoreInfo

Implemented in SCR_ScoringSystemComponent.

◆ OnPostInit()

override void SCR_BaseScoringSystemComponent.OnPostInit ( IEntity  owner)

◆ RplLoad()

override bool SCR_BaseScoringSystemComponent.RplLoad ( ScriptBitReader  reader)

Deserialise state of scoring into buffer via provided reader.

Parameters
[in]reader
Returns

◆ RplSave()

override bool SCR_BaseScoringSystemComponent.RplSave ( ScriptBitWriter  writer)

Serialise current state of scoring into buffer via provided writer.

Parameters
[in]writer
Returns

Member Data Documentation

◆ m_mFactionScores

ref map<Faction, ref SCR_ScoreInfo> SCR_BaseScoringSystemComponent.m_mFactionScores = new map<Faction, ref SCR_ScoreInfo>()
protected

Map of scores per faction.

◆ m_mPlayerScores

ref map<int, ref SCR_ScoreInfo> SCR_BaseScoringSystemComponent.m_mPlayerScores = new map<int, ref SCR_ScoreInfo>()
protected

Map of scores per player.

key: playerId

◆ m_OnFactionScoreChangedInvoker

ref OnFactionScoreChangedInvoker SCR_BaseScoringSystemComponent.m_OnFactionScoreChangedInvoker
protected

This invoker is invoked when score of provided faction changes.

◆ m_OnPlayerAdded

ref OnPlayerEventInvoker SCR_BaseScoringSystemComponent.m_OnPlayerAdded
protected

This invoker is invoked when a player is registered to the scoreboard.

◆ m_OnPlayerRemoved

ref OnPlayerEventInvoker SCR_BaseScoringSystemComponent.m_OnPlayerRemoved
protected

This invoker is invoked when a player is registered to the scoreboard.

◆ m_OnPlayerScoreChangedInvoker

ref OnPlayerScoreChangedInvoker SCR_BaseScoringSystemComponent.m_OnPlayerScoreChangedInvoker
protected

This invoker is invoked when score of provided player changes.


The documentation for this interface was generated from the following file: