Freezing NPC

I tried set the movetype to non set the physicsobject motion to false

I basically tried it all they still run I want to just freeze them in one spot and I guess I can lopp a setpos everytime, but if theres another way I would love to hear about it…

I use this init code, see if it works for you:
[lua]
self:SetHullType( HULL_HUMAN )
self:SetHullSizeNormal( )
self:SetNPCState( NPC_STATE_SCRIPT )
self:SetSolid( SOLID_BBOX )
self:CapabilitiesAdd( bit.bor(CAP_ANIMATEDFACE, CAP_TURN_HEAD) )
self:SetUseType( SIMPLE_USE )
self:DropToFloor()[/lua]

Umm thanks, but no success there

Heres my full code (it’s not a SNPC)
[lua]
local NPC = ents.Create(‘npc_citizen’);
NPC:SetPos(Location);
NPC:SetAngles(Angles);
NPC:Spawn();
NPC:SetModel(Model);
NPC:SetHealth(999999999)
NPC:SetHullType( HULL_HUMAN )
NPC:SetHullSizeNormal( )
NPC:SetNPCState( NPC_STATE_SCRIPT )
NPC:SetSolid( SOLID_BBOX )
NPC:CapabilitiesAdd( bit.bor(CAP_ANIMATEDFACE, CAP_TURN_HEAD) )
NPC:SetUseType( SIMPLE_USE )
NPC:DropToFloor()
[/lua]

Bump

Try


NPC:StopMoving()

Although, I’m not sure if it will stop him / her PERMANENTLY…
Also,

… What are you coding? Another planet? :stuck_out_tongue:

Why would you set the health of the entity? Do this instead:
[lua]
function ENT:OnTakeDamage( dmg )
return false
end
[/lua]

It doesn’t stop the NPC at all :S

Yea dont mind that, already changed it. that new “NPC” script was just to test how to freeze NPC

Which we can both see does not work anyway…

That’s weird how no one knows how to stop them npcs.