Difference between revisions of "Actor Script"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Jog
imported>Jog
Line 518: Line 518:


== Events ==
== Events ==
*Event [[OnCombatStateChanged - Actor|OnCombatStateChanged]](Actor akTarget, int aeCombatState)
'''Event [[OnCombatStateChanged - Actor|OnCombatStateChanged]](Actor akTarget, int aeCombatState)'''
**Sent when this actor's combat state changes.
*Sent when this actor's combat state changes.
*Event [[OnDeath - Actor|OnDeath]](Actor akKiller)
 
**Event received when this actor dies.
'''Event [[OnDeath - Actor|OnDeath]](Actor akKiller)'''
*Event [[OnDying - Actor|OnDying]](Actor akKiller)
*Event received when this actor dies.
**Event received when this actor begins to die.
 
*Event [[OnEnterBleedout - Actor|OnEnterBleedout]]()
'''Event [[OnDying - Actor|OnDying]](Actor akKiller)'''
**Event received when this object enters bleedout.
*Event received when this actor begins to die.
*Event [[OnGetUp - Actor|OnGetUp]](ObjectReference akFurniture)
 
**Event received when this actor gets up off the specified furniture.
'''Event [[OnEnterBleedout - Actor|OnEnterBleedout]]()'''
*Event [[OnLocationChange - Actor|OnLocationChange]](Location akOldLoc, Location akNewLoc)
*Event received when this object enters bleedout.
**Event received when the actor moves from one location to another.
 
*Event [[OnObjectEquipped - Actor|OnObjectEquipped]](Form akBaseObject, ObjectReference akReference)
'''Event [[OnGetUp - Actor|OnGetUp]](ObjectReference akFurniture)'''
**Event received when this actor equips an object.
*Event received when this actor gets up off the specified furniture.
*Event [[OnObjectUnequipped - Actor|OnObjectUnequipped]](Form akBaseObject, ObjectReference akReference)
 
**Event received when this actor unequips an object.
'''Event [[OnLocationChange - Actor|OnLocationChange]](Location akOldLoc, Location akNewLoc)'''
*Event [[OnPackageChange - Actor|OnPackageChange]](Package akOldPackage)
*Event received when the actor moves from one location to another.
**Event received when this actor changes away from a package.
 
*Event [[OnPackageEnd - Actor|OnPackageEnd]](Package akOldPackage)
'''Event [[OnObjectEquipped - Actor|OnObjectEquipped]](Form akBaseObject, ObjectReference akReference)'''
**Event received when this actor ends a package.
*Event received when this actor equips an object.
*Event [[OnPackageStart - Actor|OnPackageStart]](Package akNewPackage)
 
**Event received when this actor starts running a new package.
'''Event [[OnObjectUnequipped - Actor|OnObjectUnequipped]](Form akBaseObject, ObjectReference akReference)'''
*Event [[OnRaceSwitchComplete - Actor|OnRaceSwitchComplete]]()
*Event received when this actor unequips an object.
**Event received when this actor finishes switching races.
 
*Event [[OnSit - Actor|OnSit]](ObjectReference akFurniture)
'''Event [[OnPackageChange - Actor|OnPackageChange]](Package akOldPackage)'''
**Event received when this actor sits on the specified furniture.
*Event received when this actor changes away from a package.
 
'''Event [[OnPackageEnd - Actor|OnPackageEnd]](Package akOldPackage)'''
*Event received when this actor ends a package.
 
'''Event [[OnPackageStart - Actor|OnPackageStart]](Package akNewPackage)'''
*Event received when this actor starts running a new package.
 
'''Event [[OnRaceSwitchComplete - Actor|OnRaceSwitchComplete]]()'''
*Event received when this actor finishes switching races.
 
'''Event [[OnSit - Actor|OnSit]](ObjectReference akFurniture)'''
*Event received when this actor sits on the specified furniture.


== Notes ==
== Notes ==
* 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.
* 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 in 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, we attach this script to '''AbFXDragonBloodDamage''', which is an effect on the '''AbDragonBloodFX''' spell. That's then assigned as a special racial ability of the '''DragonRace'''. You can look at a similar example in how the WispMothers work, too.
** There is a workaround in 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, we attach this script to '''AbFXDragonBloodDamage''', which is an effect on the '''AbDragonBloodFX''' spell. That's then assigned as a special racial ability of the '''DragonRace'''. You can look at a similar example in how the WispMothers work, too.

Revision as of 12:39, 20 February 2012


Extends: ObjectReference Script

Script for the manipulation of actor instances.

Definition

ScriptName Actor extends ObjectReference

Properties

None

Global Functions

None

Member Functions

Function AddPerk(Perk akPerk)

  • Adds the specified perk to this actor.

bool Function AddShout(Shout akShout)

  • Adds the specified shout to this actor.

bool Function AddSpell(Spell akSpell, bool abVerbose)

  • Adds the specified spell to this actor.

Function 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.

Function AllowBleedoutDialogue(bool abCanTalk)

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

Function AllowPCDialogue(bool abTalk)

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

Function AttachAshPile(Form akAshPileBase)

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

Function ClearArrested()

  • Clears this actor's arrested state.

Function ClearExtraArrows()

  • Clears any arrow 3d on the actor.

Function ClearForcedLandingMarker()

  • Clears any forced landing marker on this actor.

Function ClearKeepOffsetFromActor()

  • Clears any keep offset from this actor.

Function ClearLookAt()

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

Function DamageActorValue(string asValueName, float afDamage)

  • Damages the specified actor value by the specified amount.

Function DamageAV(string asValueName, float afDamage)

  • Alias for DamageActorValue().

Function DispelAllSpells() native

  • Dispel all spell from this actor

bool Function DispelSpell(Spell akSpell) native

  • Dispel a spell from this actor

Function DoCombatSpellApply(Spell akSpell, ObjectReference akTarget) native

  • Apply a spell to a target in combat

Function EnableAI(bool abEnable)

  • Enables or disables this actor's AI.

Function EquipItem(Form akItem, bool abPreventRemoval, bool abSlient)

  • Equips the specified item on this actor.

Function EquipShout(Shout akShout)

  • Forces this actor to equip this shout.

Function EquipSpell(Spell akSpell, int aiSource)

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

Function EvaluatePackage()

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

Function ForceActorValue(string asValueName, float afNewValue)

  • Forces the specified actor value to the specified value.

Function ForceAV(string asValueName, float afNewValue)

  • Alias for ForceActorValue().

ActorBase Function GetActorBase()

  • Returns the base actor object for this actor.

float Function GetActorValue(string asValueName)

  • Retrieves the specified actor value from the actor.

float Function GetActorValuePercentage(string asValueName)

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

float Function GetAV(string asValueName)

  • Alias for GetActorValue().

float Function GetAVPercentage(string asValueName)

  • Alias for GetActorValuePercentage().

float Function GetBaseActorValue(string asValueName)

  • Gets the base value of the specified actor value.

float Function GetBaseAV(string asValueName)

  • Alias for GetBaseActorValue().

int Function GetBribeAmount()

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

Faction Function GetCrimeFaction()

  • Obtains this actor's crime faction.

int Function GetCombatState()

  • Obtains this actor's current combat state.

Actor Function GetCombatTarget()

  • Obtains this actor's current combat target.

Package Function GetCurrentPackage()

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

Actor Function GetDialogueTarget()

  • Obtains the actor's current dialogue target

int Function GetEquippedItemType(int aiHand)

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

Armor Function GetEquippedShield()

  • Obtains the currently equipped shield on this actor.

Shout Function GetEquippedShout()

  • Obtains the currently equipped shout on this actor.

Spell Function GetEquippedSpell(int aiSource)

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

Weapon Function GetEquippedWeapon(bool abLeftHand)

  • Obtains the currently equipped weapon on this actor.

int Function GetFactionRank(Faction akFaction)

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

int Function GetFactionReaction(Actor akOther)

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

int Function GetFlyingState()

  • Obtains this actor's current flying state.

ObjectReference Function GetForcedLandingMarker()

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

int Function GetGoldAmount()

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

int Function GetHighestRelationshipRank()

  • Gets this actor's highest relationship rank.

Actor Function GetKiller()

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

int Function GetLevel() native

  • Gets this actor's current level.

ActorBase Function GetLeveledActorBase()

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

float Function GetLightLevel()

  • Returns this actor's current light level

int Function GetLowestRelationshipRank()

  • Gets this actor's lowest relationship rank.

bool Function GetNoBleedoutRecovery()

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

bool Function GetPlayerControls() native

  • Queries whether this actor receives player input

Race Function GetRace()

  • Returns this actor's race.

int Function GetRelationshipRank(Actor akOther)

  • Retrieves the relationship rank between this actor and another.

int Function GetSitState()

  • Obtains this actor's sit state.

int Function GetSleepState()

  • Obtains this actor's sleep state.

float Function GetVoiceRecoveryTime()

  • Gets the voice recovery time from the actor.

bool Function HasAssociation(AssociationType akAssociation, Actor akOther)

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

bool Function HasFamilyRelationship(Actor akOther)

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

bool Function 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 Function HasMagicEffect(MagicEffect akEffect)

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

bool Function HasMagicEffectWithKeyword(Keyword akKeyword)

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

bool Function HasParentRelationship(Actor akOther)

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

bool Function HasPerk(Perk akPerk)

  • Checks to see if this actor has the given Perk

bool Function HasSpell(Form akForm)

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

bool Function IsAlarmed()

  • Obtains whether this actor is alarmed or not.

bool Function IsAlerted()

  • Returns if this actor is alerted or not.

bool Function IsAllowedToFly()

  • Is this actor allowed to fly?

bool Function IsArrested()

  • Returns whether this actor is currently arrested or not.

bool Function IsArrestingTarget()

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

bool Function IsBleedingOut()

  • Is this actor currently bleeding out?

bool Function IsBribed()

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

bool Function IsChild()

  • Is this actor a child?

bool Function IsCommandedActor()

  • Is this actor commanded by another?

bool Function IsDead()

  • Obtains whether this actor is dead or not.

bool Function IsDetectedBy(Actor akOther)

  • Is this actor detected by the other one?

bool Function IsDoingFavor()

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

bool Function IsEquipped(Form akItem)

  • Is the specified object equipped on this actor?

bool Function IsEssential()

  • Is this actor essential?

bool Function IsFlying()

  • Is this actor currently flying?

bool Function IsGhost()

  • Is this actor flagged as a ghost?

bool Function IsGuard()

  • Obtains whether this actor is a guard or not.

bool Function IsHostileToActor(Actor akActor)

  • Is this actor hostile to another actor?

bool Function IsInCombat()

  • Obtains whether this actor is in combat or not.

bool Function IsInFaction(Faction akFaction)

  • Returns whether this actor is in the specified faction.

bool Function IsInKillMove()

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

bool Function IsIntimidated()

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

bool Function IsPlayersLastRiddenHorse()

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

bool Function IsPlayerTeammate()

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

bool Function IsRunning()

  • Returns whether this actor is current running.

bool Function IsSneaking()

  • Is this actor currently sneaking?

bool Function IsSprinting()

  • Is this actor currently sprinting?

bool Function IsTrespassing()

  • Returns whether this actor is currently trespassing or not.

bool Function IsUnconscious()

  • Is this actor currently unconscious?

bool Function IsWeaponDrawn()

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

Function 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

Function Kill(Actor akKiller)

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

Function KillEssential(Actor akKiller)

  • Kills this actor, even if he is essential.

Function KillSilent(Actor akKiller)

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

Function MakePlayerFriend()

  • Makes the actor a friend of the player.

Function ModActorValue(string asValueName, float afAmount)

  • Modifies the specified actor value by the specified amount.

Function ModAV(string asValueName, float afAmount)

  • Alias for ModActorValue().

Function ModFactionRank(Faction akFaction, int aiMod)

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

Function MoveToPackageLocation()

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

Function OpenInventory(bool abForceOpen)

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

bool Function PathToReference(ObjectReference aTarget, float afWalkRunPercent)

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

bool Function PlayIdle(Idle akIdle)

  • Plays the passed idle on this actor.

bool Function PlayIdleWithTarget(Idle akIdle, ObjectReference akTarget)

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

Function PlaySubGraphAnimation(string asEventName)

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

Function RemoveFromFaction(Faction akFaction)

  • Removes this actor from the specified faction.

Function RemoveFromAllFactions()

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

Function RemovePerk(Perk akPerk)

  • Removes the specified perk from this actor.

bool Function RemoveShout(Shout akShout)

  • Removes the specified shout from this actor.

bool Function RemoveSpell(Spell akSpell)

  • Removes the specified spell from this actor.

Function ResetHealthAndLimbs()

  • Resets this actor's health and limb state.

Function RestoreActorValue(string asValueName, float afAmount)

  • Restores damage done to the specified actor value.

Function RestoreAV(string asValueName, float afAmount)

  • Alias for RestoreActorValue().

Function Resurrect()

  • Resurrects this actor.

Function SendAssaultAlarm()

  • Has this actor behave as if they were assaulted.

Function SendTrespassAlarm(Actor akCriminal)

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

Function SetActorValue(string asValueName, float afValue)

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

Function SetAlert(bool abAlerted)

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

Function 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)

Function SetAlpha(float afTargetAlpha, bool abFade)

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

Function SetAttackActorOnSight(bool abAttackOnSight)

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

Function SetAV(string asValueName, float afValue)

  • Alias for SetActorValue().

Function SetBribed(bool abBribe)

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

Function SetCrimeFaction(Faction akFaction)

  • Sets the faction that this actor reports crimes to.

Function SetCriticalStage(int aiStage)

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

Function SetDoingFavor(bool abDoingFavor)

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

Function SetFactionRank(Faction akFaction, int aiRank)

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

Function SetForcedLandingMarker(ObjectReference aMarker)

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

Function SetGhost(bool abIsGhost)

  • Sets this actor as a ghost or not.

Function SetHeadTracking(bool abEnable)

  • Enables or disables this actor's head tracking.

Function SetIntimidated(bool abIntimidate)

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

Function SetLookAt(ObjectReference akTarget, bool abPathingLookAt)

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

Function SetNoBleedoutRecovery(bool abAllowed)

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

Function SetNotShowOnStealthMeter(bool abNotShow)

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

Function SetOutfit(Outfit akOutfit,bool abSleepOutfit)

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

Function SetPlayerControls(bool abControls)

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

Function SetPlayerResistingArrest()

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

Function SetPlayerTeammate(bool abTeammate, bool abCanDoFavor)

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

Function SetRace(Race akRace)

  • Sets the actor's race

Function SetRelationshipRank(Actor akOther, int aiRank)

  • Sets the relationship rank between this actor and another.

Function SetRestrained(bool abRestrained)

  • Flags this actor as restrained or not.

Function SetUnconscious(bool abIsUnconscious)

  • Sets this actor as unconscious or not.

Function SetVehicle(ObjectReference akVehicle)

  • Attaches or detaches this actor from a vehicle.

Function SetVoiceRecoveryTime(float afTime)

  • Sets the voice recovery time on the actor.

Function ShowBarterMenu()

  • Shows the barter menu for this actor.

Function ShowGiftMenu()

  • Shows the give/take menu for this actor.

Function StartCannibal(Actor akTarget)

  • Has the actor feed on a dead actor.

Function StartCombat(Actor akTarget)

  • Attempts to initiate combat with the other actor.

Function StartVampireFeed(Actor akTarget)

  • Has the actor vampire feed on a sleeping actor

Function StopCombat()

  • Removes this actor from combat.

Function StopCombatAlarm()

  • Stops all combat and alarms against this actor.

bool Function TrapSoul(Actor akTarget)

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

Function UnequipAll()

  • Unequips all items from this actor.

Function UnequipItem(Form akItem, bool abPreventEquip, bool abSilent)

  • Unequips an item from this actor.

Function UnequipShout(Shout akShout)

  • Unequips the specified shout from this actor.

Function UnequipSpell(Spell akSpell, int aiSource)

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

Function UnlockOwnedDoorsInCell()

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

bool Function WillIntimidateSucceed()

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

bool Function WornHasKeyword(Keyword akKeyword)

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

Events

Event OnCombatStateChanged(Actor akTarget, int aeCombatState)

  • Sent when this actor's combat state changes.

Event OnDeath(Actor akKiller)

  • Event received when this actor dies.

Event OnDying(Actor akKiller)

  • Event received when this actor begins to die.

Event OnEnterBleedout()

  • Event received when this object enters bleedout.

Event OnGetUp(ObjectReference akFurniture)

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

Event OnLocationChange(Location akOldLoc, Location akNewLoc)

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

Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)

  • Event received when this actor equips an object.

Event OnObjectUnequipped(Form akBaseObject, ObjectReference akReference)

  • Event received when this actor unequips an object.

Event OnPackageChange(Package akOldPackage)

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

Event OnPackageEnd(Package akOldPackage)

  • Event received when this actor ends a package.

Event OnPackageStart(Package akNewPackage)

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

Event OnRaceSwitchComplete()

  • Event received when this actor finishes switching races.

Event OnSit(ObjectReference akFurniture)

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

Notes

  • 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 in 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, we attach this script to AbFXDragonBloodDamage, which is an effect on the AbDragonBloodFX spell. That's then assigned as a special racial ability of the DragonRace. You can look at a similar example in how the WispMothers work, too.