ID:140399
 
Code:
mob
Skills
Warrior
verb
Slash()
var
usable = 1
CoolDown = 0
set category = "Skills"
if(CoolDown>0)
usr << output("You still have to wait [CoolDown/10] seconds to use Slash again.","chat")
return
else
view() << output("[usr.Name] shouts: Rawr!","chat")
usable = 0
spawn(50)
usable = 1
CoolDown += 100
usr.cooldown(CoolDown)


proc
cooldown(var/Skillcooldowntime)
var/Cooldowntime=Skillcooldowntime
if(Cooldowntime==0) return
else
sleep(Cooldowntime/10)
Cooldowntime-=10
Cooldown(Cooldowntime)


Problem description:
Okay, so my problem is, this doesn't work. When you run it, you just keep getting to slash, with no delay. I'm not upset about not being able to delay slashed, but moreso about my in ability to pass arguments correctly/inability to make procs work the way I want them to. So if anybody can tell me why this cooldown isn't work, please let me know, it will be very appreciated!

this is a trick i use.

you could give each skill an attack delay var and an attack time var.

each time that skill is used make the attack time equal to world.time+attack_delay

then place a simple if / else check at the beginning of the skill.

if the attack time is greater than world time, return else run the attack as normal *do damage , etc.*

You could edit this to reflect the wait time if they still need to wait a few secs.

//mob/char
verb
var/attack_time=0
var/attack_delay=20
slash()
if(attack_time>world.time)
src << "Cant hit yet"
else
//whack stuff and
attack_time=world.time+attack_delay