mob
Enemy
New()
. = ..()
spawn()
Wander()
proc/Wander(var/mob/P)
while(src)
if(P in oview(7))
if(P.client)
step_towards(src,P)
for(P in oview(1))
break
for(P in oview(2))
break
for(P in oview(3))
break
for(P in oview(4))
break
for(P in oview(5))
break
for(P in oview(6))
break
else
sleep(2)
for(P in oview(7))
break
else
sleep(2)
for(P in oview(7))
break
sleep(2)
spawn(2)
Wander()
Bump(mob/M)
if(M.client)
Fight(M)
else
return
proc/Fight()
for(var/mob/E in get_step(src,src.dir))
var/power=round(rand(src.strength,src.strength*1.5))
var/damage=round(power-E.defense)
if(damage<=0)
damage=1
damage=round(rand(damage,damage*1.5))
E.health -= damage
view(7)<<output("<font color=red>[src] attacks [E] for [damage] damage!","combat:add")
UserDcheck(E)
sleep(15)
Problem description:
I were playing around with the coding from an RPG tutorial since I noticed it was bugged...And got this. Everything seems to work fine, the monsters approach me normally as I want them to. But they don't attack me? They just follow me around without hurting me, I don't even get the damage message?
The problem with this code is it will only try to fight something in the same direction of it. So, if something bumps it from behind or the side, it'll still try to fight the mob in front of it, even if it's not there.