ID:261878
 
See, the problem is, I want attack to be stalled, and only done every so often. The .center key is macro'd for the Attack verb, which is hidden. But, if I hold it down, it pretty much spams a large amount of attacks towards the mob its attacking. Below is the code, any ideas for stalling it would be appreciated, and you can see the method I try'd.

    proc/Attack(mob/victim)
if(!client)
var/potential_damage = rand(Weapon, MaxWeapon) + Strength
victim.TakeDamage(src, potential_damage)
else
if(attack_stall >= 1)
var/potential_damage = rand(Weapon, MaxWeapon) + Strength
victim.TakeDamage(src, potential_damage)
attack_stall = 0
else
sleep(15)
attack_stall = 2



Thanks in advance.
look up sleep()
In response to Airjoe
What would you suggest then? Obviously using the sleep proc was a bad idea, heh heh.
Tony WK wrote:
See, the problem is, I want attack to be stalled, and only done every so often. The .center key is macro'd for the Attack verb, which is hidden. But, if I hold it down, it pretty much spams a large amount of attacks towards the mob its attacking. Below is the code, any ideas for stalling it would be appreciated, and you can see the method I try'd.

First of all, kudos on a very well-crafted proc. The approach to stalling isn't right, but you designed around the usr issue admirably. So many people screw that up it's beyond belief.

To stall properly, I'd try this:
proc/Attack(mob/victim)
if(attack_stall++) return
... // body of the proc here
spawn(15) attack_stall = 0

Lummox JR
In response to Lummox JR
Hehe, thanks for your help, I'm sure that would of worked but I was doing something really dumb, I was stalling the wrong proc. After playing with the take damage proc, I fixed it so I could stall the damage however I like, thanks for the compliment.