aboutsummaryrefslogtreecommitdiff
path: root/gamemode
diff options
context:
space:
mode:
Diffstat (limited to 'gamemode')
-rw-r--r--gamemode/npcsystem/aidirector.lua5
1 files changed, 5 insertions, 0 deletions
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