//Well this was created by me(Zanoroku) seen it's working quite fine,so dont change this.
mob/verb/Attack()
set hidden=1
if(!usr.canattack)
return
if(usr.wieldingsword) flick("Sword Slash1",usr)
else flick("punch",usr)
for(var/mob/M in get_step(usr,usr.dir))
var/damage=round(M.Strength-M.Defence)
var/counterdamage=round(damage)
if(damage>=0)
M.Health-=counterdamage
M.effectdamage(counterdamage,"y")
if(M.enemy)
usr.hollowprotection=1
view(usr,8)<<"[usr] attacked [M] for [damage] damage."
usr.canattack=1
return
usr.Death(M)
Problem description:
How to put a delay on attack coding
First off, these two lines:
Do the exact same thing. counterdamage tries to round a rounded value, so effectively is just a waste of processing.
Second, "return" should be "break". On top of that, "usr.Death(M)" should be called before break.
Third, the view() should be changed to a for(in range()) loop ideally, but that's just me nitpicking.
To add a delay to attacking simply put spawn(attackdelay) outside of the original for() loop and set canattack to 1. You'd also want to set canattack to 0 somewhere.
For example:
Also put some side notes in there about several other things.