Skip to content

tes3combatSession⚓︎

A structure that keeps track of combat session data that lasts for the duration of combat. It is mainly used for AI decision making. It is not saved to a savegame.

Properties⚓︎

alchemyPriority⚓︎

No description yet available.

Returns:

  • result (number)

castableSpells⚓︎

The list of castable spells that the AI will consider using during combat. This includes both offensive and defensive spells. It is initialized at the start of combat and may be changed by mods at any time. Like other combat session data, it is not saved to a savegame.

This is actually a list collection type. You can use these methods on castableSpells:

castableSpells:add(tes3spell) castableSpells:find(tes3spell) -> index castableSpells:erase(index) castableSpells:clear()

Note that ids cannot be used with these methods.

Returns:


data⚓︎

A generic lua table that data can be written to, and synced to/from the save. All information stored must be valid for serialization to json.

There is a guide available here on using this table.

Returns:

  • result (table)

distance⚓︎

The combat distance.

Returns:

  • result (number)

lastUseTimestamp⚓︎

Used by the MCP to implement an alchemy use cooldown for actor AI.

Returns:

  • result (number)

mobile⚓︎

Read-only. Convenience access back to the associated actor.

Returns:


potionUseFlag⚓︎

No description yet available.

Returns:

  • result (number)

selectedAction⚓︎

The current combat action, until the next AI decision. This can be changed to affect what the AI is doing in the short term. From observed behavior, this roughly maps to:

Value Behavior
0 Undecided
1 Use melee weapon
2 Use marksman weapon
3 Use hand to hand attacks
4 Use on-touch offensive spell
5 Use on-target offensive spell
6 Use summon spell
7 Flee
8 Cast on-self empowering spell (For example, Ancestor Guardian)
9 Use alchemy item
10 Use enchanted item

Returns:

  • result (integer)

selectedItem⚓︎

The potion or an enchanted item which was chosen at the last AI decision, if it was a magic item action. Changing this has no effect outside of the decision function, instead use tes3mobileActor.equipMagic to change the next castable.

Returns:


selectedShield⚓︎

Read-only. The shield which was chosen at the last physical attack AI decision.

Returns:


selectedSpell⚓︎

The spell which was chosen at the last AI decision, if it was a spell cast action. Changing this has no effect outside of the decision function, instead use tes3mobileActor.equipMagic to change the next castable.

Returns:


selectedWeapon⚓︎

Read-only. The weapon which was chosen at the last physical attack AI decision.

Returns:


spellPriority⚓︎

No description yet available.

Returns:

  • result (number)

Methods⚓︎

changeEquipment⚓︎

This method equips an item to the mobile in this combat sesion.

myObject:changeEquipment(equipmentStack)

Parameters:


selectAlchemyWithEffect⚓︎

Selects the alchemy item with the greatest value, for a given effect ID and loads it into the selectedItem property.

local result = myObject:selectAlchemyWithEffect(id)

Parameters:

Returns:

  • result (number)