Spawning Npcs

I’m trying to spawn multiple Npcs at certain coordinates. I have only managed to spawn one. Here’s what I have so far.
[LUA]
function Npc()
local npc=ents.Create(“npc_antlion”)
npc:SetPos(Vector(-926.885864, 160.497101, 93.364548))
npc:SetAngles(Angle(0, -270, 0))
npc:Spawn()
end
concommand.Add(“SpawnNpc”, Npc)
[/LUA]
I know I could just copy and paste that again and change the vectors but that’s a hacky way in my opinion. If you could help that would be great.

Something of this nature may help you. correct if I got it wrong tho, but basically is should put your npcs in tables and then you can set spawn coords in a table of its own and not have to copy and paste what you have now over and over.



local npc_settings = {}
	npc_settings["antlion"] = { 
	npc = "npc-antlion", 
	}
local npcs = {}

function SpawnNpc(size, type, pos)
	type = npc[type]
	if not type then return end
	local npc = ents.Create( type.entity )
	npc:SetPos( pos )
        npc:SetAngles(Angle(0, -270, 0))
	npc:Spawn()
	npc:Activate()
end
table.insert(npcs, npc)

function NpcSpamWait()
	 SpawnNpc( "antlion", Vector(-926.885864, 160.497101, 93.364548))
	 SpawnNpc( "antlion", Vector(spawn coords go here))
	 SpawnNpc( "antlion", Vector(spawn coords go here))
end
hook.Add( "InitPostEntity", "NpcSpamSector", NpcSpamWait )



hope it helps you out tho