I would recommend waiting for the nextbot stuff that garry is working on, if not, read on:
I was able to do this with lua (lol), my way is very dodgy though, as you’re not meant to do it.
[lua]-- Remove our enemy:
v.Enemy = nil
– Walk to position:
Where V is the npc.
As for attacking a prop:
[lua]local seq = self:LookupSequence(“attackA”)
That will play the attack animation (there is also B and C attack types, possibly others),then, you want to set a timer depending on the animation, so when the swing is roughly where it should be to hit, you check the distance to the prop (since it’s a prop, it wont move, so you probably wouldnt have to check the distance), then just apply the damage via lua.
local seq = self:LookupSequence(“attackA”)
self.attacking = true
self.started = CurTime()
self.AttackEnd = CurTime() + self:SequenceDuration()
if self.attacking then
if not self.attacked then
if CurTime() + 27 / 33 >= self.started then
– do the damage here
self.attacked = true
if( CurTime() < self.AttackEnd ) then return end
-- Complete the task:
self:SetNPCState( NPC_STATE_NONE )
self.attacking = false
self.attacked = false
That code is mostly from the top of my head, but should give a VERY BASIC idea on how to do it, again, better off waiting for nextbot, that’s why i didn’t put that much detail into it.