From a7a1e3a2d23e4aa10d874ad1b663d2116c1f62cb Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Sat, 2 Jan 2016 22:23:17 -0500 Subject: More work on ai overhaul --- gamemode/npcsystem/aidirector.lua | 2 ++ gamemode/npcsystem/npcs/bird.lua | 4 +++- gamemode/npcsystem/npcs/zombie.lua | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'gamemode/npcsystem') diff --git a/gamemode/npcsystem/aidirector.lua b/gamemode/npcsystem/aidirector.lua index 4051204..f5cf2b4 100644 --- a/gamemode/npcsystem/aidirector.lua +++ b/gamemode/npcsystem/aidirector.lua @@ -93,6 +93,8 @@ hook.Add("Tick","SpawnAmbient",function() if (C != CONTENTS_WATER and C != CONTENTS_WATER+CONTENTS_TRANSLUCENT) then --print("Appropriate place found, spawning bird)") local randnpcnum = math.Round(math.Rand(0, #ambientnpcs)) + local npc = GetNpcByName(ambientnpcs[randnpcnum]) + if(npc:) SpawnNpcByName(ambientnpcs[randnpcnum],Pos) break end diff --git a/gamemode/npcsystem/npcs/bird.lua b/gamemode/npcsystem/npcs/bird.lua index 0b05e62..463b8bd 100644 --- a/gamemode/npcsystem/npcs/bird.lua +++ b/gamemode/npcsystem/npcs/bird.lua @@ -60,7 +60,9 @@ NPC.Attacks = { } --A function that takes a position and returns true if this is an acceptable place to spawn -NPC.SpawnLocations = nil +function NPC:SpawnLocations(pos) + return true +end --The entity that is this npc's current target, if it has one. Nil otherwise NPC.Target = nil diff --git a/gamemode/npcsystem/npcs/zombie.lua b/gamemode/npcsystem/npcs/zombie.lua index 7c598fd..216ca43 100644 --- a/gamemode/npcsystem/npcs/zombie.lua +++ b/gamemode/npcsystem/npcs/zombie.lua @@ -89,7 +89,9 @@ function NPC:AttackPriority(ply) end --A function that takes a position and returns true if this is an acceptable place to spawn -NPC.SpawnLocations = nil +function NPC:SpawnLocations(pos) + return true +end --The entity that is this npc's current target, if it has one. Nil otherwise NPC.Target = nil -- cgit v1.2.3-70-g09d2