NPC script where they remove and respawn on a timer
1 replies, posted
Hey guys I am trying to make a script that spawns npcs on a certain position and remove npcs that exist then respawn. Here is what I have so far. I need help with creating a timer and looping it however.
[CODE]
function SpawnNPCS()
local npcs = ents.Create("npc_zombie")
npcs:SetPos(Vector(549.964661, 1500.438965, 49.031246))
npcs:SetAngles(Angle(0, 225, 0))
npcs:Spawn()
npcs:DropToFloor()
local npcs = ents.Create("npc_zombie")
npcs:SetPos(Vector(6446.654, 545.345, 345.242))
npcs:SetAngles(Angle(0, 225, 0))
npcs:Spawn()
npcs:DropToFloor()
end
hook.Add("InitPostEntity", "SpawnNPCS", SpawnNPCS)
[/CODE]
I know this is a terrible way of doing it but I am not sure what other way I can. Thanks for any help in advanced!
Look at the [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/timer/Create]timer.Create[/url] page, it should help
Sorry, you need to Log In to post a reply to this thread.