Skip to content

enchantChargeUse⚓︎

This event is triggered just before an on-strike or on-use enchantment is used by any actor, and also by the UI system to label enchant charges. It allows modification of the charge required to use an enchantment.

--- @param e enchantChargeUseEventData
local function enchantChargeUseCallback(e)
end
event.register(tes3.event.enchantChargeUse, enchantChargeUseCallback)

Tip

This event can be filtered based on the caster event data.

Tip

An event can be claimed by setting e.claim to true, or by returning false from the callback. Claiming the event prevents any lower priority callbacks from being called.

Event Data⚓︎

  • caster (tes3reference): Read-only. The caster of the enchantment.
  • charge (number): The charge required to cast the enchantment. May be modified.
  • isCast (boolean): True if the calculation is for a on-strike or on-use action, false if for UI enchant charge display. The type of action is found at e.source.castType.
  • item (tes3item): Read-only. Only available when isCast is true. The item used to cast the enchantment.
  • itemData (tes3itemData): Read-only. Only available when isCast is true. The item data of the item used to cast the enchantment.
  • source (tes3enchantment): Read-only. The enchantment being used or examined by the UI.
  • sourceInstance (tes3magicSourceInstance, nil): Read-only. Only available when isCast is true. The instance object of the magic being cast.

Warning: The sourceInstance may be destroyed immediately if the cast fails due to insufficient charge. Do not keep a long-lived reference to this sourceInstance. If you need to reference it in the future, save the source's serialNumber and look it up with tes3.getMagicSourceInstanceBySerial.