Method that forces NPC to die?

Is there a method I can include in a SWep that forces an NPC to die, like player.Kill()? I’m trying to make a weapon that will kill the targeted npc after a few seconds. One thing I tried was using NPC:SetNPCState(NPC_STATE_DEAD) but for some reason, it doesn’t coordinate with the timer, the NPC just dies after some random number of seconds and it causes errors with custom NPCs.

(edit) Additionally, can anyone explain how to assign a sprite to a trace, like the physgun beam or the lightning bolt-esque line that shoots out of the toolgun?

maybe you could just send a large amount of arbitrary damage to it?

[editline]9th October 2013[/editline]

Or set its health to 0?

I’m not experienced with NPCs so I’m not sure this will work. Sending an immense amount of damage to an NPC should work though because if I’m correct, there is no way for an NPC to scale damage to 0, (according to comments in the Sanic NPC, where he states his reason for setting Sanic’s health to a large scientific number in the think function is to bypass this limitation)

Tried setting its health to 0, which is, apparently, not the same thing as killing it. Being a lua n00b, I don’t know how to make the NPC take damage from the weapon without making it an ordinary gun (which is far from what I’m looking for)
Thanks for the reply, though

Let me dig up my copy of Sanic for you really quick. BRB

Fuck that I forgot that Sanic is supposed to be invincible

I’ll try the wiki instead, I think I know where to look

[editline]10th October 2013[/editline]

Well there’s a bitch, I couldn’t find anything

Can you explain exactly what your SWEP is supposed to do? Maybe you can find a workaround.

For example, you could make it so that the SWEP creates a small radius, invisible explosion inside whatever NPCs you want to kill, only problem is you have to aquire the target somehow (ie through a trace or “FindIn<whatever>”

(Prepare for unfathomable hatred) I’m trying to recreate the Wunderwaffe DG2 from CoD zombies. If you don’t know what it does, it shoots a bolt of lighting from the barrel and hits whatever its aimed at. (This is what’s gonna kill to me to try and do) After, the bolt continues on and hits 4 or 5 more targets in a sequence. (Everything the bolt hits dies instantly)

Just use Entity:TakeDamage(9999999999)

Works for me. Thanks.

Doesn’t that gun shoot a pulse rather than pure lightning?
Because I was thinking you could use a wide TraceHull to acquire targets to take damage.