diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2017-08-24 18:08:10 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2017-08-24 18:08:10 -0400 |
| commit | 61bc16dae5a1b61bcd237d9f0be36125829d95b1 (patch) | |
| tree | c9deebda1190e23073240d2bbe4ecabee668d742 /gamemode/core/npc | |
| parent | 0f3211e4fb0cf27684079e6195995947c9f9027f (diff) | |
| download | artery-61bc16dae5a1b61bcd237d9f0be36125829d95b1.tar.gz artery-61bc16dae5a1b61bcd237d9f0be36125829d95b1.tar.bz2 artery-61bc16dae5a1b61bcd237d9f0be36125829d95b1.zip | |
Various update
Diffstat (limited to 'gamemode/core/npc')
| -rw-r--r-- | gamemode/core/npc/sv_huntingspawner.lua | 27 | ||||
| -rw-r--r-- | gamemode/core/npc/sv_npcsystem.lua | 2 |
2 files changed, 16 insertions, 13 deletions
diff --git a/gamemode/core/npc/sv_huntingspawner.lua b/gamemode/core/npc/sv_huntingspawner.lua index 283b27f..d13ec36 100644 --- a/gamemode/core/npc/sv_huntingspawner.lua +++ b/gamemode/core/npc/sv_huntingspawner.lua @@ -4,28 +4,30 @@ local track = nrequire("core/inventory/sv_invtracker.lua") local itm = nrequire("core/inventory/item.lua") local o = {} - +local playerhunted = {} local huntablenodes = {} function o.CreateSpawnNode(tbl) huntablenodes[#huntablenodes+1] = tbl local e = ents.Create("info_huntablespawn") e:SetPos(tbl.Position) + e:Spawn() end local function SpawnMonsterFor(ply,zone) --Check what hunting ground we're in - print("I want to attack",ply) + --print("I want to attack",ply) if zone == nil then return end - print("I am in a zone!") + --print("I am in a zone!") local possiblenpcs = zone.npctbl - PrintTable(possiblenpcs) + --PrintTable(possiblenpcs) local randnum = math.random(0,100) - print("Random num was",randnum) + --print("Random num was",randnum) local npctype for k,v in pairs(possiblenpcs) do randnum = randnum - v - print("Subtracting ", v , " for ",k) + --print("Subtracting ", v , " for ",k) + --print(randnum) if randnum < 0 then npctype = k break @@ -36,14 +38,14 @@ local function SpawnMonsterFor(ply,zone) print(ply,"got lucky this time...") return end - print("I will spawn a ",npctype,"to attack ",ply,"!") + --print("I will spawn a ",npctype,"to attack ",ply,"!") --Find a place for the npc to spawn that's out of sight! local potentialspots = ents.FindInSphere( ply:GetPos(), 4000 ) for k,v in pairs(potentialspots) do - print("Checking spot",v) + --print("Checking spot",v) if v:GetClass() ~= "info_huntablespawn" then - print("Was not an info_huntablespawn") + --print("Was not an info_huntablespawn") potentialspots[k] = nil else local tr = util.TraceLine({ @@ -63,11 +65,12 @@ local function SpawnMonsterFor(ply,zone) --Choose a random spot! local spawnpos = a[math.random(1,#a)] - print("I want to spawn a monster at", spawnpos) + --print("I want to spawn a monster at", spawnpos) if spawnpos == nil then - print("Couldn't find a spot to spawn an NPC around",ply,"at",ply:GetPos(),"make sure there are enough info_huntablespawn entities around in little corners and stuff") + --print("Couldn't find a spot to spawn an NPC around",ply,"at",ply:GetPos(),"make sure there are enough info_huntablespawn entities around in little corners and stuff") return end + --Do a trace up to hit the skybox, local npc = ents.Create(npctype) npc:SetPos(spawnpos:GetPos()) @@ -110,7 +113,7 @@ hook.Add("OnNPCKilled","droplootforexnpcs",function(npc,attacker,inflictor) if rng < itemchance then local drop = itm.GetItemByName(itemname) print("Createing a drop of",drop) - track.CreateDroppedItem(drop, self:GetPos()+Vector(math.random(20),math.random(20),20)) + track.CreateDroppedItem(drop, npc:GetPos()+Vector(math.random(20),math.random(20),20)) end end end) diff --git a/gamemode/core/npc/sv_npcsystem.lua b/gamemode/core/npc/sv_npcsystem.lua index 0b250ac..1051c64 100644 --- a/gamemode/core/npc/sv_npcsystem.lua +++ b/gamemode/core/npc/sv_npcsystem.lua @@ -87,7 +87,7 @@ local function loadMap() local foldername = "artery/maps/" .. mapname ExecuteOnFolder(foldername,true,function(path) - --print("I want to run",path) + print("I want to run",path) local filetxt = file.Read(path,"DATA") --print("File text is", filetxt) CompileString(filetxt,path)() |
