From 09fe7cf5fac36063bae4501a6030327ec7bf2c22 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Sun, 10 Jan 2016 20:04:06 -0500 Subject: Fixed zombies sometimes bugging out if they don't have a target --- gamemode/npcsystem/npcs/zombie.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gamemode/npcsystem/npcs/zombie.lua b/gamemode/npcsystem/npcs/zombie.lua index 5914c04..ce4105b 100644 --- a/gamemode/npcsystem/npcs/zombie.lua +++ b/gamemode/npcsystem/npcs/zombie.lua @@ -88,7 +88,9 @@ NPC.Attacks = { --Attack priority is a fucntion that takes a player, and returns an int describing it's prority to attack (higher = more important) NPC will always attack the player with the highest priority function NPC:AttackPriority(ply) - local dist = ply:GetPos():Distance(self:GetPos()) + local plypos = ply:GetPos() + local mypas = self:GetPos() + local dist = plypos:Distance(mypos) return self.Stats["AwareDist"] - dist end -- cgit v1.2.3-70-g09d2