aboutsummaryrefslogtreecommitdiff
path: root/gamemode/npcsystem
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2016-04-03 19:04:11 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2016-04-03 19:04:11 -0400
commit1f2031c211acae8761cfdeafb11a07cb230a646b (patch)
treeb096c0f1ef35e51071c9f044adddda7a7357f493 /gamemode/npcsystem
parentc6d81a837ba5bb46246ca6703f539e69a18b8216 (diff)
downloadwintersurvival2-1f2031c211acae8761cfdeafb11a07cb230a646b.tar.gz
wintersurvival2-1f2031c211acae8761cfdeafb11a07cb230a646b.tar.bz2
wintersurvival2-1f2031c211acae8761cfdeafb11a07cb230a646b.zip
I may have finally fixed the npc error
Diffstat (limited to 'gamemode/npcsystem')
-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