ID:155694
 
I want to set my verb up so that the usr cannot attack until the enemy has finished its attack. (I know I still need to add the deathcheck proc)

This is what I have so far

        Attack(var/mob/M as mob in oview(1))
var/able = 1
if(!M.invincible)
if(able)
src.hp -= usr.dmg
usr << "<font color = green>You attack [M] for [usr.dmg] damage!</font>"
// want to set able to null
sleep 3
usr << "[M] prepares to attack"
sleep 5
usr.hp -= src.dmg
usr << "<font color = red>[M] attacks you for [M.dmg] damage!</font>"
// want to set able back to true"
else
usr << "You swung too fast and missed!"
else
usr << "<font color = yellow>You cannot attack [M]</font>"
return
what I do is I have a pause variable. Whenever someone attacks it makes pause=1 and then uses a spawn(#) to determine how long that variable stays on. with this always figure out if your enemy is attacking by checking their pause. This can also be used to slow down or speed up a players attack speed, depending on the delay

ex:
mob/proc
Pause(var/time=5)
if(pause) return //we don't want to start the spawn to make pause 0 if it's already going.
pause=1
spawn(time) pause=0 //using a variable allows for shorter/longer spawns if necessary.

mob/verb
Attack(var/mob/m in in oview(1))
if(m.pause||pause) //if m is attacking or you are still attacking
src<<"You cannot attack right now, blah blah"
return
else //you don't really need the 'else' here, since it's being returned anyways.
src<<"You attacked!"
Pause()

In response to Bravo1
Thanks, that really helps alot :)