ID:149597
 
Well i want this code to allow the user to click the verb once and then wait before it works again. At the moment it only creates a backlog of the attack intended for use, which is then fired simulataneously. (i want it to wait longer than 1.4 seconds and not backlog them to fire together.)

mob/verb/RadioactiveBreath()
set name = "Radioactive Breath"
set category = "Kaiju"
if(usr.f == 1)
usr << "You can only fire one at a time"
else
usr << "You fire your Radioactive Breath!"
icon_state="fire"
f=1
sleep(14)
usr.icon_state = ""
usr.f = 0
var/obj/laserfront = new /obj/laser/front (null)
var/obj/laserback = new /obj/laser/back (null)
laserfront.dir = src.dir
laserback.dir = src.dir
switch(src.dir)
if(NORTH)
laserback.loc = locate(src.x,src.y+1,src.z)
laserfront.loc = locate(src.x,src.y+2,src.z)
if(SOUTH)
laserback.loc = locate(src.x,src.y-1,src.z)
laserfront.loc = locate(src.x,src.y-2,src.z)
if(EAST)
laserfront.loc = locate(src.x+2,src.y,src.z)
laserback.loc = locate(src.x+1,src.y,src.z)
if(WEST)
laserback.loc = locate(src.x-1,src.y,src.z)
laserfront.loc = locate(src.x-2,src.y,src.z)
else
src << "You must be facing a cardinal direction to fire your breath."
return
var/traveldistance = 10 // What is i? [i is just a number deciding how far the laser will travel. I'll rename it traveldistance]
while(traveldistance)
step(laserfront,laserfront.dir)
step(laserback,laserback.dir)
traveldistance -= 1
sleep(1)
del laserfront
del laserback

Here is an example.

mob/verb/Say()
if(src.say==1)
return
else
var/T=input("") as text
world<<"[src.name]: [T]"
src.say=1
sleep(20)
src.say=0
mob/var/say=0
In response to Super16
still confused. My 4 month absence from DM has something to do with it. =(
In response to Gojira
i think that u jus need to change the 14 to a higher number to make it wait longer 14=1.4secs 20=2secs 100=10 secs etc.
In response to Yamama
but then my icon state would replay more than i want it to =(
In response to Gojira
Don't do that then use the flick proc.
In response to Super16
i tryed it and multiple Breaths are fired :-(