SNPC errors, "')' expected near '1'" and "the Type field is empty!"

Ok so I’m trying to code a SNPC, and it is currently just a rough outline to learn the ropes.
When I launch the game I can see my NPC in the NPC tab, with a chekerboard (would be helpful if people could help this too) get the Console errors:

My init.lua code is:

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

include(“shared.lua”)

local schdCrimeRunShoot = ai_schedule.New( “Criminal Run Shoot” )
schdCrimeRunShoot:EngTask( “TASK_FIND_NODE_COVER_FROM_ENEMY”, 0 )
schdCrimeRunShoot:EngTask( “TASK_RELOAD”, 0 )
schdCrimeRunShoot:EngTask( “TASK_FACE_ENEMY”, 0 )
schdCrimeRunShoot:EngTask( “TASK_RANGE_ATTACK1”, 0 )

local schdCrimeHit = ai_schedule.New( “Criminal Hit” )
schdCrimeHit:EngTask( “TASK_SMALL_FLINCH” 1 )
schdCrimeHit:EngTask( “TASK_FIND_NODE_COVER_FROM_ENEMY”, 0 )

function ENT:Initialize()

self:SetModel( "models/Humans/Group01/Male_01.mdl" )

self:SetHullType( HULL_HUMAN );
self:SetHullSizeNormal();

self:SetSolid( SOLID_BBOX ) 
self:SetMoveType( MOVETYPE_STEP )

self:CapabilitiesAdd( CAP_MOVE_GROUND | CAP_OPEN_DOORS | CAP_ANIMATEDFACE | CAP_TURN_HEAD | CAP_USE_SHOT_REGULATOR | CAP_AIM_GUN | CAP_MOVE_SHOOT | CAP_WEAPON_RANGE_ATTACK1 | CAP_DUCK )

self:SetMaxYawSpeed( 5000 )

self:SetHealth(100)
self:Give( "weapon_pistol" )

end

function ENT:OnTakeDamage(dmg)
self:SetHealth(self:Health() - dmg:GetDamage())
if self:Health() < = 0 then
self:SetSchedule( SCHED_FALL_TO_GROUND )
end
if self:Health() > = 0 then
self:SetSchedule( schd_CrimeHit )
end
end

function ENT:SelectSchedule()

self:StartSchedule( schd_CrimeRunShoot )

end
[/lua]

I cant actually find any problem on line 14 with ")"s, but I have tried putting a value instead of 0 (In code is currently 1, this was originally 0, this was just as a try-fix.)
I have also seen problems like this emerging when people put capitals on things like “local”, but I can find no such errors.

line 14 should be this :


schdCrimeHit:EngTask( "TASK_SMALL_FLINCH",   1 )  

And somewhere in your shared.lua you should have this


ENT.Type = "ai"

edit : Yeah sorry lexic I forgot to edit it before posting :v:. You’re pretty quick at nitpicking! :wink:

Line 14 is [lua]schdCrimeHit:EngTask( “TASK_SMALL_FLINCH” 1 )[/lua]
You are missing a ‘,’ between the arguments.
[lua]schdCrimeHit:EngTask( “TASK_SMALL_FLINCH”, 1 )[/lua]

Thakns, will now test!
BTW I do have


ENT.Type = "ai"

It worked, but now im getting

Errors. I give up.

I noticed the name is ‘Runner’.
Are you editing the Zombie Runner SNPC/Entity?

When you’re calling your schedule you used an extra _ . :smile:

schd_CrimeHit should be schdCrimeHit.

I thought he was copying melonbines (did I spell that right?) Zombie Runner NPC/Ent.
I lol’ed when I found out I was wrong.