diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2016-04-03 19:04:11 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2016-04-03 19:04:11 -0400 |
| commit | 1f2031c211acae8761cfdeafb11a07cb230a646b (patch) | |
| tree | b096c0f1ef35e51071c9f044adddda7a7357f493 | |
| parent | c6d81a837ba5bb46246ca6703f539e69a18b8216 (diff) | |
| download | wintersurvival2-1f2031c211acae8761cfdeafb11a07cb230a646b.tar.gz wintersurvival2-1f2031c211acae8761cfdeafb11a07cb230a646b.tar.bz2 wintersurvival2-1f2031c211acae8761cfdeafb11a07cb230a646b.zip | |
I may have finally fixed the npc error
| -rw-r--r-- | gamemode/npcsystem/aidirector.lua | 5 |
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
|
