Need some help with SNPC creation

Here’s my init.lua with a bunch of tests. None of them is working, except AddTask ones (NPC plays a sequence at least). Also there’s not many documentation on this SNPC creation method, as I can see


AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")

include("shared.lua")

-- Schedules
--[[
local schdChase = ai_schedule.New( "AIFighter Chase" )
	// Run away randomly (first objective in task)
	schdChase:EngTask( "TASK_GET_PATH_TO_RANDOM_NODE", 	128 )
	schdChase:EngTask( "TASK_RUN_PATH", 				0 )
	schdChase:EngTask( "TASK_WAIT_FOR_MOVEMENT", 	0 )
	schdChase:AddTask( "PlaySequence", 				{ Name = "cheer1", Speed = 1 } )

	// Find an enemy and run to it (second objectives in task)
	schdChase:AddTask( "FindEnemy", 		{ Class = "player", Radius = 2000 } )
	schdChase:EngTask( "TASK_GET_PATH_TO_RANGE_ENEMY_LKP_LOS", 	0 )
	schdChase:EngTask( "TASK_RUN_PATH", 				0 )
	schdChase:EngTask( "TASK_WAIT_FOR_MOVEMENT", 	0 )

	// Shoot it (third objective in task)
	schdChase:EngTask( "TASK_STOP_MOVING", 			0 )
	schdChase:EngTask( "TASK_FACE_ENEMY", 			0 )
	schdChase:EngTask( "TASK_ANNOUNCE_ATTACK", 		0 )
	schdChase:EngTask( "TASK_RANGE_ATTACK1", 		0 )
	schdChase:EngTask( "TASK_RELOAD", 				0 )
	//schedule is looped till you give it a different schedule
]]

-- "	Tasks"
	-- "		TASK_STOP_MOVING				0"
	-- "		TASK_SET_FAIL_SCHEDULE			SCHEDULE:SCHED_CHASE_ENEMY_FAILED"
	-- "		TASK_GET_CHASE_PATH_TO_ENEMY	300"
	-- "		TASK_RUN_PATH					0"
	-- "		TASK_WAIT_FOR_MOVEMENT			0"
	-- "		TASK_FACE_ENEMY			0"
local schdChase = ai_schedule.New( "testSched" )
	schdChase:EngTask( "TASK_STOP_MOVING", 	0 )
--	schdChase:EngTask( "TASK_SET_FAIL_SCHEDULE", 	"SCHED_CHASE_ENEMY_FAILED" )
	schdChase:EngTask( "TASK_GET_CHASE_PATH_TO_ENEMY", 	300 )
	schdChase:EngTask( "TASK_RUN_PATH", 	0 )
	schdChase:EngTask( "TASK_WAIT_FOR_MOVEMENT", 	0 )
	schdChase:EngTask( "TASK_FACE_ENEMY", 	0 )

-- "	Tasks"
	-- "		TASK_SET_TOLERANCE_DISTANCE		48"
	-- "		TASK_SET_ROUTE_SEARCH_TIME		3"	// Spend 3 seconds trying to build a path if stuck
	-- "		TASK_GET_PATH_TO_LASTPOSITION	0"
	-- "		TASK_WALK_PATH					0"
	-- "		TASK_WAIT_FOR_MOVEMENT			0"
local schdForcedGo = ai_schedule.New( "testSchedForcedGo" )
	schdForcedGo:EngTask( "TASK_SET_TOLERANCE_DISTANCE", 	48 )
	schdForcedGo:EngTask( "TASK_SET_ROUTE_SEARCH_TIME", 	3 ) // Spend 3 seconds trying to build a path if stuck
	schdForcedGo:EngTask( "TASK_GET_PATH_TO_LASTPOSITION", 	0 )
	schdForcedGo:EngTask( "TASK_WALK_PATH", 	0 )
	schdForcedGo:EngTask( "TASK_WAIT_FOR_MOVEMENT", 	0 )


function ENT:Initialize()
--[[
	self:SetModel( "models/monk.mdl" )
	self:SetHullType( HULL_HUMAN )
	self:SetHullSizeNormal()
	self:SetNPCState( NPC_STATE_COMBAT )
	self:SetSolid( SOLID_BBOX )
--	self:CapabilitiesAdd( bit.bor( CAP_ANIMATEDFACE , CAP_TURN_HEAD ) )
--	self:CapabilitiesAdd( bit.bor( CAP_MOVE_FLY ) )
	self:CapabilitiesAdd( bit.bor( CAP_MOVE_CLIMB, CAP_TURN_HEAD, CAP_MOVE_GROUND, CAP_MOVE_JUMP, CAP_MOVE_SWIM, CAP_MOVE_CRAWL, CAP_AUTO_DOORS, CAP_OPEN_DOORS ) )
]]

	self:SetModel( "models/monk.mdl" )
	self:SetHullType( HULL_HUMAN );
	self:SetHullSizeNormal();
	self:SetSolid( SOLID_BBOX ) 
	self:SetMoveType( MOVETYPE_STEP )
	self:CapabilitiesAdd( bit.bor( CAP_MOVE_GROUND, CAP_OPEN_DOORS, CAP_ANIMATEDFACE, CAP_TURN_HEAD, CAP_USE_SHOT_REGULATOR, CAP_AIM_GUN ) )
	self:SetMaxYawSpeed( 5000 )
	self:SetHealth(100)
	self:Give( "weapon_smg1" ) //Can be given sweps.

--	self:SetTargetPlayer( player.GetAll()[1] )
--	self:SetTargetPlayer( self:GetOwner() ) -- COMMENT ME
	self:SetEnemy( player.GetAll()[1] )
	self:SetTarget( player.GetAll()[1] )
--	self:SetEnemy( self:GetOwner() )
end

--[[
function ENT:OnTakeDamage( dmginfo )
--	dmginfo:ScaleDamage( 0 )
	self:SetSchedule( SCHED_FALL_TO_GROUND )
--	return false
end
]]

--[[
function ENT:Think()
	self:SetEnemy( player.GetAll()[1] )
	self:SetTarget( player.GetAll()[1] )
end
]]

function ENT:SelectSchedule()
--	self:StartSchedule( schdChase ) //run the schedule we created earlier

	local enemy = self:GetEnemy()
	if IsValid(enemy) then
		print(enemy)
		self:SetSaveValue( "m_vecLastPosition", enemy:GetPos() )
	--	self:SetSchedule( SCHED_FORCED_GO )
	--	self:SetSchedule( SCHED_CHASE_ENEMY )
		self:SetSchedule( schdForcedGo )
	end
end

I used this tutorial and this thread