diff options
| author | Alexander Pickering <Alexander.Pickering@anondomain.site90.net> | 2016-01-10 19:55:02 -0500 |
|---|---|---|
| committer | Alexander Pickering <Alexander.Pickering@anondomain.site90.net> | 2016-01-10 19:55:02 -0500 |
| commit | 7180aa15356188d11996f2f91f53c7cba4ad1470 (patch) | |
| tree | 91bfcb043fc9920e9a385dbd8433b98956713b77 /gamemode | |
| parent | 096a5bff99727b45f69f4cf0263e4bdd32da8e1a (diff) | |
| download | wintersurvival2-7180aa15356188d11996f2f91f53c7cba4ad1470.tar.gz wintersurvival2-7180aa15356188d11996f2f91f53c7cba4ad1470.tar.bz2 wintersurvival2-7180aa15356188d11996f2f91f53c7cba4ad1470.zip | |
Added console command hints to ws_spawnnpc command
Diffstat (limited to 'gamemode')
| -rw-r--r-- | gamemode/npcsystem/aidirector.lua | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/gamemode/npcsystem/aidirector.lua b/gamemode/npcsystem/aidirector.lua index 04e645d..fb85b2d 100644 --- a/gamemode/npcsystem/aidirector.lua +++ b/gamemode/npcsystem/aidirector.lua @@ -15,8 +15,28 @@ concommand.Add("ws_spawnnpc",function(ply,cmd,args) local npc = GetNpcByName(args[1])
if(npc == nil) then print("Not a valid name!")
return end
+ print("attempting to spawn npc...")
SpawnNpcByName(args[1],ply:GetPos())
-end)
+ print("NPC spawned!")
+end, function(cmd,stringargs)
+ print(cmd, stringargs)
+ local tbl = {}
+ stringargs = string.sub(stringargs,2)
+ if(stringargs == " ") then
+ for k,v in pairs(GAMEMODE.Npcs) do
+ table.insert(tbl,cmd .. " \"" .. v.Name .. "\"")
+ end
+ return tbl
+ end
+ for k,v in pairs(GAMEMODE.Npcs) do
+ if(string.find(string.lower(v.Name),stringargs)) then
+ table.insert(tbl,cmd .. " \"" .. v.Name .. "\"")
+ else
+ print("Could not find " .. stringargs .. " in " .. string.lower(v.Name))
+ end
+ end
+ return tbl
+end, "Spawns an NPC from winter survival, useage: ws_spawnnpc <name>")
function SpawnNpcByName(name, position)
if(CLIENT) then return end
@@ -25,9 +45,21 @@ function SpawnNpcByName(name, position) print("Could not find npc data for name " .. name)
return
end
+ if not position then
+ print("Invalid position:")
+ print(position)
+ return
+ end
ent = ents.Create("ws_npc_ambient")
+ if(not ent) then
+ print("Could not spawn npc ws_npc_ambient")
+ return
+ end
ent:SetPos(position)
-
+ print("From server!")
+ if(entdata.Name) then
+ ent.Name = entdata.Name
+ end
if(entdata.Model) then
ent.Model = entdata.Model
end
@@ -61,7 +93,9 @@ function SpawnNpcByName(name, position) if(entdata.OnSpawn) then
ent.OnSpawn = entdata.OnSpawn
end
+ print("NPC created")
ent:Spawn()
+ print("NPC spawned")
end
local random = math.random
|
