SNPCs not spawning

Can anyone help me figure out why these arent spawning? No errors or anything.

[LUA]function npcspawn()
local store = ents.Create(“npc_store”) store:SetPos(Vector(-788, -122, -12141)) store:Spawn()
local manager = ents.Create(“npc_manager”) manager:SetPos(Vector(-79, -876, -12142)) manager:Spawn()
local trainer = ents.Create(“npc_trainer”) trainer:SetPos(Vector(868, -129, -12119)) trainer:Spawn()
local gamble = ents.Create(“npc_gamble”) gamble:SetPos(Vector(111, 849, -12142)) gamble:Spawn()
hook.Add( “InitPostEntity”, “npcspawn”, npcspawn )[/LUA]

Add a timer to it, fixes my issue.

It is because of persistence’s stupid game.CleanUpMap() in that hook.

So the timer will fix that robotboy?

Yes. You could’ve tried that before asking though. A delay of 0 will do the trick.

Great! Ive gotten them to spawn. i just have more one more question. I use game.CleanUpMap(false, {“npc_*”}) and it still removes the npcs. is there something else i should be using so they are actually excluded from the cleanup?

You can’t exclude them from cleanup by simply calling that function. And you need to put a table of full entity names afaik.

Since that doesnt work how do i exclude these npcs from the cleanup? Thanks for all the help btw.

You can’t afaik.

[editline]1st July 2013[/editline]

You can do that for only your call of game.CleanUpMap with the arguments, other ones without arguments will still remove everything.

Thats what im asking, what arguments will work since you said mine were wrong?

As I already said, you must pass a table of FULL CLASS NAMES, like

game.CleanUpMap(false, {"npc_store", "npc_gamble"})


Ahh i see now. Thank you very much!