Faction
constFaction:object
Defined in: server/api.d.ts:2004
How the game’s factions react to each other, on every client. Combined with Player.setFactionRank it decides who the game treats as friend or foe: NPCs, turrets and companions alike.
Type Declaration
Section titled “Type Declaration”clearReaction()
Section titled “clearReaction()”clearReaction(
faction,other,mutual?):boolean
Gives a reaction back to the game’s data files on every client.
Parameters
Section titled “Parameters”faction
Section titled “faction”string | number
A TESFaction form ID, as a number or hex string.
string | number
The faction it reacts to, as a number or hex string.
mutual?
Section titled “mutual?”boolean
Both directions, as Faction.SetAlly and Faction.SetEnemy do; true when left out.
Returns
Section titled “Returns”boolean
True when one was overridden.
getReaction()
Section titled “getReaction()”getReaction(
faction,other):"neutral"|"enemy"|"ally"|"friend"|null
How one faction reacts to another, where the server overrides it.
Parameters
Section titled “Parameters”faction
Section titled “faction”string | number
A TESFaction form ID, as a number or hex string.
string | number
The faction it reacts to, as a number or hex string.
Returns
Section titled “Returns”"neutral" | "enemy" | "ally" | "friend" | null
The reaction; null when the game’s data files decide.
setReaction()
Section titled “setReaction()”setReaction(
faction,other,reaction,mutual?):boolean
Overrides how one faction reacts to another on every client, as Faction.SetAlly and Faction.SetEnemy do, until it is cleared or the server stops. A faction can be its own enemy. Up to 64 directions are overridden at once.
Parameters
Section titled “Parameters”faction
Section titled “faction”string | number
A TESFaction form ID, as a number or hex string.
string | number
The faction it reacts to, as a number or hex string.
reaction
Section titled “reaction”"neutral" | "enemy" | "ally" | "friend"
Enemies fight on sight; allies and friends help each other, friends also in combat.
mutual?
Section titled “mutual?”boolean
Both directions, as Faction.SetAlly and Faction.SetEnemy do; true when left out.
Returns
Section titled “Returns”boolean
True when set; false when the table is full.