mob/proc
Attack()
for(var/mob/M in get_step(src,dir))
if(attacked==1)
return
flick("attack[usr.icon_state]",src)
attacked=1
if(J_getatt(M))
var/_dmg = J_getdmg(M)
if(_dmg>0)
oview(5) << output("\red <small>[src.name] has hit [M.name].","info")
M.Hp-=_dmg
s_damage(M,_dmg, "red")
M.Bars(src)
if(M.Hp <= 0)
M.DeathCheck(src)
else
M << output("[src.name] tried to attack you but missed.","info")
src << output("You tried to attack [M.name] but you missed.","info")
else
M << output("[src.name] tried to attack you but missed.","info")
src << output("You tried to attack [M.name] but you missed.","info")
spawn(attack_delay)
attacked=0
Problem description:My character would attack himself some time when im in battle and sometimes my character attack the monster and sometimes my character attack himself. is there a code to prevent this from happing
For a fix in that case, I suggest you look at http://www.byond.com/developer/forum/?id=795933
It's an engine made by Gravity Sandwich that shows you how to create a melee attack engine that goes by the new pixel movement BYOND has.