This event is invoked whenever an actor starts an attack with their fists or a weapon, or a creature makes any attack. More precisely, it is when the actor raises a melee weapon or draws an arrow. There is not necessarily a target in range, or any target at all for the player.
Lockpicks and probes do not invoke this event.
--- @param e attackStartEventData local function attackStartCallback(e) end event.register(tes3.event.attackStart, attackStartCallback)
This event can be filtered based on the
reference event data.
An event can be claimed by setting
true, or by returning
false from the callback. Claiming the event prevents any lower priority callbacks from being called.
attackSpeed(number): The speed multiplier of the attack animation, normally equal to the weapon speed (1.0 for no equipped weapon). May be changed to change the current attack's speed. See also tes3actorAnimationController to change animation speed during the attack.
attackType(tes3.physicalAttackType): A number from the
tes3.physicalAttackTypeenumeration identifying the physical attack type. Can be
.creature3. May be changed to change the attack's type if the original attack was slash, chop, or thrust.
mobile(tes3mobileActor): Read-only. The mobile actor making the attack.
reference(tes3reference): Read-only. A shortcut to the reference that is attacking.
Example: Changing axe attack direction
-- In this example, we force the attack -- direction for axes to always be chop ---@param e attackStartEventData local function onAttackStart(e) local mobile = e.reference.mobile if not mobile then return end local weapon = mobile.readiedWeapon.object --[[@as tes3weapon]] if weapon.type == tes3.weaponType.axeOneHand or weapon.type == tes3.weaponType.axeTwoHand then -- Now actually change the attack direction e.attackType = tes3.physicalAttackType.chop end end event.register(tes3.event.attackStart, onAttackStart)
Created: August 10, 2021 18:38:47