|
Arma Reforger Script API
|
Public Member Functions | |
| ScriptInvoker | GetOnPlayerFactionCountChanged () |
| ScriptInvokerBase< SCR_FactionManager_PlayerFactionChanged > | GetOnPlayerFactionChanged_S () |
| return Script invoker on player faction changed (Server only) | |
| 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. | |
| SCR_RankID | GetRankByID (SCR_ECharacterRank rankID) |
| array< ref SCR_RankID > | GetAllAvailableRanks () |
| bool | IsRankRenegade (SCR_ECharacterRank rankID) |
| int | GetRequiredRankXP (SCR_ECharacterRank rankID) |
| SCR_ECharacterRank | GetRankByXP (int XP) |
| SCR_ECharacterRank | GetRankNext (SCR_ECharacterRank rank) |
| SCR_ECharacterRank | GetRankPrev (SCR_ECharacterRank rank) |
| override void | EOnInit (IEntity owner) |
| void | SCR_FactionManager (IEntitySource src, IEntity parent) |
| void | ~SCR_FactionManager () |
| bool | CanChangeFactionsPlayable () |
| Check if the faction is playable. | |
| 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 | 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 | 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 | 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. | |
| SCR_ECharacterRank | GetRenegadeRank () |
| void | OnPlayerDisconnected (int playerId, KickCauseCode cause, int timeout) |
| Authority: Handle disconnected player. | |
Protected Attributes | |
| bool | m_bCanChangeFactionsPlayable |
| ref array< ref SCR_RankID > | m_aRanks |
| ref SCR_SortedArray< SCR_Faction > | m_SortedFactions = new SCR_SortedArray<SCR_Faction>() |
| ref map< string, ref array< string > > | m_aAncestors = new map<string, ref array<string>>() |
| ref array< ref SCR_PlayerFactionInfo > | m_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_PlayerFactionInfo > | m_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 ScriptInvokerBase< SCR_FactionManager_PlayerFactionChanged > | m_OnPlayerFactionChanged_S |
| void SCR_FactionManager.SCR_FactionManager | ( | IEntitySource | src, |
| IEntity | parent ) |
| [in] | src | |
| [in] | parent |
| void SCR_FactionManager.~SCR_FactionManager | ( | ) |
| bool SCR_FactionManager.CanChangeFactionsPlayable | ( | ) |
Check if the faction is playable.
Non-playable factions will not appear in the respawn menu.
| override void SCR_FactionManager.EOnInit | ( | IEntity | owner | ) |
| array< ref SCR_RankID > SCR_FactionManager.GetAllAvailableRanks | ( | ) |
| int SCR_FactionManager.GetFactionPlayerCount | ( | Faction | faction | ) |
Returns current count of players assigned to the provided faction.
| [in] | faction |
| Faction SCR_FactionManager.GetLocalPlayerFaction | ( | ) |
Return affiliated faction of local player.
| Exception | if no FactionManager is present in the world. |
| ScriptInvokerBase< SCR_FactionManager_PlayerFactionChanged > SCR_FactionManager.GetOnPlayerFactionChanged_S | ( | ) |
return Script invoker on player faction changed (Server only)
| ScriptInvoker SCR_FactionManager.GetOnPlayerFactionCountChanged | ( | ) |
| Faction SCR_FactionManager.GetPlayerFaction | ( | int | playerId | ) |
Return affiliated faction of provided player by their id.
| [in] | playerId | Id of target player corresponding to PlayerController/PlayerManager player id. |
| Exception | if no FactionManager is present in the world. |
| SCR_RankID SCR_FactionManager.GetRankByID | ( | SCR_ECharacterRank | rankID | ) |
| [in] | rankID |
| SCR_ECharacterRank SCR_FactionManager.GetRankByXP | ( | int | XP | ) |
| [in] | XP |
| SCR_ECharacterRank SCR_FactionManager.GetRankNext | ( | SCR_ECharacterRank | rank | ) |
| [in] | rank |
| SCR_ECharacterRank SCR_FactionManager.GetRankPrev | ( | SCR_ECharacterRank | rank | ) |
| [in] | rank |
|
protected |
| int SCR_FactionManager.GetRequiredRankXP | ( | SCR_ECharacterRank | rankID | ) |
| [in] | rankID |
| int SCR_FactionManager.GetSortedFactionsList | ( | out notnull SCR_SortedArray< SCR_Faction > | outFactions | ) |
Get factions sorted according to their own custom order.
| [out] | outFactions | Array to be filled with factions |
| bool SCR_FactionManager.IsRankRenegade | ( | SCR_ECharacterRank | rankID | ) |
| [in] | rankID |
|
protected |
Authority: Handle disconnected player.
| [in] | playerId | |
| [in] | cause | |
| [in] | timeout |
|
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.
| [in] | faction | The faction for which affiliated player count changed. |
| [in] | newCount | The new number of players that are part of this faction. |
|
protected |
Update local player faction mapping.
|
protected |
Authority: Event raised when provided player component has a faction set.
|
static |
Update all AI perception.
Used when faction friendly is changed to make sure AI in the area attack or stop attacking each other
| 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.
| [in] | factionA | faction to set friendly to factionB |
| [in] | factionB | faction to set friendly to factionA |
| [in] | playerChanged | id of player who changed it to show notification. Leave -1 to not show notification |
| [in] | updateAIs | If 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) |
| 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.
| [in] | factionA | faction to set hostile to factionB |
| [in] | factionB | faction to set hostile to factionA |
| [in] | playerChanged | id of player who changed it to show notification. Leave -1 to not show notification |
| [in] | updateAIs | If 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) |
|
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.
| Exception | if no FactionManager is present in the world. |
| [in] | faction |
|
static |
Return affiliated faction of local player.
Static variant of SCR_FactionManager.GetLocalPlayerFaction that uses registered FactionManager from the ArmaReforgerScripted game instance.
| Exception | if no FactionManager is present in the world. |
|
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.
| [in] | playerId | Id of target player corresponding to PlayerController/PlayerManager player id. |
| Exception | if no FactionManager is present in the world. |
| void SCR_FactionManager.UpdatePlayerFaction_S | ( | SCR_PlayerFactionAffiliationComponent | playerFactionComponent | ) |
Authority: Update player faction info for target player with their up-to-date state.
| [in] | playerFactionComponent |
|
protected |
|
protected |
List of all player faction infos in no particular order. Maintained by the authority.
|
protected |
|
protected |
|
protected |
List of indices of factions whose count has changed since last update.
|
protected |
Local mapping of playerId to player faction info.
|
protected |
|
protected |
Mapping of faction id : player count.
|
protected |
Map of previous players <playerId : factionIndex>.
|
protected |
|
protected |