ID:145676
 
Attack Code:
    Attack(mob/M as mob in oview(1))
if(M)
if(M in !oview(1))
return
if(istype(loc.loc,/area/safearea))
usr<<"can't attack in safe area"
return
var/damage = src.Strength + rand(1,5) - M.Defense + M.defenseeffect
if(damage <=0)
damage = 0
var/hit = usr.Speed-usr.speedeffect - M.Speed+M.speedeffect + rand(-30,30)
if(hit <= 0)
usr << "You missed!"
M << "<font color=red>[usr]</font> missed!"
M.Agro = 1
else
M.Health -= damage
M.Agro = 1
var/colour = "black"
s_damage(M,damage,colour)
if(M.Health <= 0)
Death(M)


Problem description:

In my game, there is sometimes the chance that when you kill a monster, you kill a different monster that is nowhere near you. I don't know how to solve this problem and it is sometimes a big problem when sometimes you kill another player or a monster that after you kill it, it teleports you somewhere. I do not know how to fix it, any thoughts?

Thanks,
Comusio