Loading...
Searching...
No Matches
SCR_FactionManager Interface Reference
Inheritance diagram for SCR_FactionManager:
FactionManager SCR_CampaignFactionManager

Public Member Functions

ScriptInvoker GetOnPlayerFactionCountChanged ()
 
ScriptInvokerFaction GetOnFactionTasksEnabledChanged ()
 
ScriptInvokerBase< SCR_FactionManager_PlayerFactionChanged > GetOnPlayerFactionChanged_S ()
 return Script invoker on player faction changed (Server only)
 
void UpdateCustomLoadoutSupportState (SCR_LoadoutManager loadoutMgr)
 Forces all factions to reevaluate if they support players saving custom loadouts.
 
bool SetPlayerFaction (notnull SCR_ChimeraCharacter character, notnull Faction faction)
 
SCR_RankContainer GetFactionRanks (int playerId)
 Return affiliated ranks of a faction the player is affiliated with.
 
Faction GetPlayerFaction (int playerId)
 Return affiliated faction of provided player by their id.
 
Faction GetLocalPlayerFaction ()
 Return affiliated faction of local player.
 
int GetFactionPlayerCount (Faction faction)
 Returns current count of players assigned to the provided faction.
 
int GetSortedFactionsList (out notnull SCR_SortedArray< SCR_Faction > outFactions)
 Get factions sorted according to their own custom order.
 
override void EOnInit (IEntity owner)
 
void SCR_FactionManager (IEntitySource src, IEntity parent)
 
void ~SCR_FactionManager ()
 
bool CanChangeFactionsPlayable ()
 Check if the faction is playable.
 
void SetFactionTasksEnabled (notnull SCR_Faction faction, bool isTasksEnabled)
 Set whether a faction should receive tasks/objectives.
 
void SetFactionsFriendly (notnull SCR_Faction factionA, notnull SCR_Faction factionB, int playerChanged=-1, bool updateAIs=true)
 Set given factions friendly towards eachother (Replicated if called by server) It is possible to set the same faction friendly towards itself to prevent faction infighting.
 
void SetFactionFriendlyOneWay (notnull SCR_Faction factionA, notnull SCR_Faction factionB, bool updateAIs=true)
 Sets first faction to be friendly to the second faction, ONE WAY ONLY!
 
void SetFactionsHostile (notnull SCR_Faction factionA, notnull SCR_Faction factionB, int playerChanged=-1, bool updateAIs=true)
 Set given factions hostile towards eachother (Replicated if called by server) It is possible to set the same faction hostile towards itself to allow faction infighting.
 
void UpdatePlayerFaction_S (SCR_PlayerFactionAffiliationComponent playerFactionComponent)
 Authority: Update player faction info for target player with their up-to-date state.
 
- Public Member Functions inherited from FactionManager
proto external Faction GetFactionByKey (FactionKey factionKey)
 
proto external Faction GetFactionByIndex (int index)
 
proto external int GetFactionIndex (Faction faction)
 
proto external int GetFactionsCount ()
 Returns the number of available factions stored in this manager or 0 if none.
 
proto external int GetFactionsList (out notnull array< Faction > outFactions)
 

Static Public Member Functions

static Faction SGetFaction (IEntity entity)
 
static Faction SGetPlayerFaction (int playerId)
 Return affiliated faction of provided player by their id.
 
static Faction SGetLocalPlayerFaction ()
 Return affiliated faction of local player.
 
static int SGetFactionPlayerCount (Faction faction)
 Return count of players assigned to the provided faction.
 
static void RequestUpdateAllTargetsFactions ()
 Update all AI perception.
 

Protected Member Functions

void OnPlayerFactionInfoChanged ()
 Update local player faction mapping.
 
void RPC_UpdatePlayerLimit (FactionKey factionKey, int playerLimit)
 Update server player limit to clients.
 
void OnPlayerFactionSet_S (SCR_PlayerFactionAffiliationComponent playerComponent, Faction faction)
 Authority: Event raised when provided player component has a faction set.
 
void OnPlayerFactionCountChanged (Faction faction, int newCount)
 Anyone: Event raised when provided faction's player count changes.
 
override void EOnFixedFrame (IEntity owner, float timeSlice)
 
void RpcDo_SetFactionTasksEnabled (string factionKey, bool isTasksEnabled)
 Set whether a faction should receive tasks/objectives for the whole server.
 
void OnPlayerDisconnected (int playerId, KickCauseCode cause, int timeout)
 Authority: Handle disconnected player.
 
override bool RplSave (ScriptBitWriter writer)
 
override bool RplLoad (ScriptBitReader reader)
 
map< FactionKey, int > GetFactionLimitMapCLI ()
 Authority: Retrieves player limit for listed factions from command line Format is Faction:Limit seperated by comma, e.g.
 

Protected Attributes

bool m_bCanChangeFactionsPlayable
 
ref SCR_RankContainer m_DefaultRanks
 
ref SCR_SortedArray< SCR_Factionm_SortedFactions = new SCR_SortedArray<SCR_Faction>()
 
ref map< string, ref array< string > > m_aAncestors = new map<string, ref array<string>>()
 
ref array< ref SCR_PlayerFactionInfom_aPlayerFactionInfo = {}
 List of all player faction infos in no particular order. Maintained by the authority.
 
ref map< int, int > m_PreviousPlayerFactions = new map<int, int>()
 Map of previous players <playerId : factionIndex>.
 
ref set< int > m_ChangedFactions = new set<int>()
 List of indices of factions whose count has changed since last update.
 
ref map< int, ref SCR_PlayerFactionInfom_MappedPlayerFactionInfo = new map<int, ref SCR_PlayerFactionInfo>()
 Local mapping of playerId to player faction info.
 
ref map< int, int > m_PlayerCount = new map<int, int>()
 Mapping of faction id : player count.
 
ref ScriptInvoker s_OnPlayerFactionCountChanged = new ScriptInvoker()
 
ref ScriptInvokerFaction m_OnFactionTaskEnabledChanged
 
ref ScriptInvokerBase< SCR_FactionManager_PlayerFactionChanged > m_OnPlayerFactionChanged
 
ref map< FactionKey, int > m_mPendingLimitUpdates
 

Constructor & Destructor Documentation

◆ SCR_FactionManager()

void SCR_FactionManager.SCR_FactionManager ( IEntitySource src,
IEntity parent )
Parameters
[in]src
[in]parent

◆ ~SCR_FactionManager()

void SCR_FactionManager.~SCR_FactionManager ( )

Member Function Documentation

◆ CanChangeFactionsPlayable()

bool SCR_FactionManager.CanChangeFactionsPlayable ( )

Check if the faction is playable.

Non-playable factions will not appear in the respawn menu.

Returns
True when playable

◆ EOnFixedFrame()

override void SCR_FactionManager.EOnFixedFrame ( IEntity owner,
float timeSlice )
protected

◆ EOnInit()

override void SCR_FactionManager.EOnInit ( IEntity owner)

◆ GetFactionLimitMapCLI()

map< FactionKey, int > SCR_FactionManager.GetFactionLimitMapCLI ( )
protected

Authority: Retrieves player limit for listed factions from command line Format is Faction:Limit seperated by comma, e.g.

-playerLimits "US:15" or -playerLimits "US:15,USSR:0"

◆ GetFactionPlayerCount()

int SCR_FactionManager.GetFactionPlayerCount ( Faction faction)

Returns current count of players assigned to the provided faction.

Parameters
[in]faction
Returns
Number of players or always 0 if no faction is provided.

◆ GetFactionRanks()

SCR_RankContainer SCR_FactionManager.GetFactionRanks ( int playerId)

Return affiliated ranks of a faction the player is affiliated with.

Parameters
[in]playerIdId of target player corresponding to PlayerController/PlayerManager player id.
Returns
SCR_FactionRanks instance if faction is assigned, returns a default value otherwise.

◆ GetLocalPlayerFaction()

Faction SCR_FactionManager.GetLocalPlayerFaction ( )

Return affiliated faction of local player.

Exceptions
Exceptionif no FactionManager is present in the world.
Returns
Faction instance if faction is assigned, null otherwise.

◆ GetOnFactionTasksEnabledChanged()

ScriptInvokerFaction SCR_FactionManager.GetOnFactionTasksEnabledChanged ( )
Returns

◆ GetOnPlayerFactionChanged_S()

ScriptInvokerBase< SCR_FactionManager_PlayerFactionChanged > SCR_FactionManager.GetOnPlayerFactionChanged_S ( )

return Script invoker on player faction changed (Server only)

◆ GetOnPlayerFactionCountChanged()

ScriptInvoker SCR_FactionManager.GetOnPlayerFactionCountChanged ( )
Returns

◆ GetPlayerFaction()

Faction SCR_FactionManager.GetPlayerFaction ( int playerId)

Return affiliated faction of provided player by their id.

Parameters
[in]playerIdId of target player corresponding to PlayerController/PlayerManager player id.
Exceptions
Exceptionif no FactionManager is present in the world.
Returns
Faction instance if faction is assigned, null otherwise.

◆ GetSortedFactionsList()

int SCR_FactionManager.GetSortedFactionsList ( out notnull SCR_SortedArray< SCR_Faction > outFactions)

Get factions sorted according to their own custom order.

Parameters
[out]outFactionsArray to be filled with factions
Returns
Number of factions

◆ OnPlayerDisconnected()

void SCR_FactionManager.OnPlayerDisconnected ( int playerId,
KickCauseCode cause,
int timeout )
protected

Authority: Handle disconnected player.

Parameters
[in]playerId
[in]cause
[in]timeout

◆ OnPlayerFactionCountChanged()

void SCR_FactionManager.OnPlayerFactionCountChanged ( Faction faction,
int newCount )
protected

Anyone: Event raised when provided faction's player count changes.

Note: Order of changes is not fully deterministic, e.g. when changing faction from A to B, this method might be invoked in the order B, A instead.

Parameters
[in]factionThe faction for which affiliated player count changed.
[in]newCountThe new number of players that are part of this faction.

◆ OnPlayerFactionInfoChanged()

void SCR_FactionManager.OnPlayerFactionInfoChanged ( )
protected

Update local player faction mapping.

◆ OnPlayerFactionSet_S()

void SCR_FactionManager.OnPlayerFactionSet_S ( SCR_PlayerFactionAffiliationComponent playerComponent,
Faction faction )
protected

Authority: Event raised when provided player component has a faction set.

◆ RequestUpdateAllTargetsFactions()

static void SCR_FactionManager.RequestUpdateAllTargetsFactions ( )
static

Update all AI perception.

Used when faction friendly is changed to make sure AI in the area attack or stop attacking each other

◆ RPC_UpdatePlayerLimit()

void SCR_FactionManager.RPC_UpdatePlayerLimit ( FactionKey factionKey,
int playerLimit )
protected

Update server player limit to clients.

◆ RpcDo_SetFactionTasksEnabled()

void SCR_FactionManager.RpcDo_SetFactionTasksEnabled ( string factionKey,
bool isTasksEnabled )
protected

Set whether a faction should receive tasks/objectives for the whole server.

Parameters
[in]factionfaction to enable/disable tasks for
[in]isTasksEnabledwhether to enable/disable tasks for the faction

◆ RplLoad()

override bool SCR_FactionManager.RplLoad ( ScriptBitReader reader)
protected

◆ RplSave()

override bool SCR_FactionManager.RplSave ( ScriptBitWriter writer)
protected

◆ SetFactionFriendlyOneWay()

void SCR_FactionManager.SetFactionFriendlyOneWay ( notnull SCR_Faction factionA,
notnull SCR_Faction factionB,
bool updateAIs = true )

Sets first faction to be friendly to the second faction, ONE WAY ONLY!

(Replicated if called by server) Resulting effect will be faction B being rewarded for killing A, but faction A getting friendly fire penalties on faction B.

Parameters
[in]factionAfaction to set friendly to factionB
[in]factionBfaction factionA becomes friendly to

◆ SetFactionsFriendly()

void SCR_FactionManager.SetFactionsFriendly ( notnull SCR_Faction factionA,
notnull SCR_Faction factionB,
int playerChanged = -1,
bool updateAIs = true )

Set given factions friendly towards eachother (Replicated if called by server) It is possible to set the same faction friendly towards itself to prevent faction infighting.

Parameters
[in]factionAfaction to set friendly to factionB
[in]factionBfaction to set friendly to factionA
[in]playerChangedid of player who changed it to show notification. Leave -1 to not show notification
[in]updateAIsIf true it will update all AI in the world. This is rather expensive so call RequestUpdateAllTargetsFactions() separately to update all AI if setting multiple factions friendly (or hostile)

◆ SetFactionsHostile()

void SCR_FactionManager.SetFactionsHostile ( notnull SCR_Faction factionA,
notnull SCR_Faction factionB,
int playerChanged = -1,
bool updateAIs = true )

Set given factions hostile towards eachother (Replicated if called by server) It is possible to set the same faction hostile towards itself to allow faction infighting.

Parameters
[in]factionAfaction to set hostile to factionB
[in]factionBfaction to set hostile to factionA
[in]playerChangedid of player who changed it to show notification. Leave -1 to not show notification
[in]updateAIsIf true it will update all AI in the world. This is rather expensive so call RequestUpdateAllTargetsFactions() separately to update all AI if setting multiple factions hostile (or friendly)

◆ SetFactionTasksEnabled()

void SCR_FactionManager.SetFactionTasksEnabled ( notnull SCR_Faction faction,
bool isTasksEnabled )

Set whether a faction should receive tasks/objectives.

Parameters
[in]factionfaction to enable/disable tasks for
[in]isTasksEnabledwhether to enable/disable tasks for the faction

◆ SetPlayerFaction()

bool SCR_FactionManager.SetPlayerFaction ( notnull SCR_ChimeraCharacter character,
notnull Faction faction )
Returns
true if the request went through to the server, otherwise false

◆ SGetFaction()

static Faction SCR_FactionManager.SGetFaction ( IEntity entity)
static

◆ SGetFactionPlayerCount()

static int SCR_FactionManager.SGetFactionPlayerCount ( Faction faction)
static

Return count of players assigned to the provided faction.

Static variant of SCR_FactionManager.GetFactionPlayerCount that uses registered FactionManager from the ArmaReforgerScripted game instance.

Exceptions
Exceptionif no FactionManager is present in the world.
Parameters
[in]faction
Returns
Player count for provided faction or 0 if no faction is provided.

◆ SGetLocalPlayerFaction()

static Faction SCR_FactionManager.SGetLocalPlayerFaction ( )
static

Return affiliated faction of local player.

Static variant of SCR_FactionManager.GetLocalPlayerFaction that uses registered FactionManager from the ArmaReforgerScripted game instance.

Exceptions
Exceptionif no FactionManager is present in the world.
Returns
Faction instance if faction is assigned, null otherwise.

◆ SGetPlayerFaction()

static Faction SCR_FactionManager.SGetPlayerFaction ( int playerId)
static

Return affiliated faction of provided player by their id.

Static variant of SCR_FactionManager.GetLocalPlayerFaction that uses registered FactionManager from the ArmaReforgerScripted game instance.

Parameters
[in]playerIdId of target player corresponding to PlayerController/PlayerManager player id.
Exceptions
Exceptionif no FactionManager is present in the world.
Returns
Faction instance if faction is assigned, null otherwise.

◆ UpdateCustomLoadoutSupportState()

void SCR_FactionManager.UpdateCustomLoadoutSupportState ( SCR_LoadoutManager loadoutMgr)

Forces all factions to reevaluate if they support players saving custom loadouts.

◆ UpdatePlayerFaction_S()

void SCR_FactionManager.UpdatePlayerFaction_S ( SCR_PlayerFactionAffiliationComponent playerFactionComponent)

Authority: Update player faction info for target player with their up-to-date state.

Parameters
[in]playerFactionComponent

Member Data Documentation

◆ m_aAncestors

ref map<string, ref array<string> > SCR_FactionManager.m_aAncestors = new map<string, ref array<string>>()
protected

◆ m_aPlayerFactionInfo

ref array<ref SCR_PlayerFactionInfo> SCR_FactionManager.m_aPlayerFactionInfo = {}
protected

List of all player faction infos in no particular order. Maintained by the authority.

◆ m_bCanChangeFactionsPlayable

bool SCR_FactionManager.m_bCanChangeFactionsPlayable
protected

◆ m_ChangedFactions

ref set<int> SCR_FactionManager.m_ChangedFactions = new set<int>()
protected

List of indices of factions whose count has changed since last update.

◆ m_DefaultRanks

ref SCR_RankContainer SCR_FactionManager.m_DefaultRanks
protected

◆ m_MappedPlayerFactionInfo

ref map<int, ref SCR_PlayerFactionInfo> SCR_FactionManager.m_MappedPlayerFactionInfo = new map<int, ref SCR_PlayerFactionInfo>()
protected

Local mapping of playerId to player faction info.

◆ m_mPendingLimitUpdates

ref map<FactionKey, int> SCR_FactionManager.m_mPendingLimitUpdates
protected

◆ m_OnFactionTaskEnabledChanged

ref ScriptInvokerFaction SCR_FactionManager.m_OnFactionTaskEnabledChanged
protected

◆ m_OnPlayerFactionChanged

ref ScriptInvokerBase<SCR_FactionManager_PlayerFactionChanged> SCR_FactionManager.m_OnPlayerFactionChanged
protected

◆ m_PlayerCount

ref map<int, int> SCR_FactionManager.m_PlayerCount = new map<int, int>()
protected

Mapping of faction id : player count.

◆ m_PreviousPlayerFactions

ref map<int, int> SCR_FactionManager.m_PreviousPlayerFactions = new map<int, int>()
protected

Map of previous players <playerId : factionIndex>.

◆ m_SortedFactions

ref SCR_SortedArray<SCR_Faction> SCR_FactionManager.m_SortedFactions = new SCR_SortedArray<SCR_Faction>()
protected

◆ s_OnPlayerFactionCountChanged

ref ScriptInvoker SCR_FactionManager.s_OnPlayerFactionCountChanged = new ScriptInvoker()
protected

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