• Freezing NPC
    6 replies, posted
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]
[QUOTE=Donkie;39637125]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][/QUOTE] 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 [CODE]NPC:StopMoving()[/CODE] Although, I'm not sure if it will stop him / her PERMANENTLY... Also, [QUOTE]SetHealth(999999999)[/QUOTE]... What are you coding? Another planet? :P
[QUOTE=angrypepper;39676001]Try [CODE]NPC:StopMoving()[/CODE] Although, I'm not sure if it will stop him / her PERMANENTLY... Also, SetHealth(999999999) ... What are you coding? Another planet? :P[/QUOTE] Why would you set the health of the entity? Do this instead: [lua] function ENT:OnTakeDamage( dmg ) return false end [/lua]
[QUOTE=angrypepper;39676001]Try [CODE]NPC:StopMoving()[/CODE] Although, I'm not sure if it will stop him / her PERMANENTLY... Also, ... What are you coding? Another planet? :P[/QUOTE] It doesn't stop the NPC at all :S [QUOTE=ms333;39676109]Why would you set the health of the entity? Do this instead: [lua] function ENT:OnTakeDamage( dmg ) return false end [/lua][/QUOTE] 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.
Sorry, you need to Log In to post a reply to this thread.