Table of Contents

Class ActorExtensions

Namespace
SkyrimForge.Game
Assembly
SkyrimForge.Game.dll

Provides extension members for IActor.

public static class ActorExtensions
Inheritance
ActorExtensions
Inherited Members

Methods

ForceActorValue<TActor>(TActor, ActorValue, float)

Changes the permanent modifier of actorValue so that its current value is value, as Papyrus's ForceActorValue does.

public static void ForceActorValue<TActor>(this TActor actor, ActorValue actorValue, float value) where TActor : notnull, IActor

Parameters

actor TActor
actorValue ActorValue
value float

Type Parameters

TActor

Remarks

Call on the game's thread.

Exceptions

ArgumentOutOfRangeException

actorValue is not a value the game describes, or the game forbids scripts to change it.

GetActorValuePercentage<TActor>(TActor, ActorValue)

The current value of actorValue as a fraction of its permanent value, as Papyrus's GetActorValuePercentage returns it.

public static float GetActorValuePercentage<TActor>(this TActor actor, ActorValue actorValue) where TActor : notnull, IActor

Parameters

actor TActor
actorValue ActorValue

Returns

float

The fraction, or 1 where the permanent value is zero.

Type Parameters

TActor

Remarks

Call on the game's thread.

GetActorValue<TActor>(TActor, ActorValue)

The current value of actorValue, as Papyrus's GetActorValue returns it.

public static float GetActorValue<TActor>(this TActor actor, ActorValue actorValue) where TActor : notnull, IActor

Parameters

actor TActor
actorValue ActorValue

Returns

float

Type Parameters

TActor

Remarks

A disabled actor returns its base record's value, as Papyrus does. Call on the game's thread.

GetFactionRank<TActor>(TActor, Faction)

The actor's rank in faction, as Papyrus's GetFactionRank returns it.

public static int GetFactionRank<TActor>(this TActor actor, Faction faction) where TActor : notnull, IActor

Parameters

actor TActor
faction Faction

Returns

int

Type Parameters

TActor

Remarks

Call on the game's thread.

HasLOS<TActor, TOther>(TActor, TOther)

Whether the actor has a line of sight to other, as Papyrus's HasLOS returns it.

public static bool HasLOS<TActor, TOther>(this TActor actor, TOther other) where TActor : notnull, IActor where TOther : notnull, IObjectReference

Parameters

actor TActor
other TOther

Returns

bool

Type Parameters

TActor
TOther

Remarks

Call on the game's thread.

Exceptions

ArgumentException

The actor is not the player and other is no actor, where Papyrus logs an error and returns false.

HasMagicEffect<TActor>(TActor, MagicEffect)

Whether effect is active on the actor, as Papyrus's HasMagicEffect returns it.

public static bool HasMagicEffect<TActor>(this TActor actor, MagicEffect effect) where TActor : notnull, IActor

Parameters

actor TActor
effect MagicEffect

Returns

bool

Type Parameters

TActor

Remarks

Call on the game's thread.

HasParentRelationship<TActor, TOther>(TActor, TOther)

Whether the actor's base record is the parent in a relationship with other's, as Papyrus's HasParentRelationship returns it.

public static bool HasParentRelationship<TActor, TOther>(this TActor actor, TOther other) where TActor : notnull, IActor where TOther : notnull, IActor

Parameters

actor TActor
other TOther

Returns

bool

Type Parameters

TActor
TOther

Remarks

Call on the game's thread.

IsDetectedBy<TActor, TOther>(TActor, TOther)

Whether other detects the actor, as Papyrus's IsDetectedBy returns it.

public static bool IsDetectedBy<TActor, TOther>(this TActor actor, TOther other) where TActor : notnull, IActor where TOther : notnull, IActor

Parameters

actor TActor
other TOther

Returns

bool

False where either actor has no AI process.

Type Parameters

TActor
TOther

Remarks

Call on the game's thread.

LaunchSpellFromAim<TActor, TSpell>(TActor, TSpell)

Launches spell from the actor's aim.

public static Projectile? LaunchSpellFromAim<TActor, TSpell>(this TActor actor, TSpell spell) where TActor : notnull, IActor where TSpell : notnull, ISpell

Parameters

actor TActor
spell TSpell

Returns

Projectile?

The projectile or null where the game created none.

Type Parameters

TActor
TSpell

Remarks

The projectile starts at the height the game uses for an actor whose skeleton has no fire node. Call on the game's thread.

ModActorValue<TActor>(TActor, ActorValue, float)

Adds amount to the permanent modifier of actorValue, as Papyrus's ModActorValue does.

public static void ModActorValue<TActor>(this TActor actor, ActorValue actorValue, float amount) where TActor : notnull, IActor

Parameters

actor TActor
actorValue ActorValue
amount float

Type Parameters

TActor

Remarks

The base value is unchanged, and a save records the modifier. Call on the game's thread.

OpenInventory<TActor>(TActor, bool)

Opens the actor's inventory in the container menu, as Papyrus's OpenInventory does.

public static void OpenInventory<TActor>(this TActor actor, bool forceOpen = false) where TActor : notnull, IActor

Parameters

actor TActor
forceOpen bool

Whether the inventory opens for an actor that is not the player's teammate.

Type Parameters

TActor

Remarks

Call on the game's thread.

ResetAI<TActor>(TActor)

Evaluates the actor's package again and resets its AI, as Papyrus's ResetAI does.

public static void ResetAI<TActor>(this TActor actor) where TActor : notnull, IActor

Parameters

actor TActor

Type Parameters

TActor

Remarks

A deleted or disabled actor is unchanged. Call on the game's thread.

RestoreDamage<TActor>(TActor, ActorValue, float)

Restores up to amount of the damage to actorValue, as Papyrus's RestoreActorValue does.

public static void RestoreDamage<TActor>(this TActor actor, ActorValue actorValue, float amount) where TActor : notnull, IActor

Parameters

actor TActor
actorValue ActorValue
amount float

Type Parameters

TActor

Remarks

The sign of amount is ignored. An actor value without damage is unchanged. An inverted actor value's damage modifier is lowered by the amount whether or not it has damage. The RestoreActorValue member of ActorValueOwner changes the damage modifier unconditionally. Call on the game's thread.

Exceptions

ArgumentOutOfRangeException

actorValue is not a value the game describes, or the game forbids scripts to change it.

SendTrespassAlarm<TActor, TCriminal>(TActor, TCriminal)

Raises a trespass alarm against criminal on the actor's behalf, as Papyrus's SendTrespassAlarm does.

public static void SendTrespassAlarm<TActor, TCriminal>(this TActor actor, TCriminal criminal) where TActor : notnull, IActor where TCriminal : notnull, IActor

Parameters

actor TActor
criminal TCriminal

Type Parameters

TActor
TCriminal

Remarks

Call on the game's thread.

SetActorValue<TActor>(TActor, ActorValue, float)

Sets the value of actorValue, as Papyrus's SetActorValue does.

public static void SetActorValue<TActor>(this TActor actor, ActorValue actorValue, float value) where TActor : notnull, IActor

Parameters

actor TActor
actorValue ActorValue
value float

Type Parameters

TActor

Remarks

Call on the game's thread.

Exceptions

ArgumentOutOfRangeException

actorValue is not a value the game describes, or it is an enumeration and value is not one of its values.

SetExpressionOverride<TActor>(TActor, int, int)

Sets the actor's facial expression to mood at strength, as Papyrus's SetExpressionOverride does.

public static void SetExpressionOverride<TActor>(this TActor actor, int mood, int strength = 100) where TActor : notnull, IActor

Parameters

actor TActor
mood int

The mood, from 1 to 16.

strength int

The strength in percent, from 0 to 100. A greater or negative value reads as 100, as it does in Papyrus.

Type Parameters

TActor

Remarks

An actor without face animation data is unchanged. Call on the game's thread.

Exceptions

ArgumentOutOfRangeException

mood is outside 1 to 16, the moods the game accepts.

SetOutfit<TActor>(TActor, Outfit)

Gives the actor's base record outfit as its default outfit and dresses the actor in it, as Papyrus's SetOutfit does.

public static void SetOutfit<TActor>(this TActor actor, Outfit outfit) where TActor : notnull, IActor

Parameters

actor TActor
outfit Outfit

Type Parameters

TActor

Remarks

An outfit the record already has changes nothing, and a disabled actor's record changes without the actor being dressed. Call on the game's thread.