Skip to content

tes3weapon⚓︎

A weapon game object.

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

Properties⚓︎

blocked⚓︎

The blocked state of the object.

Returns:

  • result (boolean)

boundingBox⚓︎

The bounding box for the object.

Returns:


chopMax⚓︎

Chop damage inflicted at maximum weapon swing.

Returns:

  • result (number)

chopMin⚓︎

Chop damage inflicted at minimum weapon swing.

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)

enchantCapacity⚓︎

The object's enchantment capacity.

Returns:

  • result (number)

enchantment⚓︎

The enchantment used by the object.

Returns:


flags⚓︎

Access to the weapon flag bitfield. Known flags can be accessed via other weapon properties.

Returns:

  • result (number)

hasDurability⚓︎

Read-only. Whether the weapon type has durability. Thrown weapons and ammunition are used once fired, and therefore do not use durability.

Returns:

  • result (boolean)

icon⚓︎

The path to the object's icon.

Returns:

  • result (string)

id⚓︎

Read-only. The unique identifier for the object.

Returns:

  • result (string)

ignoresNormalWeaponResistance⚓︎

Access to the flag that controls if this weapon bypasses the "Resist normal weapons" magic effect.

Returns:

  • result (boolean)

isAmmo⚓︎

Read-only. If true, the weapon is a type of ammunition. Arrows and bolts are ammunition, while thrown weapons aren't.

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)

isMelee⚓︎

Read-only. If true, the weapon has a melee weapon type.

Returns:

  • result (boolean)

isOneHanded⚓︎

Read-only. If true, the weapon is a one-handed weapon.

Returns:

  • result (boolean)

isProjectile⚓︎

Read-only. If true, the weapon is a projectile.

Returns:

  • result (boolean)

isRanged⚓︎

Read-only. If true, the weapon is a ranged weapon.

Returns:

  • result (boolean)

isSilver⚓︎

If true, the weapon has a silver material flag. Silver weapons deal double damage to the Undead and Werewolf creatures.

Returns:

  • result (boolean)

isTwoHanded⚓︎

Read-only. If true, the weapon is a two-handed melee weapon.

Returns:

  • result (boolean)

maxCondition⚓︎

The object's maximum condition.

Returns:

  • result (number)

mesh⚓︎

The path to the object's mesh.

Returns:

  • result (string)

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:


reach⚓︎

The weapon's relative reach. A value of 1.0 is the standard reach. It is multiplied by the GMST fCombatDistance to find the attack reach in world units.

Returns:

  • result (number)

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:


skill⚓︎

Gets the skill data for the attack skill used by the weapon.

Returns:


skillId⚓︎

Gets the skill ID for the attack skill used by the weapon. Maps to values in tes3.skill namespace.

Returns:

Example: Print the name of the skill the attacker's weapon uses
local function showMessage(e)
    if e.mobile.readiedWeapon then
        local id = e.mobile.readiedWeapon.object.skillId
        local name = tes3.getSkillName(id)

        tes3.messageBox(name)
    end
end

event.register(tes3.event.attackStart, showMessage)

slashMax⚓︎

Slash damage inflicted at maximum weapon swing.

Returns:

  • result (number)

slashMin⚓︎

Slash damage inflicted at minimum weapon swing.

Returns:

  • result (number)

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)

speed⚓︎

The relative attack speed of the weapon. Controls attack timing and animation speed. Standard speed is 1.0.

Returns:

  • result (number)

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)

thrustMax⚓︎

Thrust damage inflicted at maximum weapon swing.

Returns:

  • result (number)

thrustMin⚓︎

Thrust damage inflicted at minimum weapon swing.

Returns:

  • result (number)

type⚓︎

Read-only. A number representing the weapon type. Matches values from the tes3.weaponType table.

Returns:


typeName⚓︎

Read-only. The player-facing name for the weapon type.

Returns:

  • result (string)

value⚓︎

The value of the object.

Returns:

  • result (number)

weight⚓︎

The weight of the object.

Returns:

  • result (number)

Methods⚓︎

__tojson⚓︎

Serializes the object to json.

local string = myObject:__tojson()

Returns:

  • string (string)

createCopy⚓︎

Creates a copy of this object.

local newObject = myObject:createCopy({ id = ..., addToObjectList = ..., sourceless = ... })

Parameters:

  • params (table)
    • id (string): Optional. The new object's ID. If one is not provided, a randomly generated one will be used.
    • addToObjectList (boolean): Default: true. If true, the object will be added to the data handler. If this is false, the new object may not have a randomly generated ID. Do not use this without knowing the implications.
    • sourceless (boolean): Default: false. If true, the object will be made sourceless, and will not be serialized to the save game. If the object is copied outside of a save game, the object will always be sourceless.

Returns:


getMaterialFlag⚓︎

Access to the material flag bitfield. Known material flags can be accessed via other weapon properties.

local result = myObject:getMaterialFlag(flagBit)

Parameters:

  • flagBit (integer): 0 corresponds to the ignoresNormalWeaponResistance field, 1 corresponds to the isSilver.

Returns:

  • result (boolean)

setMaterialFlag⚓︎

Access to the material flag bitfield. Known material flags can be accessed via other weapon properties.

myObject:setMaterialFlag(flagBit, value)

Parameters:

  • flagBit (integer): 0 corresponds to the ignoresNormalWeaponResistance field, 1 corresponds to the isSilver.
  • value (boolean)