From ea93b0feb5fc3bcf61aec4d3e00f92936102014c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lilian=20J=C3=B3nsd=C3=B3ttir?= Date: Sun, 26 Jul 2020 16:53:27 -0700 Subject: [PATCH] interior guards don't wander --- MWSE/mods/celediel/MoreAttentiveGuards/common.lua | 6 ++++++ MWSE/mods/celediel/MoreAttentiveGuards/sneak.lua | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/MWSE/mods/celediel/MoreAttentiveGuards/common.lua b/MWSE/mods/celediel/MoreAttentiveGuards/common.lua index 56a041e..2ded70d 100644 --- a/MWSE/mods/celediel/MoreAttentiveGuards/common.lua +++ b/MWSE/mods/celediel/MoreAttentiveGuards/common.lua @@ -34,6 +34,12 @@ this.generateIdles = function() return idles end +this.generateWanderRange = function(cell) + -- don't wander inside? + -- shitty "fix" for stationary NPCs remaining stationary + return (cell.isInterior and not cell.behavesAsExterior) and 0 or 2000 +end + this.guardDialogue = function(npc, str, target) -- target of the dialogue, either an NPC/Creature, or the player's class or race -- this is what %s is replaced with in the dialogue string; npc/creature for combat, player for sneak diff --git a/MWSE/mods/celediel/MoreAttentiveGuards/sneak.lua b/MWSE/mods/celediel/MoreAttentiveGuards/sneak.lua index 11b30ec..3b353e3 100644 --- a/MWSE/mods/celediel/MoreAttentiveGuards/sneak.lua +++ b/MWSE/mods/celediel/MoreAttentiveGuards/sneak.lua @@ -50,9 +50,12 @@ local function stopFollowing(onTimer) if not follower or not isFollowing then return end isFollowing = false + local wanderRange = common.generateWanderRange(tes3.getPlayerCell()) + local idles = common.generateIdles() + local function startWander() log("%s has probably reached their original destination, resuming wander...", follower.object.name) - tes3.setAIWander({reference = follower, range = 2000, reset = false, idles = common.generateIdles()}) + tes3.setAIWander({reference = follower, range = wanderRange, reset = false, idles = idles}) follower = nil end