The combatStart event occurs when combat is about to begin between two actors. This event allows scripts to prevent combat from starting.
--- @param e combatStartEventData local function combatStartCallback(e) end event.register(tes3.event.combatStart, combatStartCallback)
This event supports blocking by setting
true or returning
false. Blocking the event prevents vanilla behavior from happening. For example, blocking an
equip event prevents the item from being equipped.
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.
actor(tes3mobileActor): Read-only. The mobile actor who is entering combat.
target(tes3mobileActor): Read-only. The mobile actor who combat is being triggered against.
Example: Stop certain actors from initiating combat with the player
---@param actor tes3mobileActor local function isPacifistTarget(actor) -- Here you can filter if the actor should initiate combat with the player. -- ... end --- @param e combatStartEventData local function forcedPacifism(e) if (e.target == tes3.player and isPacifistTarget(e.actor)) then return false end end event.register(tes3.event.combatStart, forcedPacifism)
Created: August 10, 2021 18:38:47