Skip to content

tes3creatureInstance⚓︎

A creature object that has been cloned. Typically represents a creature that has been instanced in the world.

This type inherits the following: tes3actor, tes3physicalObject, tes3object, tes3baseObject

Properties⚓︎

actorFlags⚓︎

Read-only. A number representing the actor flags. Truly a bit field.

Returns:

  • result (number)

aiConfig⚓︎

Read-only. Simplified access to the base creature's AI configuration.

Returns:

Example: Checking if a creature offers traveling service
--- This function returns `true` if given NPC
--- or creature offers traveling service.
---@param actor tes3npc|tes3npcInstance|tes3creature|tes3creatureInstance
---@return boolean
local function offersTraveling(actor)
    local travelDestinations = actor.aiConfig.travelDestinations

    -- Actors that can't transport the player
    -- have travelDestinations equal to `nil`
    return travelDestinations ~= nil
end

attacks⚓︎

Simplified access to the base creature's attacks. A table of three attacks, represented by a trio of tes3rangeInt.

Returns:


attributes⚓︎

Simplified access to the base creature's attributes. A table of eight numbers, representing the base values for the creature's attributes.

Returns:

  • result (number[])

barterGold⚓︎

The actor's base barter gold amount. This is the amount of the barter gold an actor initially has, and also when barter gold is refreshed. The actor's current barter gold amount is held in tes3mobileActor.barterGold.

Barter gold is reset on talking to an actor if fBarterGoldResetDelay hours have passed since the last transaction. If you want to change the base amount, for example in an investment mod, you must edit the barterGold of the baseObject.

Returns:

  • result (number)

baseObject⚓︎

Read-only. Access to creature that this one is instanced from.

Returns:


biped⚓︎

Access to the creature's biped flag.

Returns:

  • result (boolean)

blocked⚓︎

The blocked state of the object.

Returns:

  • result (boolean)

blood⚓︎

Friendly access to actor's blood type, in [0, 7] range. The available blood types are defined in the Morrowind.ini file, and assigned to the actor via the Construction Set.

Returns:

  • result (integer)

boundingBox⚓︎

The bounding box for the object.

Returns:


cloneCount⚓︎

Read-only. The number of clones that exist of this actor.

Returns:

  • result (number)

deleted⚓︎

Read-only. The deleted state of the object.

Returns:

  • result (boolean)

disabled⚓︎

Read-only. The disabled state of the object.

Returns:

  • result (boolean)

equipment⚓︎

Read-only. A collection that contains the currently equipped items.

Returns:


fatigue⚓︎

Read-only. The creature's current fatigue.

Returns:

  • result (number)

flies⚓︎

Access to the creature's flies flag.

Returns:

  • result (boolean)

health⚓︎

Read-only. The creature's current health.

Returns:

  • result (number)

id⚓︎

Read-only. The unique identifier for the object.

Returns:

  • result (string)

inventory⚓︎

Read-only. The items currently carried by the actor.

Returns:


isAttacked⚓︎

Read-only. If true, the creature attacked flag is set.

Returns:

  • result (boolean)

isEssential⚓︎

Read-only. If true, the creature essential flag is set.

Returns:

  • result (boolean)

isInstance⚓︎

Always returns true.

Returns:

  • result (boolean)

isLocationMarker⚓︎

True if this object is an editor marker for a gameplay location. These include travel, intervention, prison, door, and interior north markers. Markers are invisible in-game.

Returns:

  • result (boolean)

isRespawn⚓︎

Read-only. If true, the creature respawn flag is set.

Returns:

  • result (boolean)

level⚓︎

Read-only. The base level of the creature.

Returns:

  • result (number)

magicka⚓︎

Read-only. The creature's current magicka.

Returns:

  • result (number)

mesh⚓︎

The path to the object's mesh.

Returns:

  • result (string)

mobile⚓︎

Read-only. The mobile that the object is represented by.

Returns:


modified⚓︎

The modification state of the object since the last save.

Returns:

  • result (boolean)

name⚓︎

The player-facing name for the object.

Returns:

  • result (string)

nextInCollection⚓︎

The next object in parent collection's list.

Returns:


objectFlags⚓︎

Read-only. The raw flags of the object.

Returns:

  • result (number)

objectType⚓︎

Read-only. The type of object. Maps to values in tes3.objectType.

Returns:


owningCollection⚓︎

The collection responsible for holding this object.

Returns:


persistent⚓︎

The persistent flag of the object.

Returns:

  • result (boolean)

previousInCollection⚓︎

The previous object in parent collection's list.

Returns:


reference⚓︎

Read-only. The reference that the object is represented by.

Returns:


respawns⚓︎

Access to the creature's respawns flag.

Returns:

  • result (boolean)

scale⚓︎

The object's scale. The value range is (0, 10).

Returns:

  • result (number)

sceneCollisionRoot⚓︎

The scene graph node for this object's physics collision, if its mesh has a root collision node.

Returns:


sceneNode⚓︎

The scene graph node for this object.

Returns:


script⚓︎

Read-only. The script that runs on the object.

Returns:


skills⚓︎

Simplified access to the base creature's skills. A table of three numbers, representing the base values for the creature's combat, magic, and stealth skills.

Returns:

  • result (number[])

soul⚓︎

Simplified access to the base creature's soul. The amount of soul value that the creature provides.

Returns:

  • result (number)

soundCreature⚓︎

Simplified access to the base creature's sound generator. A creature to use instead of this one for sound generation.

Returns:


sourceless⚓︎

The soruceless flag of the object.

Returns:

  • result (boolean)

sourceMod⚓︎

Read-only. The filename (including the extension) of the mod that owns this object. It has nil value if the object was anything other than loaded from an ESP or ESM file.

Returns:

  • result (string)

spells⚓︎

Read-only. Quick access to the creature's spell list. It is a tes3spellList, which is a list wrapper with helper functions. The actual list is iterated over using pairs. E.g. for _, spell in pairs(creature.spells) do print(spell.name) end

Returns:


stolenList⚓︎

A list of actors that the object has been stolen from.

Returns:


supportsLuaData⚓︎

If true, references of this object can store temporary or persistent lua data.

Returns:

  • result (boolean)

swims⚓︎

Access to the creature's swims flag.

Returns:

  • result (boolean)

type⚓︎

Simplified access to the base creature's type. The type of the creature, maps to values in tes3.creatureType namespace.

Returns:


usesEquipment⚓︎

Access to the creature's usesEquipment flag.

Returns:

  • result (boolean)

walks⚓︎

Access to the creature's walks flag.

Returns:

  • result (boolean)

weapon⚓︎

Read-only. The creature's currently equipped weapon.

Returns:


Methods⚓︎

__tojson⚓︎

Serializes the object to json.

local string = myObject:__tojson()

Returns:

  • string (string)

getEquipmentValue⚓︎

Returns the combined value of all the items worn by the actor.

local value = myObject:getEquipmentValue({ useDurability = ... })

Parameters:

  • params (table)
    • useDurability (boolean): Default: false. If true, damaged items will have a proportionally lower value.

Returns:

  • value (number): The value of each equipped item added together.

hasItemEquipped⚓︎

Checks if the actor has provided item equipped.

local result = myObject:hasItemEquipped(item, itemData)

Parameters:

Returns:

  • result (boolean)

offersService⚓︎

Checks if the actor will offer a service in dialogue. This an offer and may still be refused by dialogue checks. To also get the result of dialogue checks, use tes3.checkMerchantOffersService().

local result = myObject:offersService(service)

Parameters:

Returns:

  • result (boolean)

onInventoryClose⚓︎

A callback function invoked when an inventory is closed. Typically not used outside of specific purposes. You may find tes3.reference's onCloseInventory() to be more convenient to use.

myObject:onInventoryClose(reference)

Parameters:


reevaluateEquipment⚓︎

Causes the creature to reevaluate its equipment choices and equip the best available. Then, the visible body parts will be updated.

myObject:reevaluateEquipment()

tradesItemType⚓︎

Checks if the actor will buy and sell items of a given object type. e.g. actor:tradesItemType(tes3.objectType.repairItem)

local result = myObject:tradesItemType(objectType)

Parameters:

Returns:

  • result (boolean)