Melee weapons

I’ve looked at all kinds of melee weapons and they either use bullets or tracehullattack which doesn’t seem to make this work.

I need a melee weapon that I can detect it’s DamageType with the EntityTakeDamage hook with damageinfo. The actual HL2 crowbar does it so I know it must be possible.

Edit* I meant detect the DamageType as a CLUB or a SLASH

Use DamageInfo() to set up all the information for the damage you are going to deal. Then use a trace and Entity.TakeDamageInfo() to damage the entity.

Thanks that worked, but there is one problem when I use this, the ScaleNPCDamage hook doesn’t get called.

Really? Weird. Anyway nothing’s stopping you from calling it yourself.

Oh yeah thanks (= though I don’t know how to specify the hitgroup, but I don’t think I really need it in this case.

Oh I see what you mean. For applying the damage try shooting a bullet at the NPC where the trace hit it. That will call all hooks the regular way. Note it doesn’t have to be an actual bullet with a tracer, sound and visuals.


Actually I just found this in the wiki, might be useful :