cant spawn entity's on map

i dont know whats wrong but it wont work :frowning:

[lua]
function NPC_spawns()
local zombie = ents.Create(“sent_zombie_spawn”)
zombie:SetPos(Vector(38.541866, -956.109497, -79.968750))
zombie:spawn()
zombie:activate()
end
[/lua]

i dont know if its the pos or something

[lua]
function NPC_spawns()
local zombie = ents.Create(“sent_zombie_spawn”)
zombie:SetPos(Vector(38.541866, -956.109497, -79.968750))
zombie:spawn()
zombie:activate()
end
hook.Add(“InitPostEntity”, “ZombehSpawn”, NPC_spawns)
[/lua]
Try that

Or that :c

|
V

[lua]
zombie:Spawn()
zombie:Activate()[/lua]

(case sensitive)

fml case is a pain in the ass i will try that now :smiley:

worked :smiley: but still doenst seem to work the entity spawns zombies but it doesnt spawn them it just shows the model :frowning:

Code for the entity?

erm its an addon, i didnt make it, if it doesnt work i will just make a timer that spawns npc_zombie instead, just using this because if they die the re spawn :smiley:
[lua]
AddCSLuaFile( “cl_init.lua” ) // Make sure clientside
AddCSLuaFile( “shared.lua” ) // and shared scripts are sent.
include(‘shared.lua’)

function ragdoll_finder()
for k, v in pairs( ents.FindByClass( “prop_ragdoll” ) ) do
v:Remove()
end
end

function ENT:Initialize()
self.Entity:SetModel(“models/props_c17/gravestone002a.mdl”) – MODEL OF THE OBJECT THAT SPAWN NPCS
//self.Entity:PhysicsInit( SOLID_VPHYSICS ) // Make us work with physics,
self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) // after all, gmod is a physics
self.Entity:SetSolid( SOLID_VPHYSICS )
self.Entity:SetAngles(Vector(0,0,0))
local phys = self.Entity:GetPhysicsObject()
if (phys:IsValid()) then
phys:Wake()
–phys:EnableGravity(false)
end
self.zombiedata = {}
local zombie1 = {}
local zombie2 = {}
zombie1.pos = Vector(75,32,19)
zombie2.pos = Vector(114,-11,19)
zombie1.payload = nil
zombie2.payload = nil
zombie1.weld = nil
zombie2.weld = nil
zombie1.loaded = false
zombie2.loaded = false
zombie1.load = CurTime()
zombie2.load = CurTime()
table.insert(self.zombiedata,zombie1)
table.insert(self.zombiedata,zombie2)
self.spawntime = 1.4 --change this, is the time
end

function ENT:SpawnFunction( ply, tr )

if ( !tr.Hit ) then return end

local SpawnPos = tr.HitPos + tr.HitNormal * 30

local ent = ents.Create( "sent_zombie_spawn" ) -- NAME OF THE FOLDER eg: sent_zombie_spawn
ent:SetPos( SpawnPos )
ent:Spawn()
return ent

end

function ENT:Spawnzombie(number)
local ent = ents.Create( “npc_zombie” ) – HERE THE NPC THAT YOU WANT eg: npc_fastzombie
ragdoll_finder() – Remove the ragdoll
ent:SetPos(self.Entity:LocalToWorld(self.zombiedata[number].pos))
ent:SetAngles(self.Entity:GetAngles())
ent:Spawn()
local eds = EffectData()
eds:SetEntity( ent )
util.Effect( “propspawn”, eds, true, true )
self.zombiedata[number].payload = ent
self.zombiedata[number].loaded = true
//self.zombiedata[number].weld = constraint.Weld( self.Entity, ent, 0, 0, 0, true )
self.Entity:DeleteOnRemove( ent )
end

function ENT:Think()
for k,v in pairs(self.zombiedata) do
if !v.loaded then
if v.load < CurTime() then
self:Spawnzombie(k)
else
local p = self.Entity:LocalToWorld(v.pos)

local beampoint = ents.Create( “info_target” )
beampoint:SetPos§
beampoint:SetKeyValue(“targetname”, “laserend” … tostring(k))
beampoint:Spawn()
beampoint:SetParent(self.Entity)
beampoint:Fire(“kill”, “”, 0.60)
local effectdata = EffectData()
effectdata:SetStart§
p = p + self.Entity:GetUp() * 88
effectdata:SetOrigin§
effectdata:SetScale( 1 )
//util.Effect( “ManhackSparks”, effectdata )
local dobeam = ents.Create(“env_laser”)
//dobeam:SetPos( p )
//dobeam:SetKeyValue(“renderamt”, 255)
//dobeam:SetKeyValue(“rendercolor”, “40 40 150”)
//dobeam:SetKeyValue(“texture”, “sprites/plasmabeam.spr”)
//dobeam:SetKeyValue(“TextureScroll”, “255”)
//dobeam:SetKeyValue(“targetname”, “beam” … tostring(k))
//dobeam:SetKeyValue(“spawnflags”, “32”)
//dobeam:SetKeyValue(“width”, 20)
//dobeam:SetKeyValue(“dissolvetype”, “1”)
//dobeam:SetKeyValue(“EndSprite”, “”)
////dobeam:SetKeyValue(“LaserTarget”, “laserend” … tostring(k))
//dobeam:SetKeyValue(“TouchType”, “0”)
//dobeam:SetKeyValue(“NoiseAmplitude”, 45)
dobeam:SetParent(self.Entity)
dobeam:Spawn()
dobeam:Activate()
dobeam:Fire(“TurnOn”, “”, 0.05)
dobeam:Fire(“TurnOff”, “”, 0.55)
dobeam:Fire(“kill”, “”, 0.60)
end
else
if v.payload:IsValid() then
if v.payload:IsPlayerHolding() then
undo.Create(“zombie”)
undo.AddEntity(v.payload)
undo.SetPlayer( v.payload:GetOwner() )
undo.Finish()
self.Entity:DontDeleteOnRemove( v.payload )
v.loaded = false
v.weld:Remove()
v.load = CurTime() + self.spawntime
end
else
v.loaded = false
v.load = CurTime() + self.spawntime
local g = ents.FindInSphere(self.Entity:GetPos(), 400 )
for k,v in pairs(g) do
if v:IsOnFire() then
v:Extinguish()
end
end
end
end
end

end
[/lua]