ID:176588
 
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()
Follow this procedure:

The mob clicks the other, thus attacking it...

In that procedure, at the end, call the enemy's attack proc, and tell it to attack the usr (The one who clicked the mob)

In that enemies procedure, it attacks the usr, and then calls the usr's attack procedure again to attack the enemy again. Then like at the end of that proc, make it repeate the steps over and over again. (Unless of course you don't want the both of them to keep attacking each other untill one dies or one runs, and you want to player to have to click the mob each time in order to attack it and for the mob to attack him.)