diff options
| author | Alexander Pickering <Alexander.Pickering@anondomain.site90.net> | 2016-01-02 22:24:46 -0500 |
|---|---|---|
| committer | Alexander Pickering <Alexander.Pickering@anondomain.site90.net> | 2016-01-02 22:24:46 -0500 |
| commit | b94ae1f187c46f1f775575daadc893a35890b6c3 (patch) | |
| tree | e2701501e160ce23e96da9260fc80468e50d1630 /gamemode/npcsystem | |
| parent | a7a1e3a2d23e4aa10d874ad1b663d2116c1f62cb (diff) | |
| download | wintersurvival2-b94ae1f187c46f1f775575daadc893a35890b6c3.tar.gz wintersurvival2-b94ae1f187c46f1f775575daadc893a35890b6c3.tar.bz2 wintersurvival2-b94ae1f187c46f1f775575daadc893a35890b6c3.zip | |
Introduced npc-determined spawn position
Diffstat (limited to 'gamemode/npcsystem')
| -rw-r--r-- | gamemode/npcsystem/aidirector.lua | 5 | ||||
| -rw-r--r-- | gamemode/npcsystem/npcs/zombie.lua | 76 |
2 files changed, 3 insertions, 78 deletions
diff --git a/gamemode/npcsystem/aidirector.lua b/gamemode/npcsystem/aidirector.lua index f5cf2b4..a78e41e 100644 --- a/gamemode/npcsystem/aidirector.lua +++ b/gamemode/npcsystem/aidirector.lua @@ -94,8 +94,9 @@ 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:)
- SpawnNpcByName(ambientnpcs[randnpcnum],Pos)
+ if(npc:SpawnLocations(Pos)) then
+ SpawnNpcByName(ambientnpcs[randnpcnum],Pos)
+ end
break
end
end
diff --git a/gamemode/npcsystem/npcs/zombie.lua b/gamemode/npcsystem/npcs/zombie.lua index 216ca43..a725a04 100644 --- a/gamemode/npcsystem/npcs/zombie.lua +++ b/gamemode/npcsystem/npcs/zombie.lua @@ -108,82 +108,6 @@ function NPC:Stuck() --If we're stuck, jump backwards
end
---What to replace ENT:RunBehaviour with
---[[
-function NPC:Behave()
- --[[
- print("Going into antlion's custom behaviour")
- while ( true ) do
- --self:PlaySequenceAndWait( "Idle" )
-
- --Main loop for ai
-
- --Update aware enemies
- local players = ents.FindByClass("Player")
- for k,v in pairs(players) do
- if(v:IsPigeon()) then continue end
- local dist = v:GetPos():Distance(self:GetPos())
- if( dist < self.Stats["AwareDist"]) then
- table.insert(self.AwareEnemies,v)
- end
- end
-
- --Find the enemy with the highest priority
- local maxpriority = -1
- local maxprioritytarget = nil
- for k,v in pairs(self.AwareEnemies) do
- local priority = self:AttackPriority(v)
- if(priority > maxpriority) then
- maxpriority = priority
- maxprioritytarget = v
- end
- end
- self.Target = maxprioritytarget
-
- --If we can't find anyone to attack, just stay idle
- if(self.Target == nil) then
- print("Couldn't find anyone to attack!")
- --Play an idle sequence
- local randanim = math.Round(math.Rand(0,#self.IdleSequences))
- self:PlaySequenceAndWait( self.IdleSequences[randanim] )
- self:StartActivity( ACT_IDLE )
- else
- --We have a target to attack!
- print("We found something to attack!")
- --Find which attack will do the most dammage
- local maxdammage = -1
- local maxdammagefunc = nil
- for k,v in pairs(self.Attacks) do
- local dammagefunc = nil
- local attackfunc = nil
- for i,j in pairs(v) do
- dammagefunc = i
- attackfunc = j
- end
- print("Using damagefunc:")
- print(dammagefunc)
- local dammage = dammagefunc(self, self.Target)
- print("dammage is ")
- print(dammage)
- if(dammage > maxdammage) then
- maxdammage = dammage
- maxdammagefunc = attackfunc
- end
- end
-
- --Do that attack
- if(maxdammagefunc) then
- maxdammagefunc(self, self.Target)
- else
- print("It looked like we could attack, but we can't!")
- end
- end
- --coroutine.yield()
- end
-
- coroutine.yield()
-end
---]]
--These are just here to tell the editors/develoeprs what functions are available.. dont un-comment them out, as this could affect all the items.
/*
function NPC:OnSpawn()
|
