interior guards don't wander

This commit is contained in:
Lilian Jónsdóttir 2020-07-26 16:53:27 -07:00
parent 5d31d0ad97
commit ea93b0feb5
2 changed files with 10 additions and 1 deletions

View file

@ -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

View file

@ -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