ID:142379
 
Code:
    proc
AosLoop()
if(src.client)return
var
list/piv
mob/attack
while(Health>0)
piv = list()
while(piv.len<=0)
if(walks)
step_rand(src)
sleep(wspeed)
for(var/mob/m in oview(1))
if(m.client&&m.key)
piv+=m
attack=pick(piv)
while(get_dist(attack,src)<=view)
if(get_dist(attack,src)==1)
var/dmg=rand(mdmg,Mdmg)-attack.def
if(dmg<0)
attack<<"[name] has attacked you,but missed you!"
sleep(aspeed)
attack<<"[name] has attacked you for [dmg] damage!"
attack.Health-=dmg
attack.Death(src)
sleep(aspeed)
else
step_towards(src,attack)
sleep(wspeed)
if(walks)
step_rand(src)
sleep(wspeed)


Problem description:

Every time my enemy attacks me, he kills him self. Its like all the damage hes doing is hitting him self, how do i make that damage hit me?

You should change oview(1) to oview(src,1), but in this case usr is (probably) the same as src, so that is likely not the source of your problem: if the mob chose to attack itself, it would never manage to get 1 tile away from itself, and would just stand around stuck doing nothing.

Most likely, you've buggered up your Death() proc. I find it strange how often people do this, so we'll need to see that.

Also, saying things like "Its like all the damage hes doing it hitting him self" isn't useful. If you think that's the case, then do something like outputting its own health after every attack, to check if that's what is happening (it isn't). Speculating and then not doing anything to confirm your speculations is just obnoxious for the people trying to help you.