I need a more effective way to make my NPCs spawn. This is what I have found.

[lua]function SetupNPCSpawnGrid()

```
if GetGlobalBool("SpawnedSpawners") == false then
gridTable = {}
gridTable[1] = Vector(-1000,1000,50)
gridTable[2] = Vector(0,2000,50)
gridTable[3] = Vector(-1000,0,50)
gridTable[4] = Vector(0,0,50)
gridTable[5] = Vector(1000,0,50)
gridTable[6] = Vector(-1000,-1000,50)
gridTable[7] = Vector(0,-1000,50)
gridTable[8] = Vector(1000,-1000,50)
gridTable[9] = Vector(-2000,2000,50)
gridTable[10] = Vector(0,2000,50)
gridTable[11] = Vector(-2000,0,50)
gridTable[12] = Vector(2000,0,50)
gridTable[13] = Vector(0,-2000,50)
gridTable[14] = Vector(2000,-2000,50)
SetGlobalInt("NPCMaxSpawners",table.Count(gridTable))
for i = 1, table.Count(gridTable) do
NPCSpawner = ents.Create("NPC_Spawner")
if util.IsInWorld(gridTable*) then
NPCSpawner:SetPos(gridTable*)
NPCSpawner:SetName("Spawner" .. i)
NPCSpawner:Spawn()
NPCSpawner:Activate()
end
end
```

[/lua]

My problem is that I can’t make it universal for any map.