ID:179349
 
ive tried putting sleep into the attack verb to make it so it takes awhile before you attack again, but it doesn't work. How do you do it?
Tazor07 wrote:
ive tried putting sleep into the attack verb to make it so it takes awhile before you attack again, but it doesn't work. How do you do it?

Are you asking for methods of waiting between attacks or how to use the sleep command?

It might be easier if you posted your attack code and people could see how you are trying to use sleep.
In response to ACWraith
verb // Make a verb...
Attack(mob/M in oview(1)) if(istype(M,/mob/NPC))
var/damage = rand(1,Attack)
usr << "You attack [M]!"
usr << "[damage] damage!"
M << "[usr] attacks you!"
M << "[damage] damage!"
M.HP -= damage
sleep(20)
M.DeathCheck()
usr.Levelup()
In response to Tazor07
the if(istype(M,/mob/NPC)) is below attack and is indented so what did i do wrong with the sleep part?
In response to Tazor07
I'm assuming this verb is for a mob. You may want to try something to the point of:

mob/var/canAttack = TRUE as num

mob/verb/Attack(mob/M in oview(1))
if (canAttack)
canAttack = FALSE
// Your attack stuff
sleep(20)
// Your stuff to do after sleep
canAttack = TRUE
In response to Tazor07
Tazor07 wrote:
the if(istype(M,/mob/NPC)) is below attack and is indented so what did i do wrong with the sleep part?

You used sleep correctly as far as I can tell. The lines after sleep are indeed not happening until after the time limit. However, future calls are not being blocked. Try the method I listed above.