ID:176497
 
How would i make it so the mob only attacks when you attack it? Thanks in advance and here's my code:

Click()
if(get_dist(usr,src) <= 2)
usr.attack(src)
sleep(100)
else
...()
proc/move()
for(var/mob/M in oview())
if(get_step_away(src,M,3))
if(!M.client)
continue
else
walk_to(src,M,1,2)
else
continue
spawn(20)
move()

proc/attackplayer()
for(var/mob/M in oview(1))
if(get_step_away(src,M,1))
if(!M.client)
continue
else
src.attack(M)
else
return..()
spawn(20) attackplayer()

I'm not a very good coder but i would put the code for that in the Players attack verb.

So where you have the Players attacking code in the verb make something like this ...

<<Player attacking code here>>
If(src.reattacker == 0) return
If(src.reattacker == 1)
<<Mob attacking code here :P >>

Frelling hezmana! Pasting in regular tabs is bad enough, because browsers tend to expand them to 8 spaces (instead of something more manageable), but all that code is double-tabbed. It's spread out all over the left and right of my screen. Very hard to read.

It'd help if in the future you'd use DM tags to enclose your code, and you should probably replace your tabs with a couple of spaces instead. Thanks.

Lummox JR