From 1f2031c211acae8761cfdeafb11a07cb230a646b Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Sun, 3 Apr 2016 19:04:11 -0400 Subject: I may have finally fixed the npc error --- gamemode/npcsystem/aidirector.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gamemode/npcsystem/aidirector.lua b/gamemode/npcsystem/aidirector.lua index 008ad1a..bda81d7 100644 --- a/gamemode/npcsystem/aidirector.lua +++ b/gamemode/npcsystem/aidirector.lua @@ -156,6 +156,11 @@ hook.Add("Tick","SpawnAmbient",function() --print("Appropriate place found, spawning bird)") local randnpcnum = math.Round(math.Rand(0, #ambientnpcs)) local npc = GetNpcByName(ambientnpcs[randnpcnum]) + if(npc == nil) then + print("Found npc that getnpcbyname returned nil for") + print(ambientnpcs[randnpcnum]) + continue + end if(npc:SpawnLocations(Pos)) then SpawnNpcByName(ambientnpcs[randnpcnum],Pos) end -- cgit v1.2.3-70-g09d2