• Use on an npc?
    4 replies, posted
Simply put, how would i make an ent thats an NPC so i could use the ENT:Use()? Thanks
[QUOTE=Saint Devil;16570802]Simply put, how would i make an ent thats an NPC so i could use the ENT:Use()? Thanks[/QUOTE] make a basic snpc then add: [lua] function ENT:Use( activator, caller ) // code end [/lua]
[QUOTE=Kwigg;16602480]make a basic snpc then add: [lua] function ENT:Use( activator, caller ) // code end [/lua][/QUOTE] That doesn't seem to work for me.
I already got this to work, i spawned an npc_eli on the map on startup in lua, then i made a function in KeyPress for IN_USE when looking at npc_eli. Very vague, sorry. The problem i have with my code is the npc can die D:
[lua] function ScaleDamage( npc, hitgroup, dmginfo ) if npc:GetClass() == "npc_eli" then dmginfo:ScaleDamage( 0 ) else dmginfo:ScaleDamage( 1 ) end end hook.Add("ScaleNPCDamage","ScaleDamage",ScaleDamage)[/lua]
Sorry, you need to Log In to post a reply to this thread.