Difference between revisions of "Actor Script"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>SniffleMan
(updated EquipItemEx description)
m (Spelling error 'abSlient' changed to 'abSilent')
 
(One intermediate revision by one other user not shown)
Line 91: Line 91:
*Removes the actor from a Deferred Kill state.
*Removes the actor from a Deferred Kill state.


'''[[EquipItem - Actor|EquipItem]](Form ''akItem'', Bool ''abPreventRemoval'', Bool ''abSlient'')'''
'''[[EquipItem - Actor|EquipItem]](Form ''akItem'', Bool ''abPreventRemoval'', Bool ''abSilent'')'''
*Equips the specified item on this actor.
*Equips the specified item on this actor.


Line 618: Line 618:


'''[[EquipItemById - Actor|EquipItemById]](Form ''item'', Int ''itemId'', Int ''equipSlot'', Bool ''preventUnequip'', Bool ''equipSound'')'''
'''[[EquipItemById - Actor|EquipItemById]](Form ''item'', Int ''itemId'', Int ''equipSlot'', Bool ''preventUnequip'', Bool ''equipSound'')'''
*Force equips the item with the specified FormID to the specified slot.
*Forces this actor to equip the specified item to the specified slot.


'''[[UnequipItemEx - Actor|UnequipItemEx]](Form ''item'', Int ''equipSlot'', Bool ''preventEquip'')'''
'''[[UnequipItemEx - Actor|UnequipItemEx]](Form ''item'', Int ''equipSlot'', Bool ''preventEquip'')'''

Latest revision as of 14:22, 24 February 2024


Extends: ObjectReference Script

Script for the manipulation of actor instances.

Definition[edit | edit source]

ScriptName Actor extends ObjectReference

Properties[edit | edit source]

None

Global Functions[edit | edit source]

None

Member Functions[edit | edit source]

AddPerk(Perk akPerk)

  • Adds the specified perk to this actor.

Bool AddShout(Shout akShout)

  • Adds the specified shout to this actor.

Bool AddSpell(Spell akSpell, Bool abVerbose)

  • Adds the specified spell to this actor.

AddToFaction(Faction akFaction)

  • Adds the actor to the specified faction at rank 0. If the Actor is already in the given faction, this function does nothing.

AllowBleedoutDialogue(Bool abCanTalk)

  • Flags this actor as able to speak to the player when he is in bleed out and is essential down

AllowPCDialogue(Bool abTalk)

  • Enables or disables the player's ability to talk to this actor.

AttachAshPile(Form akAshPileBase)

  • Attaches an "ash pile" to this actor using the passed-in form (or leveled item list) as a base.

Bool CanFlyHere()

  • Can this actor fly here?

ClearArrested()

  • Clears this actor's arrested state.

ClearExpressionOverride()

  • Clears any expression override on this actor.

ClearExtraArrows()

  • Clears any arrow 3d on the actor.

ClearForcedLandingMarker()

  • Clears any forced landing marker on this actor.

ClearKeepOffsetFromActor()

  • Clears any keep offset from this actor.

ClearLookAt()

  • Clears this actor's script-forced look at target.

DamageActorValue(String asValueName, Float afDamage)

  • Damages the specified actor value by the specified amount.

DamageAV(String asValueName, Float afDamage)

  • Alias for DamageActorValue().

Bool Dismount()

  • Forces the actor to dismount.

DispelAllSpells()

  • Dispel all spell from this actor

Bool DispelSpell(Spell akSpell)

  • Dispel a spell from this actor

DoCombatSpellApply(Spell akSpell, ObjectReference akTarget)

  • Apply a spell to a target in combat

DrawWeapon()

  • Forces this actor to draw his weapon

EnableAI(Bool abEnable)

  • Enables or disables this actor's AI.

EndDeferredKill()

  • Removes the actor from a Deferred Kill state.

EquipItem(Form akItem, Bool abPreventRemoval, Bool abSilent)

  • Equips the specified item on this actor.

EquipShout(Shout akShout)

  • Forces this actor to equip this shout.

EquipSpell(Spell akSpell, Int aiSource)

  • Forces this actor to equip thes spell, in the specified source.

EvaluatePackage()

  • Forces the AI to re-evaluate its package stack.

ForceActorValue(String asValueName, Float afNewValue)

  • Forces the specified actor value to the specified value.

ForceAV(String asValueName, Float afNewValue)

  • Alias for ForceActorValue().

ActorBase GetActorBase()

  • Returns the base actor object for this actor.

Float GetActorValue(String asValueName)

  • Retrieves the specified actor value from the actor.

Float GetActorValuePercentage(String asValueName)

  • Retrieves the specified actor value from the actor as a percentage of its maximum value. (From 0 to 1)

Float GetAV(String asValueName)

  • Alias for GetActorValue().

Float GetAVPercentage(String asValueName)

  • Alias for GetActorValuePercentage().

Float GetBaseActorValue(String asValueName)

  • Gets the base value of the specified actor value.

Float GetBaseAV(String asValueName)

  • Alias for GetBaseActorValue().

Int GetBribeAmount()

  • Returns the amount of gold required to bribe this actor.

Faction GetCrimeFaction()

  • Obtains this actor's crime faction.

Int GetCombatState()

  • Obtains this actor's current combat state.

Actor GetCombatTarget()

  • Obtains this actor's current combat target.

Package GetCurrentPackage()

  • Obtains the current package this actor's AI is running.

Actor GetDialogueTarget()

  • Obtains the actor's current dialogue target

Int GetEquippedItemType(Int aiHand)

  • Obtains the type of item equipped in the specified hand.

Armor GetEquippedShield()

  • Obtains the currently equipped shield on this actor.

Shout GetEquippedShout()

  • Obtains the currently equipped shout on this actor.

Spell GetEquippedSpell(Int aiSource)

  • Obtains the currently equipped spell in the specified source on this actor.

Weapon GetEquippedWeapon(Bool abLeftHand)

  • Obtains the currently equipped weapon on this actor.

Int GetFactionRank(Faction akFaction)

  • Retrieves this actor's rank in the specified faction.

Int GetFactionReaction(Actor akOther)

  • Obtains this actor's faction-based reaction to the other actor.

Int GetFlyingState()

  • Obtains this actor's current flying state.

ObjectReference GetForcedLandingMarker()

  • Obtains the landing marker the actor is forced to land at (if any).

Int GetGoldAmount()

  • Gets the amount of gold this actor has on his person.

Int GetHighestRelationshipRank()

  • Gets this actor's highest relationship rank.

Actor GetKiller()

  • Gets this actor's killer. Returns None if this actor isn't dead.

Int GetLevel()

  • Gets this actor's current level.

ActorBase GetLeveledActorBase()

  • Returns a leveled actor's "temporary" base object.

Float GetLightLevel()

  • Returns this actor's current light level

Int GetLowestRelationshipRank()

  • Gets this actor's lowest relationship rank.

Bool GetNoBleedoutRecovery()

  • Gets whether this actor can recover from bleedout or not.

Bool GetPlayerControls()

  • Queries whether this actor receives player input

Race GetRace()

  • Returns this actor's race.

Int GetRelationshipRank(Actor akOther)

  • Retrieves the relationship rank between this actor and another.

Int GetSitState()

  • Obtains this actor's sit state.

Int GetSleepState()

  • Obtains this actor's sleep state.

Float GetVoiceRecoveryTime()

  • Gets the voice recovery time from the actor.

Bool HasAssociation(AssociationType akAssociation, Actor akOther)

  • Returns whether this actor has the specified association with the other actor.

Bool HasFamilyRelationship(Actor akOther)

  • Returns whether this actor has a family relationship with the other actor.

Bool HasLOS(ObjectReference akOther)

  • Checks to see if this actor has line-of-sight to another. (Only the player can do a LOS check to a non-actor)

Bool HasMagicEffect(MagicEffect akEffect)

  • Checks to see if this actor is currently being affected by the given Magic Effect

Bool HasMagicEffectWithKeyword(Keyword akKeyword)

  • Checks to see if this actor is currently being affected by a Magic Effect with the given Keyword

Bool HasParentRelationship(Actor akOther)

  • Returns whether this actor has a parent relationship with the other actor.

Bool HasPerk(Perk akPerk)

  • Checks to see if this actor has the given Perk

Bool HasSpell(Form akForm)

  • Checks to see if this actor has the given Spell or Shout

Bool IsAlarmed()

  • Obtains whether this actor is alarmed or not.

Bool IsAlerted()

  • Returns if this actor is alerted or not.

Bool IsAllowedToFly()

  • Is this actor allowed to fly?

Bool IsArrested()

  • Returns whether this actor is currently arrested or not.

Bool IsArrestingTarget()

  • Is this actor currently arresting his target? Only valid on alerted guards.

Bool IsBeingRidden()

  • Is this actor being ridden?

Bool IsBleedingOut()

  • Is this actor currently bleeding out?

Bool IsBribed()

  • Gets if this actor has been bribed by the player.

Bool IsChild()

  • Is this actor a child?

Bool IsCommandedActor()

  • Is this actor commanded by another?

Bool IsDead()

  • Obtains whether this actor is dead or not.

Bool IsDetectedBy(Actor akOther)

  • Is this actor detected by the other one?

Bool IsDoingFavor()

  • Is this actor currently flagged as doing a favor for the player?

Bool IsEquipped(Form akItem)

  • Is the specified object equipped on this actor?

Bool IsEssential()

  • Is this actor essential?

Bool IsFlying()

  • Is this actor currently flying?

Bool IsGhost()

  • Is this actor flagged as a ghost?

Bool IsGuard()

  • Obtains whether this actor is a guard or not.

Bool IsHostileToActor-(Actor akActor)

  • Is this actor hostile to another actor?

Bool IsInCombat()

  • Obtains whether this actor is in combat or not.

Bool IsInFaction(Faction akFaction)

  • Returns whether this actor is in the specified faction.

Bool IsInKillMove()

  • Returns whether this actor is in a kill move or not.

Bool IsIntimidated()

  • Gets if this actor has been intimidated by the player.

Bool IsOnMount()

  • Is the actor on a mount?

Bool IsPlayersLastRiddenHorse()

  • Returns whether this actor is the horse the player last rode.

Bool IsPlayerTeammate()

  • Returns whether this actor is currently a teammate of the player.

Bool IsRunning()

  • Returns whether this actor is current running.

Bool IsSneaking()

  • Is this actor currently sneaking?

Bool IsSprinting()

  • Is this actor currently sprinting?

Bool IsTrespassing()

  • Returns whether this actor is currently trespassing or not.

Bool IsUnconscious()

  • Is this actor currently unconscious?

Bool IsWeaponDrawn()

  • Does this actor have his equipped weapon and/or magic spell drawn?

KeepOffsetFromActor(Actor arTarget, Float afOffsetX, Float afOffsetY, Float afOffsetZ, Float afOffsetAngleX, Float afOffsetAngleY, Float afOffsetAngleZ, Float afCatchUpRadius, Float afFollowRadius)

  • Makes the actor switch to a state where it will try to keep a given offset from another actor

Kill(Actor akKiller)

  • Kills this actor with the specified actor as the guilty party.

KillEssential(Actor akKiller)

  • Kills this actor, even if he is essential.

KillSilent(Actor akKiller)

  • Kills this actor without a kill event with the killer being the guilty party

MakePlayerFriend()

  • Makes the actor a friend of the player.

ModActorValue(String asValueName, Float afAmount)

  • Modifies the specified actor value by the specified amount.

ModAV(String asValueName, Float afAmount)

  • Alias for ModActorValue]]().

ModFactionRank(Faction akFaction, Int aiMod)

  • Modifies this actor's rank in the specified faction.

MoveToPackageLocation()

  • Pops this actor to the initial location for its current package.

OpenInventory(Bool abForceOpen)

  • Opens this actor's inventory as if you were pick-pocketing them.

Bool PathToReference(ObjectReference aTarget, Float afWalkRunPercent)

  • Makes the actor path to the target reference at the speed given by afWalkRunercent.

Bool PlayIdle(Idle akIdle)

  • Plays the passed idle on this actor.

Bool PlayIdleWithTarget(Idle akIdle, ObjectReference akTarget)

  • Plays the passed idle on this actor, overriding the actor's current target with the one given.

PlaySubGraphAnimation-(String asEventName)

  • Sends the event passed to the actor's sub graphs.

RemoveFromFaction(Faction akFaction)

  • Removes this actor from the specified faction.

RemoveFromAllFactions()

  • Removes this actor from all factions they are associated with.

RemovePerk(Perk akPerk)

  • Removes the specified perk from this actor.

Bool RemoveShout(Shout akShout)

  • Removes the specified shout from this actor.

Bool RemoveSpell(Spell akSpell)

  • Removes the specified spell from this actor.

ResetHealthAndLimbs()

  • Resets this actor's health and limb state.

RestoreActorValue(String asValueName, Float afAmount)

  • Restores damage done to the specified actor value.

RestoreAV(String asValueName, Float afAmount)

  • Alias for RestoreActorValue().

Resurrect()

  • Resurrects this actor.

SendAssaultAlarm()

  • Has this actor behave as if they were assaulted.

SendTrespassAlarm(Actor akCriminal)

  • Has this actor behave as if they caught the criminal trespassing

SetActorValue(String asValueName, Float afValue)

  • Sets the specified actor value on the actor to the passed-in value.

SetAlert(Bool abAlerted)

  • Flags this actor as currently alerted (or clears it)

SetAllowFlying(Bool abAllowed)

  • Flags this actor as whether they are allowed to fly or not (lands them if they are flying and not allowed to)

SetAllowFlyingEx(Bool abAllowed, Bool abAllowCrash, Bool abAllowSearch)

  • Sets whether this actor is allowed to fly or not. If not, and they are flying, will land the actor.

SetAlpha(Float afTargetAlpha, Bool abFade)

  • Sets this actor's alpha - optionally fading to that value rather then popping.

SetAttackActorOnSight(Bool abAttackOnSight)

  • Flags this actor to be attacked by all actors when detected.

SetAV(String asValueName, Float afValue)

  • Alias for SetActorValue().

SetBribed(Bool abBribe)

  • Sets if this actor is being bribed by the player.

SetCrimeFaction(Faction akFaction)

  • Sets the faction that this actor reports crimes to.

SetCriticalStage(Int aiStage)

  • Sets this actor's current critical stage (applying any related effects)

SetDoingFavor(Bool abDoingFavor)

  • Flags this actor as doing a favor for the player.

SetDontMove(Bool abDontMove)

  • Flags/unflags this actor as "don't move".

SetExpressionOverride(Int aiMood, Int aiStrength)

  • Sets an expression override on this actor.

SetEyeTexture(TextureSet akTexture)

  • Forces a new eye texture on the actor.

SetFactionRank(Faction akFaction, Int aiRank)

  • Sets this actor's rank in the specified faction, adding it to the faction if necessary.

SetForcedLandingMarker(ObjectReference aMarker)

  • Forces the landing marker for this actor to the passed-in one.

SetGhost(Bool abIsGhost)

  • Sets this actor as a ghost or not.

SetHeadTracking(Bool abEnable)

  • Enables or disables this actor's head tracking.

SetIntimidated(Bool abIntimidate)

  • Sets if this actor is being intimidated by the player.

SetLookAt(ObjectReference akTarget, Bool abPathingLookAt)

  • Sets this actor's look at target, optionally using it for pathing as well.

SetNoBleedoutRecovery(Bool abAllowed)

  • Sets or clears the "no bleedout recovery" flag on this actor.

SetNotShowOnStealthMeter(Bool abNotShow)

  • Sets this actor to not effect the detection level on the stealth meter if he is not hostile to the player

SetOutfit(Outfit akOutfit, Bool abSleepOutfit)

  • Change the default or sleep outfit and queue the models to be worn now.

SetPlayerControls(Bool abControls)

  • Set/reset whether player input being sent to the actor.

SetPlayerResistingArrest()

  • Flags the player as resisting arrest from this actor's faction.

SetPlayerTeammate(Bool abTeammate, Bool abCanDoFavor)

  • Sets (or clears) this actor as a teammate of the player and if the teammate can do favors.

SetRace(Race akRace)

  • Sets the actor's race

SetRelationshipRank(Actor akOther, Int aiRank)

  • Sets the relationship rank between this actor and another.

SetRestrained(Bool abRestrained)

  • Flags this actor as restrained or not.

SetSubGraphFloatVariable(String asVariableName, Float afValue)

  • Set a variable on all of an actor's sub graphs.

SetUnconscious(Bool abIsUnconscious)

  • Sets this actor as unconscious or not.

SetVehicle(ObjectReference akVehicle)

  • Attaches or detaches this actor from a vehicle.

SetVoiceRecoveryTime(Float afTime)

  • Sets the voice recovery time on the actor.

ShowBarterMenu()

  • Shows the barter menu for this actor.

ShowGiftMenu()

  • Shows the give/take menu for this actor.

StartCannibal(Actor akTarget)

  • Has the actor feed on a dead actor.

StartCombat(Actor akTarget)

  • Attempts to initiate combat with the other actor.

StartDeferredKill()

  • Puts the actor into a Deferred Kill state

StartSneaking()

  • Forces this actor to start sneaking.

StartVampireFeed(Actor akTarget)

  • Has the actor vampire feed on a sleeping actor

StopCombat()

  • Removes this actor from combat.

StopCombatAlarm()

  • Stops all combat and alarms against this actor.

Bool TrapSoul(Actor akTarget)

  • Attempts to soul trap the target actor - and returns if it succeeded or not.

UnequipAll()

  • Unequips all items from this actor.

UnequipItem(Form akItem, Bool abPreventEquip, Bool abSilent)

  • Unequips an item from this actor.

UnequipItemSlot(Int aiSlot)

  • Forces this actor to unequip all armor on the given slot.

UnequipShout(Shout akShout)

  • Unequips the specified shout from this actor.

UnequipSpell(Spell akSpell, Int aiSource)

  • Unequips the specified spell from the specified source on this actor.

UnlockOwnedDoorsInCell()

  • Has this actor unlock any doors he owns in the cell he's currently in (if it is an interior).

Bool WillIntimidateSucceed()

  • Returns whether an intimidation attempt by the player against this actor will succeed or not.

Bool WornHasKeyword(Keyword akKeyword)

  • Returns whether or not this actor is wearing anything with the specified keyword.

Special Edition Exclusive Functions[edit | edit source]

Bool IsOverEncumbered()

  • Is the actor currently over-encumbered?

Float GetActorValueMax(String asValueName)

  • Retrieves the specified actor value's maximum value - taking into account buffs and debuffs.

Float GetAVMax(String asValueName)

  • Alias for GetActorValueMax().

Armor GetEquippedArmorInSlot(Int aiSlot)

  • Obtain the armor currently equipped in the specified slot.

Float GetWarmthRating()

  • Obtains the total "warmth rating" for the actor

SendLycanthropyStateChanged(Bool abIsWerewolf)

  • Tells anyone who cares that the lycanthropy state of this actor has changed

SendVampirismStateChanged(bool abIsVampire)

  • Tells anyone who cares that the vampirism state of this actor has changed

SKSE Member Functions[edit | edit source]

Form GetWornForm(Int slotMask)

  • Returns the form of the item worn with the specified slotMask.

Int GetWornFormId(Int slotMask)

  • Returns the formID of the item worn with the specified slotMask.

Form GetEquippedObject(Int location)

  • Returns the object currently equipped in the specified location.

Int GetEquippedItemId(Int location)

  • Returns the FormID of the currently equipped object in the specified location.

Int GetSpellCount()

  • Returns the number of added spells for the actor.

Spell GetNthSpell(Int n)

  • Returns the specified added spell for the actor.

QueueNiNodeUpdate()

  • Updates modifications linked to the actor.

RegenerateHead()

  • Updates an Actors head mesh.

EquipItemEx(Form item, Int equipSlot, Bool preventUnequip, Bool equipSound)

  • Forces this actor to equip the first item in the specified form's extralist to the specified slot.

EquipItemById(Form item, Int itemId, Int equipSlot, Bool preventUnequip, Bool equipSound)

  • Forces this actor to equip the specified item to the specified slot.

UnequipItemEx(Form item, Int equipSlot, Bool preventEquip)

  • Force unequips the specified item at the specified slot.

ChangeHeadPart(HeadPart hPart)

  • Adds a headpart, if the type exists it will replace.

ReplaceHeadPart(HeadPart oPart, HeadPart newPart)

  • Replaces a headpart on the loaded mesh. This does not affect the ActorBase, both old an new headparts must exist and be of the same type.

UpdateWeight(Float neckDelta)

  • Visually updates the actors weight.

Bool IsAIEnabled()

  • Returns whether the actors AI is enabled

Bool IsSwimming()

  • Returns whether the actor is currently swimming.

SheatheWeapon()

  • Sheathes the actors weapon.

Faction[] GetFactions(int minRank, int maxRank)

  • Returns all factions with the specified min and max ranks (-128 to 127)

Events[edit | edit source]

OnCombatStateChanged(Actor akTarget, Int aeCombatState)

  • Sent when this actor's combat state changes.

OnDeath(Actor akKiller)

  • Event received when this actor dies.

OnDying(Actor akKiller)

  • Event received when this actor begins to die.

OnEnterBleedout()

  • Event received when this object enters bleedout.

OnGetUp(ObjectReference akFurniture)

  • Event received when this actor gets up off the specified furniture.

OnLocationChange(Location akOldLoc, Location akNewLoc)

  • Event received when the actor moves from one location to another.

OnObjectEquipped(Form akBaseObject, ObjectReference akReference)

  • Event received when this actor equips an object.

OnObjectUnequipped(Form akBaseObject, ObjectReference akReference)

  • Event received when this actor unequips an object.

OnPackageChange(Package akOldPackage)

  • Event received when this actor changes away from a package.

OnPackageEnd(Package akOldPackage)

  • Event received when this actor ends a package.

OnPackageStart(Package akNewPackage)

  • Event received when this actor starts running a new package.

OnPlayerBowShot(Weapon akWeapon, Ammo akAmmo, Float afPower, Bool abSunGazing)

  • Event called when the actor is the player, and the player has fired a bow.

OnPlayerLoadGame()

  • Event received by the player actor when a saved game is loaded.

OnRaceSwitchComplete()

  • Event received when this actor finishes switching races.

OnSit(ObjectReference akFurniture)

  • Event received when this actor sits on the specified furniture.

Special Edition Exclusive Events[edit | edit source]

OnLycanthropyStateChanged(Bool abIsWerewolf)

  • Event received when the lycanthropy state of this actor changes

OnPlayerFastTravelEnd(Float afTravelGameTimeHours)

  • Event received when the player finishes fast travel.

OnVampirismStateChanged(bool abIsVampire)

  • Event received when the vampirism state of this actor changes

OnVampireFeed(Actor akTarget)

  • Event received when this actor feeds on another, as a vampire

Notes[edit | edit source]

  • You may not attach a script to an actor if that actor would be used by a leveled actor list. If an actor is used in a leveled actor list, its "Scripts" section will be disabled.
    • There is a workaround for this in cases where you need actors to be both leveled and scripted - you can create a constant/self magic effect and apply that at the race level. For example, the FXDragonBloodDamageScript handles applying some special blood FX to dragons through combat. Since dragons are used to populate leveled lists, however, this script is attached to AbFXDragonBloodDamage, which is an effect on the AbDragonBloodFX spell. That's then assigned as a special racial ability of the DragonRace. You can see a similar example in how the WispMothers work, too.