From 6a75e5a1582212ccddfa59609ee492a77ac46cde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lilian=20J=C3=B3nsd=C3=B3ttir?= Date: Thu, 30 Jul 2020 00:12:18 -0700 Subject: [PATCH] don't attack friendly actors --- MWSE/mods/celediel/MoreAttentiveGuards/combat.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/MWSE/mods/celediel/MoreAttentiveGuards/combat.lua b/MWSE/mods/celediel/MoreAttentiveGuards/combat.lua index a0d1e9c..5bba2c1 100644 --- a/MWSE/mods/celediel/MoreAttentiveGuards/combat.lua +++ b/MWSE/mods/celediel/MoreAttentiveGuards/combat.lua @@ -7,6 +7,15 @@ local this = {} local function log(...) if config.debug then common.log(...) end end +local function isFriendlyActor(actor) + for friend in tes3.iterate(tes3.mobilePlayer.friendlyActors) do + if actor.object.id == friend.object.id or actor.object.baseObject.id == friend.object.baseObject.id then + return true + end + end + return false +end + local function alertGuards(aggressor, cell) -- a wanted player gets no help if tes3.mobilePlayer.bounty > 0 then @@ -53,6 +62,11 @@ this.onCombatStart = function(e) return end + if isFriendlyActor(e.actor) then + log("Friendly actor, not helping.") + return + end + local cell = tes3.getPlayerCell() if cell.isInterior and not cell.behavesAsExterior then