mob
verb
attack()
for(src in get_step(usr,usr.dir))
if(src.client) //was src.key
yes = 1
damage = src.defense / (src.defense / 2) * usr.strength + rand(1,usr.strength)
src.health -= damage
src << "[usr] starts a battle with you!"
src << "[usr] does [damage] damage to you!"
usr << "You do [damage] to [src]!"
if(src.health <= 0)
src.loc = locate(lastx,lasty,lastz)
src.health = src.maxHealth
usr << "You killed [src]."
if(!src.client) //was !src.key or try typesof
yes = 1
attacking = 1
damage = src.defense / (src.defense / 2) * usr.strength + rand(1,usr.strength)
src.health -= damage
src << "[usr] starts a battle with you!"
oview(1) << "[usr] begins to battle with [src]!"
src << "[usr] does [damage] damage to you!"
usr << "You do [damage] to [src]!"
Retaliate()
if(src.health <= 0)
src.health = src.maxHealth
attacking = 0
usr << "You killed [src]."
gain_Level()
del src
Problem description:What I need is everytime the person attacks, it has a delay to the attacking, so the person can not just spam kill and spam attack. The sleep has obviously failed.
What sleep? I did not see one there. If you had one, and only executed the main part of the function when !attacking, it should work fine.