NULL entity

Tried making a npc with some help from wiki and valve wiki. Every time I spawn the npc it gives me null entity.

[lua]
AddCSLuaFile(“cl_init.lua”)
AddCSLuaFile(“shared.lua”)
include(“shared.lua”)

function ENT:Initialize()
self:SetModel( “models/humans/group03/male_01.mdl” )
self:SetHullType( HULL_HUMAN )
self:SetUseType( SIMPLE_USE )
self:SetHullSizeNormal()
self:SetSolid( SOLID_BBOX )
self:SetMoveType( MOVETYPE_STEP )
self:CapabilitiesAdd( CAP_ANIMATEDFACE | CAP_TURN_HEAD )
self:SetMaxYawSpeed( 5000 )
end

function ENT:OnTakeDamage( dmginfo )
return false
end

function ENT:SelectSchedule()
self.Entity:SetSchedule( SCHED_NONE )
end
[/lua]

[lua]
function LoadResupplyPoint()
npc = ents.Create( “trader” )
npc:SetAngles(0, 180, 0)
npc:SetPos(859, 262, -639)
npc:Spawn()
npc:Activate()
npc:DropToFloor()
npc.owner = npc
end
concommand.Add(“i_s”, LoadResupplyPoint)
timer.Simple( 3, function() LoadResupplyPoint() end )
[/lua]

bump.

Here’s the code to a SNPC I made, last time I checked it worked.

init.lua
[lua]AddCSLuaFile( “cl_init.lua” )
AddCSLuaFile( “shared.lua” )

include(‘shared.lua’)

function ENT:Initialize()

self:SetModel( "models/alyx.mdl" )

self:SetHullSizeNormal()
self:SetHullType( HULL_HUMAN )
self:SetNPCState( NPC_STATE_SCRIPT )

self:SetSolid( SOLID_BBOX ) 
self:SetMoveType( MOVETYPE_STEP )
self:CapabilitiesAdd( CAP_ANIMATEDFACE )
self:SetUseType( SIMPLE_USE )
self:DropToFloor()

end

– NOTE : You don’t need any of the stuff this comment for the init.lua, but I left it there anyway.

function ENT:OnTakeDamage()
return false
end

local Greet = ai_schedule.New( “AlyxCheer” ) //creates the schedule used for this npc
Greet:EngTask( “TASK_FACE_TARGET”, 0 )

hook.Add(“PlayerInitialSpawn”, “SetLastUse”,function(ply) if !ply.LastUse then ply.LastUse = 0 end end)

function ENT:AcceptInput( Name, Activator, Caller )
if( Name == “Use” ) and CurTime() >= Activator.LastUse + 1 then
Activator.LastUse = CurTime()
self:SetTarget(Activator)

	self:StartSchedule( Greet ) //run the schedule we created earlier
	
	local SceneN = math.random(1,2)
	
	

	
	timer.Simple(0.5, function()
	Activator:SendLua("chat.AddText(Color(255,255,128), \"Alyx: \",Color(255,255,255), \"Welcome to the STNO theater! Have a good night!\" )")
	PrecacheScene("scenes/npc/female01/hi0"..SceneN)
	self:PlayScene("scenes/npc/female01/hi0"..SceneN)
	end)
	
	
end

end[/lua]

cl_init.lua
[lua]include(‘shared.lua’)

ENT.RenderGroup = RENDERGROUP_BOTH

function ENT:Draw()

self:DrawModel()

end

function ENT:DrawTranslucent()

self:Draw()

end

function ENT:BuildBonePositions( NumBones, NumPhysBones )

// You can use this section to position the bones of
// any animated model using self:SetBonePosition( BoneNum, Pos, Angle )

// This will override any animation data and isn't meant as a 
// replacement for animations. We're using this to position the limbs of ragdolls

end

function ENT:SetRagdollBones( bIn )

// If this is set to true then the engine will call 
// DoRagdollBone (below) for each ragdoll bone
// It will then automatically fill in the rest of the bones

self.m_bRagdollSetup = bIn

end

function ENT:DoRagdollBone( PhysBoneNum, BoneNum )

// self:SetBonePosition( BoneNum, Pos, Angle )

end[/lua]

shared.lua
[lua]ENT.Base = “base_ai”
ENT.Type = “ai”

ENT.AutomaticFrameAdvance = true

function ENT:OnRemove()

end

function ENT:PhysicsCollide( data, physobj )

end

function ENT:PhysicsUpdate( physobj )

end

function ENT:SetAutomaticFrameAdvance( bUsingAnim )
self.AutomaticFrameAdvance = bUsingAnim
end[/lua]

:eng101:

I hope this helps you find what you’re missing.

Note that I left a few empty functions in there, feel free to get rid of them if you don’t intend to use them.