Standing Ground SNPC

I was wondering if anyone could make an SNPC that stands its ground until it sees someone in range to fire. But wont move farther than maybe 200’. I also need it to be a combine with a pistol or AR2.

THANKS IN ADVANCE! Because I know someone will do it eventually.

concommand.Add(“npc_standground”,function( pl )
local e = ents.Create(“npc_combine_s”)
local tr = pl:GetEyeTrace()
e:SetPos( tr.HitPos + tr.HitNormal * 20 )
e:SetKeyValue( “ignoreunseenenemies”, “1” )
e:SetKeyValue( “sleepstate”, “2” )
e:SetKeyValue( “spawnflags”, “519” )

That’ll make a basic combine soldier that won’t do anything until it sees someone. Not really sure what to do about making it stay in one place though.

Alright. Thanks!